Faster ligo export step

This commit is contained in:
kaetemi 2014-07-30 20:56:28 +02:00
parent c062aab85a
commit fa64fb9359
3 changed files with 38 additions and 9 deletions

View file

@ -282,6 +282,26 @@ def findFilesNoSubdir(log, dir_where, file_ext):
printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull) printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull)
return result 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): def findFile(log, dir_where, file_name):
files = os.listdir(dir_where) files = os.listdir(dir_where)
for fileName in files: 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))) printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
return 0 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 updateCount = 0
skipCount = 0 skipCount = 0
lenSrcExt = len(ext_source) 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) destFiles = findFilesNoSubdir(log, dir_dest, ext_dest)
for file in sourceFiles: for file in sourceFiles:
sourceFile = dir_source + "/" + file 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))) printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
return 0 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): def needUpdateDirNoSubdirFile(log, dir_source, file_dest):
if not os.path.isfile(file_dest): if not os.path.isfile(file_dest):
return 1 return 1

View file

@ -62,7 +62,7 @@ if LigoExportLand == "" or LigoExportOnePass == 1:
mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory) mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory)
mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0]) mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0])
mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory) 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) printLog(log, "WRITE " + ligoIniPath)
ligoIni = open(ligoIniPath, "w") ligoIni = open(ligoIniPath, "w")
ligoIni.write("[LigoConfig]\n") ligoIni.write("[LigoConfig]\n")

View file

@ -508,8 +508,8 @@ try
for curFileName in MaxFilesList do for curFileName in MaxFilesList do
( (
-- Free memory and file handles -- Free memory and file handles
gc () -- gc ()
resetMAXFile #noprompt -- resetMAXFile #noprompt
tokenArray = filterString (getFilenameFile curFileName) "-" tokenArray = filterString (getFilenameFile curFileName) "-"
@ -622,6 +622,8 @@ try
) )
resetMAXFile #noprompt resetMAXFile #noprompt
gc ()
resetMAXFile #noprompt
) )
else else
( (
@ -635,10 +637,10 @@ try
for curFileName in MaxFilesList do for curFileName in MaxFilesList do
( (
-- Free memory and file handles -- Free memory and file handles
gc () -- gc ()
-- Reset 3dsmax -- Reset 3dsmax
resetMAXFile #noprompt -- resetMAXFile #noprompt
tokenArray = filterString (getFilenameFile curFileName) "-" tokenArray = filterString (getFilenameFile curFileName) "-"
if (tokenArray.count == 4) and (tokenArray[1] == "zonetransition") then if (tokenArray.count == 4) and (tokenArray[1] == "zonetransition") then
@ -852,6 +854,8 @@ try
) )
resetMAXFile #noprompt resetMAXFile #noprompt
gc ()
resetMAXFile #noprompt
) )
else else
( (
@ -865,8 +869,8 @@ try
for curFileName in MaxFilesList do for curFileName in MaxFilesList do
( (
-- Free memory and file handles -- Free memory and file handles
gc () -- gc ()
resetMAXFile #noprompt -- resetMAXFile #noprompt
tokenArray = filterString (getFilenameFile curFileName) "-" tokenArray = filterString (getFilenameFile curFileName) "-"
if (tokenArray.count == 2) and (tokenArray[1] == "zonespecial") then if (tokenArray.count == 2) and (tokenArray[1] == "zonespecial") then
@ -971,6 +975,8 @@ try
) )
resetMAXFile #noprompt resetMAXFile #noprompt
gc ()
resetMAXFile #noprompt
) )
else else
( (