From a13574ec887e23ae0941db609558be548b9fe510 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 8 Feb 2014 20:02:57 +0100 Subject: [PATCH] Implement skip for shape lightmap optimize build process --- .../build_gamedata/configuration/scripts.py | 8 +++---- .../build_gamedata/processes/shape/2_build.py | 24 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/code/nel/tools/build_gamedata/configuration/scripts.py b/code/nel/tools/build_gamedata/configuration/scripts.py index a338ec84d..062756860 100644 --- a/code/nel/tools/build_gamedata/configuration/scripts.py +++ b/code/nel/tools/build_gamedata/configuration/scripts.py @@ -335,7 +335,7 @@ def needUpdateMultiDirNoSubdirFile(log, root_dir, dirs_source, file_dest): def needUpdateDirNoSubdir(log, dir_source, dir_dest): latestSourceFile = 0 - oldestDestFile = 0 + latestDestFile = 0 sourceFiles = os.listdir(dir_source) destFiles = os.listdir(dir_dest) for file in sourceFiles: @@ -348,9 +348,9 @@ def needUpdateDirNoSubdir(log, dir_source, dir_dest): filePath = dir_dest + "/" + file if os.path.isfile(filePath): fileTime = os.stat(filePath).st_mtime - if oldestDestFile == 0 or fileTime < oldestDestFile: - oldestDestFile = fileTime - if latestSourceFile > oldestDestFile: + if (fileTime > latestDestFile): + latestDestFile = fileTime + if latestSourceFile > latestDestFile: return 1 else: return 0 diff --git a/code/nel/tools/build_gamedata/processes/shape/2_build.py b/code/nel/tools/build_gamedata/processes/shape/2_build.py index 1d8113ff9..ff5a86a85 100644 --- a/code/nel/tools/build_gamedata/processes/shape/2_build.py +++ b/code/nel/tools/build_gamedata/processes/shape/2_build.py @@ -76,14 +76,22 @@ else: # copy lightmap_not_optimized to lightmap printLog(log, ">>> Optimize lightmaps <<<") -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeTagExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) -removeFilesRecursive(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) -copyFiles(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) -# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits -subprocess.call([ LightmapOptimizer, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, ExportBuildDirectory + "/" + ShapeTagExportDirectory, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ]) +loPathLightmapsOriginal = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory +mkPath(log, loPathLightmapsOriginal) +loPathLightmaps = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory +loPathShapes = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory +loPathTags = ExportBuildDirectory + "/" + ShapeTagExportDirectory +mkPath(log, loPathLightmaps) +mkPath(log, loPathShapes) +mkPath(log, loPathTags) +if needUpdateDirNoSubdir(log, loPathLightmapsOriginal, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathShapes, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathTags, loPathLightmaps): + removeFilesRecursive(log, loPathLightmaps) + copyFiles(log, loPathLightmapsOriginal, loPathLightmaps) + # Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits + # lightmap_optimizer [path_tags] [path_flag8bit] + subprocess.call([ LightmapOptimizer, loPathLightmaps, loPathShapes, loPathTags, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ]) +else: + printLog(log, "SKIP *") # Convert lightmap in 16 bits mode if they are not 8 bits lightmap printLog(log, ">>> Convert lightmaps in 16 or 8 bits <<<")