mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Faster ligo export step
This commit is contained in:
parent
c8dcfe8d05
commit
e58df5f7e9
3 changed files with 38 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue