Implement skip for shape lightmap optimize build process

This commit is contained in:
kaetemi 2014-02-08 20:02:57 +01:00
parent 76009d8b05
commit c04eea9a22
2 changed files with 20 additions and 12 deletions

View file

@ -335,7 +335,7 @@ def needUpdateMultiDirNoSubdirFile(log, root_dir, dirs_source, file_dest):
def needUpdateDirNoSubdir(log, dir_source, dir_dest): def needUpdateDirNoSubdir(log, dir_source, dir_dest):
latestSourceFile = 0 latestSourceFile = 0
oldestDestFile = 0 latestDestFile = 0
sourceFiles = os.listdir(dir_source) sourceFiles = os.listdir(dir_source)
destFiles = os.listdir(dir_dest) destFiles = os.listdir(dir_dest)
for file in sourceFiles: for file in sourceFiles:
@ -348,9 +348,9 @@ def needUpdateDirNoSubdir(log, dir_source, dir_dest):
filePath = dir_dest + "/" + file filePath = dir_dest + "/" + file
if os.path.isfile(filePath): if os.path.isfile(filePath):
fileTime = os.stat(filePath).st_mtime fileTime = os.stat(filePath).st_mtime
if oldestDestFile == 0 or fileTime < oldestDestFile: if (fileTime > latestDestFile):
oldestDestFile = fileTime latestDestFile = fileTime
if latestSourceFile > oldestDestFile: if latestSourceFile > latestDestFile:
return 1 return 1
else: else:
return 0 return 0

View file

@ -76,14 +76,22 @@ else:
# copy lightmap_not_optimized to lightmap # copy lightmap_not_optimized to lightmap
printLog(log, ">>> Optimize lightmaps <<<") printLog(log, ">>> Optimize lightmaps <<<")
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory) loPathLightmapsOriginal = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) mkPath(log, loPathLightmapsOriginal)
mkPath(log, ExportBuildDirectory + "/" + ShapeTagExportDirectory) loPathLightmaps = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory
mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) loPathShapes = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory
removeFilesRecursive(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) loPathTags = ExportBuildDirectory + "/" + ShapeTagExportDirectory
copyFiles(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) mkPath(log, loPathLightmaps)
# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits mkPath(log, loPathShapes)
subprocess.call([ LightmapOptimizer, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, ExportBuildDirectory + "/" + ShapeTagExportDirectory, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ]) 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_lightmaps> <path_shapes> [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 # Convert lightmap in 16 bits mode if they are not 8 bits lightmap
printLog(log, ">>> Convert lightmaps in 16 or 8 bits <<<") printLog(log, ">>> Convert lightmaps in 16 or 8 bits <<<")