mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 13:46:13 +00:00
Use tags for pacs prim export
This commit is contained in:
parent
d660f1d92e
commit
993b450ee9
8 changed files with 158 additions and 58 deletions
|
@ -88,8 +88,6 @@ def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVaria
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
generateSimpleMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimInstallDirectory")
|
|
||||||
|
|
||||||
generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory")
|
generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory")
|
||||||
|
|
||||||
generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory")
|
generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory")
|
||||||
|
|
|
@ -100,6 +100,8 @@ def generateTaggedMaxExporter(processName, fileExtension, sourceDirectoriesVaria
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
generateTaggedMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimTagExportDirectory", "PacsPrimInstallDirectory")
|
||||||
|
|
||||||
generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory")
|
generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory")
|
||||||
|
|
||||||
generateTaggedMaxScript("ig", "ig")
|
generateTaggedMaxScript("ig", "ig")
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#
|
#
|
||||||
# \file 1_export.py
|
# \file 1_export.py
|
||||||
# \brief Export pacs_prim
|
# \brief Export pacs_prim
|
||||||
# \date 2011-09-28-07-42-GMT
|
# \date 2013-07-24-14-21-GMT
|
||||||
# \author Jan Boon (Kaetemi)
|
# \author Jan Boon (Kaetemi)
|
||||||
# Python port of game data build pipeline.
|
# Python port of game data build pipeline.
|
||||||
# Export pacs_prim
|
# Export pacs_prim
|
||||||
|
@ -33,7 +33,9 @@ sys.path.append("../../configuration")
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
if os.path.isfile("temp_log.log"):
|
||||||
|
os.remove("temp_log.log")
|
||||||
|
log = open("temp_log.log", "w")
|
||||||
from scripts import *
|
from scripts import *
|
||||||
from buildsite import *
|
from buildsite import *
|
||||||
from process import *
|
from process import *
|
||||||
|
@ -47,6 +49,7 @@ printLog(log, "-------")
|
||||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
|
|
||||||
# Find tools
|
# Find tools
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
@ -58,15 +61,18 @@ if MaxAvailable:
|
||||||
|
|
||||||
printLog(log, ">>> Export pacs_prim 3dsmax <<<")
|
printLog(log, ">>> Export pacs_prim 3dsmax <<<")
|
||||||
mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory)
|
||||||
|
mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory)
|
||||||
for dir in PacsPrimSourceDirectories:
|
for dir in PacsPrimSourceDirectories:
|
||||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||||
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimExportDirectory, ".pacs_prim")):
|
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimTagExportDirectory, ".max.tag")):
|
||||||
scriptSrc = "maxscript/pacs_prim_export.ms"
|
scriptSrc = "maxscript/pacs_prim_export.ms"
|
||||||
scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms"
|
scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms"
|
||||||
outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log"
|
outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log"
|
||||||
outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory
|
outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory
|
||||||
|
tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory
|
||||||
maxSourceDir = DatabaseDirectory + "/" + dir
|
maxSourceDir = DatabaseDirectory + "/" + dir
|
||||||
tagList = findFiles(log, outputDirectory, "", ".pacs_prim")
|
maxRunningTagFile = tagDirectory + "/max_running.tag"
|
||||||
|
tagList = findFiles(log, tagDirectory, "", ".max.tag")
|
||||||
tagLen = len(tagList)
|
tagLen = len(tagList)
|
||||||
if os.path.isfile(scriptDst):
|
if os.path.isfile(scriptDst):
|
||||||
os.remove(scriptDst)
|
os.remove(scriptDst)
|
||||||
|
@ -77,18 +83,50 @@ if MaxAvailable:
|
||||||
newline = line.replace("%OutputLogfile%", outputLogfile)
|
newline = line.replace("%OutputLogfile%", outputLogfile)
|
||||||
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
|
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
|
||||||
newline = newline.replace("%OutputDirectory%", outputDirectory)
|
newline = newline.replace("%OutputDirectory%", outputDirectory)
|
||||||
|
newline = newline.replace("%TagDirectory%", tagDirectory)
|
||||||
sDst.write(newline)
|
sDst.write(newline)
|
||||||
sSrc.close()
|
sSrc.close()
|
||||||
sDst.close()
|
sDst.close()
|
||||||
|
zeroRetryLimit = 3
|
||||||
while tagDiff > 0:
|
while tagDiff > 0:
|
||||||
|
mrt = open(maxRunningTagFile, "w")
|
||||||
|
mrt.write("moe-moe-kyun")
|
||||||
|
mrt.close()
|
||||||
printLog(log, "MAXSCRIPT " + scriptDst)
|
printLog(log, "MAXSCRIPT " + scriptDst)
|
||||||
subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ])
|
subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ])
|
||||||
tagList = findFiles(log, outputDirectory, "", ".pacs_prim")
|
if os.path.exists(outputLogfile):
|
||||||
|
try:
|
||||||
|
lSrc = open(outputLogfile, "r")
|
||||||
|
for line in lSrc:
|
||||||
|
lineStrip = line.strip()
|
||||||
|
if (len(lineStrip) > 0):
|
||||||
|
printLog(log, lineStrip)
|
||||||
|
lSrc.close()
|
||||||
|
os.remove(outputLogfile)
|
||||||
|
except Exception:
|
||||||
|
printLog(log, "ERROR Failed to read 3dsmax log")
|
||||||
|
else:
|
||||||
|
printLog(log, "WARNING No 3dsmax log")
|
||||||
|
tagList = findFiles(log, tagDirectory, "", ".max.tag")
|
||||||
newTagLen = len(tagList)
|
newTagLen = len(tagList)
|
||||||
tagDiff = newTagLen - tagLen
|
tagDiff = newTagLen - tagLen
|
||||||
tagLen = newTagLen
|
tagLen = newTagLen
|
||||||
printLog(log, "Exported " + str(tagDiff) + " .pacs_prim files!")
|
addTagDiff = 0
|
||||||
|
if os.path.exists(maxRunningTagFile):
|
||||||
|
printLog(log, "FAIL 3ds Max crashed and/or file export failed!")
|
||||||
|
if tagDiff == 0:
|
||||||
|
if zeroRetryLimit > 0:
|
||||||
|
zeroRetryLimit = zeroRetryLimit - 1
|
||||||
|
addTagDiff = 1
|
||||||
|
else:
|
||||||
|
printLog(log, "FAIL Retry limit reached!")
|
||||||
|
else:
|
||||||
|
addTagDiff = 1
|
||||||
|
os.remove(maxRunningTagFile)
|
||||||
|
printLog(log, "Exported " + str(tagDiff) + " .max files!")
|
||||||
|
tagDiff += addTagDiff
|
||||||
os.remove(scriptDst)
|
os.remove(scriptDst)
|
||||||
|
printLog(log, "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,8 +137,10 @@ if os.path.isfile(listPath):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printLog(log, "")
|
|
||||||
log.close()
|
log.close()
|
||||||
|
if os.path.isfile("log.log"):
|
||||||
|
os.remove("log.log")
|
||||||
|
shutil.move("temp_log.log", "log.log")
|
||||||
|
|
||||||
|
|
||||||
# end of file
|
# end of file
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
-- Allocate 20 Me for the script
|
-- Allocate 20 Me for the script
|
||||||
heapSize += 15000000
|
heapSize += 15000000
|
||||||
|
|
||||||
|
-- In case of error just abort the app and don't show nel report window
|
||||||
|
NelForceQuitOnMsgDisplayer()
|
||||||
|
|
||||||
nlErrorFilename = "%OutputLogfile%"
|
nlErrorFilename = "%OutputLogfile%"
|
||||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||||
if nlErrorStream == undefined then
|
if nlErrorStream == undefined then
|
||||||
|
@ -110,7 +113,11 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
removeRunningTag = true
|
||||||
|
|
||||||
try
|
try
|
||||||
|
(
|
||||||
|
undo off
|
||||||
(
|
(
|
||||||
-- Get files in the %MaxSourceDirectory% directory
|
-- Get files in the %MaxSourceDirectory% directory
|
||||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||||
|
@ -127,12 +134,12 @@ try
|
||||||
for i = 1 to files.count do
|
for i = 1 to files.count do
|
||||||
(
|
(
|
||||||
inputMaxFile = files[i]
|
inputMaxFile = files[i]
|
||||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim")
|
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||||
|
|
||||||
try
|
--try
|
||||||
(
|
--(
|
||||||
-- Compare file date
|
-- Compare file date
|
||||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||||
(
|
(
|
||||||
-- Free memory and file handles
|
-- Free memory and file handles
|
||||||
gc()
|
gc()
|
||||||
|
@ -145,24 +152,46 @@ try
|
||||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||||
(
|
(
|
||||||
runNelMaxExport(inputMaxFile)
|
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||||
|
|
||||||
|
-- Write a tag file
|
||||||
|
if tagThisFile == true then
|
||||||
|
(
|
||||||
|
tagFile = createFile outputTagFile
|
||||||
|
if tagFile == undefined then
|
||||||
|
(
|
||||||
|
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
print "mukyu" to: tagFile
|
||||||
|
close tagFile
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
-- Error
|
-- Error
|
||||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||||
|
removeRunningTag = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
nlerror("SKIPPED " + inputMaxFile)
|
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||||
)
|
|
||||||
)
|
|
||||||
catch
|
|
||||||
(
|
|
||||||
-- Error
|
|
||||||
nlerror("ERROR error exporting 'pacs_prim' in files " + inputMaxFile)
|
|
||||||
)
|
)
|
||||||
|
--)
|
||||||
|
--catch
|
||||||
|
--(
|
||||||
|
-- -- Error
|
||||||
|
-- nlerror("ERROR error exporting 'pacs_prim' in file " + inputMaxFile)
|
||||||
|
-- removeRunningTag = false
|
||||||
|
--)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
@ -170,15 +199,42 @@ try
|
||||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
catch
|
catch
|
||||||
(
|
(
|
||||||
-- Error
|
-- Error
|
||||||
nlerror("ERROR fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
||||||
|
nlerror("FAIL Fatal error occured")
|
||||||
|
NelForceQuitRightNow()
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
|
||||||
|
try
|
||||||
|
(
|
||||||
|
if (removeRunningTag) then
|
||||||
|
(
|
||||||
|
resetMAXFile #noPrompt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
catch
|
||||||
|
(
|
||||||
|
nlerror("FAIL Last reset fails")
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
|
||||||
|
if (removeRunningTag) then
|
||||||
|
(
|
||||||
|
nlerror("SUCCESS All .max files have been successfully exported")
|
||||||
|
deleteFile("%TagDirectory%/max_running.tag")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
nlerror("FAIL One or more issues occured")
|
||||||
|
NelForceQuitRightNow()
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Bye
|
-- Bye
|
||||||
|
nlerror("BYE")
|
||||||
resetMAXFile #noprompt
|
|
||||||
quitMAX #noPrompt
|
quitMAX #noPrompt
|
||||||
quitMAX() #noPrompt
|
quitMAX() #noPrompt
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -210,6 +210,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -218,6 +218,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -203,6 +203,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
Loading…
Reference in a new issue