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):
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

View file

@ -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)
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
subprocess.call([ LightmapOptimizer, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, ExportBuildDirectory + "/" + ShapeTagExportDirectory, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ])
# 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
printLog(log, ">>> Convert lightmaps in 16 or 8 bits <<<")