From fa64fb9359299f2e913ce47c64999382d0ca888f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 30 Jul 2014 20:56:28 +0200 Subject: [PATCH] Faster ligo export step --- .../build_gamedata/configuration/scripts.py | 27 +++++++++++++++++-- .../build_gamedata/processes/ligo/1_export.py | 2 +- .../ligo/maxscript/nel_ligo_export.ms | 18 ++++++++----- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/code/nel/tools/build_gamedata/configuration/scripts.py b/code/nel/tools/build_gamedata/configuration/scripts.py index d7122d3a3..6bd4e00dc 100755 --- a/code/nel/tools/build_gamedata/configuration/scripts.py +++ b/code/nel/tools/build_gamedata/configuration/scripts.py @@ -282,6 +282,26 @@ def findFilesNoSubdir(log, dir_where, file_ext): printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull) return result +def findFilesNoSubdirFiltered(log, dir_where, file_ext, filter): + if len(filter) == 0: + return findFilesNoSubdir(log, dir_where, file_ext) + result = [ ] + files = os.listdir(dir_where) + len_file_ext = len(file_ext) + for fileName in files: + if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": + fileFull = dir_where + "/" + fileName + if os.path.isfile(fileFull): + if fileName[-len_file_ext:].lower() == file_ext.lower(): + fileNameLower = fileName.lower() + for filterWord in filter: + if filterWord in fileNameLower: + result += [ fileName ] + break + elif not os.path.isdir(fileFull): + printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull) + return result + def findFile(log, dir_where, file_name): files = os.listdir(dir_where) for fileName in files: @@ -323,11 +343,11 @@ def needUpdateDirByLowercaseTagLog(log, dir_source, ext_source, dir_dest, ext_de printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) return 0 -def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest): +def needUpdateDirByTagLogFiltered(log, dir_source, ext_source, dir_dest, ext_dest, filter): updateCount = 0 skipCount = 0 lenSrcExt = len(ext_source) - sourceFiles = findFilesNoSubdir(log, dir_source, ext_source) + sourceFiles = findFilesNoSubdirFiltered(log, dir_source, ext_source, filter) destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) for file in sourceFiles: sourceFile = dir_source + "/" + file @@ -348,6 +368,9 @@ def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest): printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) return 0 +def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest): + needUpdateDirByTagLogFiltered(log, dir_source, ext_source, dir_dest, ext_dest, [ ]) + def needUpdateDirNoSubdirFile(log, dir_source, file_dest): if not os.path.isfile(file_dest): return 1 diff --git a/code/nel/tools/build_gamedata/processes/ligo/1_export.py b/code/nel/tools/build_gamedata/processes/ligo/1_export.py index 8204926ac..029121478 100755 --- a/code/nel/tools/build_gamedata/processes/ligo/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ligo/1_export.py @@ -62,7 +62,7 @@ if LigoExportLand == "" or LigoExportOnePass == 1: mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory) mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0]) mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory, ".max", ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory, ".max.tag")): + if (needUpdateDirByTagLogFiltered(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory, ".max", ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory, ".max.tag", [ "zonematerial", "zonetransition", "zonespecial" ])): printLog(log, "WRITE " + ligoIniPath) ligoIni = open(ligoIniPath, "w") ligoIni.write("[LigoConfig]\n") diff --git a/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms b/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms index 303b4917f..48a98bd39 100755 --- a/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms +++ b/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms @@ -508,8 +508,8 @@ try for curFileName in MaxFilesList do ( -- Free memory and file handles - gc () - resetMAXFile #noprompt + -- gc () + -- resetMAXFile #noprompt tokenArray = filterString (getFilenameFile curFileName) "-" @@ -622,6 +622,8 @@ try ) resetMAXFile #noprompt + gc () + resetMAXFile #noprompt ) else ( @@ -635,10 +637,10 @@ try for curFileName in MaxFilesList do ( -- Free memory and file handles - gc () + -- gc () -- Reset 3dsmax - resetMAXFile #noprompt + -- resetMAXFile #noprompt tokenArray = filterString (getFilenameFile curFileName) "-" if (tokenArray.count == 4) and (tokenArray[1] == "zonetransition") then @@ -852,6 +854,8 @@ try ) resetMAXFile #noprompt + gc () + resetMAXFile #noprompt ) else ( @@ -865,8 +869,8 @@ try for curFileName in MaxFilesList do ( -- Free memory and file handles - gc () - resetMAXFile #noprompt + -- gc () + -- resetMAXFile #noprompt tokenArray = filterString (getFilenameFile curFileName) "-" if (tokenArray.count == 2) and (tokenArray[1] == "zonespecial") then @@ -971,6 +975,8 @@ try ) resetMAXFile #noprompt + gc () + resetMAXFile #noprompt ) else (