mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-27 11:00:54 +00:00
Use tags for pacs prim export
This commit is contained in:
parent
199ead5988
commit
da53f11c73
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("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")
|
||||
|
||||
generateTaggedMaxScript("ig", "ig")
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# \file 1_export.py
|
||||
# \brief Export pacs_prim
|
||||
# \date 2011-09-28-07-42-GMT
|
||||
# \date 2013-07-24-14-21-GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Export pacs_prim
|
||||
|
@ -33,7 +33,9 @@ sys.path.append("../../configuration")
|
|||
|
||||
if os.path.isfile("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 buildsite 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, "")
|
||||
|
||||
|
||||
# Find tools
|
||||
# ...
|
||||
|
||||
|
@ -58,15 +61,18 @@ if MaxAvailable:
|
|||
|
||||
printLog(log, ">>> Export pacs_prim 3dsmax <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory)
|
||||
for dir in PacsPrimSourceDirectories:
|
||||
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"
|
||||
scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms"
|
||||
outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log"
|
||||
outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory
|
||||
tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory
|
||||
maxSourceDir = DatabaseDirectory + "/" + dir
|
||||
tagList = findFiles(log, outputDirectory, "", ".pacs_prim")
|
||||
maxRunningTagFile = tagDirectory + "/max_running.tag"
|
||||
tagList = findFiles(log, tagDirectory, "", ".max.tag")
|
||||
tagLen = len(tagList)
|
||||
if os.path.isfile(scriptDst):
|
||||
os.remove(scriptDst)
|
||||
|
@ -77,18 +83,50 @@ if MaxAvailable:
|
|||
newline = line.replace("%OutputLogfile%", outputLogfile)
|
||||
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
|
||||
newline = newline.replace("%OutputDirectory%", outputDirectory)
|
||||
newline = newline.replace("%TagDirectory%", tagDirectory)
|
||||
sDst.write(newline)
|
||||
sSrc.close()
|
||||
sDst.close()
|
||||
zeroRetryLimit = 3
|
||||
while tagDiff > 0:
|
||||
mrt = open(maxRunningTagFile, "w")
|
||||
mrt.write("moe-moe-kyun")
|
||||
mrt.close()
|
||||
printLog(log, "MAXSCRIPT " + scriptDst)
|
||||
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)
|
||||
tagDiff = newTagLen - tagLen
|
||||
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)
|
||||
printLog(log, "")
|
||||
|
||||
|
||||
|
||||
|
@ -99,8 +137,10 @@ if os.path.isfile(listPath):
|
|||
|
||||
|
||||
|
||||
printLog(log, "")
|
||||
log.close()
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
shutil.move("temp_log.log", "log.log")
|
||||
|
||||
|
||||
# end of file
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
|
@ -110,75 +113,128 @@ fn runNelMaxExport inputMaxFile =
|
|||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
undo off
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim")
|
||||
|
||||
try
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
runNelMaxExport(inputMaxFile)
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
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
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED " + 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
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- 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
|
||||
|
||||
resetMAXFile #noprompt
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -206,6 +206,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
|||
|
||||
# PACS primitives directories
|
||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||
|
||||
|
||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||
|
|
|
@ -210,6 +210,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
|||
|
||||
# PACS primitives directories
|
||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||
|
||||
|
||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||
|
|
|
@ -218,6 +218,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
|||
|
||||
# PACS primitives directories
|
||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||
|
||||
|
||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||
|
|
|
@ -203,6 +203,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
|||
|
||||
# PACS primitives directories
|
||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||
|
||||
|
||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||
|
|
Loading…
Reference in a new issue