Changed: #1092 Improved build pipeline scripts to properly avoid 3ds max hanging and handle crashes without user interference

This commit is contained in:
kaetemi 2010-09-26 17:07:13 +02:00
parent 9f256c4d4b
commit a7c6ed7a35
23 changed files with 1562 additions and 704 deletions

View file

@ -90,8 +90,6 @@ def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVaria
generateSimpleMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimInstallDirectory")
generateSimpleMaxExporter("anim", "anim", "AnimSourceDirectories", "AnimExportDirectory", "AnimInstallDirectory")
generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory")
generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory")

View file

@ -108,6 +108,10 @@ generateTaggedMaxExporter("rbank", "cmb", "RBankCmbSourceDirectories", "RBankCmb
generateTaggedMaxExporter("veget", "veget", "VegetSourceDirectories", "VegetExportDirectory", "VegetTagExportDirectory", "VegetInstallDirectory")
generateTaggedMaxScript("shape", "shape")
generateTaggedMaxExporter("anim", "anim", "AnimSourceDirectories", "AnimExportDirectory", "AnimTagExportDirectory", "AnimInstallDirectory")
printLog(log, "")

View file

@ -5,7 +5,7 @@ NEL3D_APPDATA_EXPORT_NODE_ANIMATION = 1423062800
fn runNelMaxExport inputMaxFile =
(
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".%PreGenFileExtension%")
tagThisFile = false
tagThisFile = true
-- Unhide category
unhidecategory()
@ -55,13 +55,12 @@ fn runNelMaxExport inputMaxFile =
else
(
nlerror("OK " + outputNelFile)
tagThisFile = true
)
)
else
(
-- Error
nlerror("ERROR exporting animation: no node animated to export in file " + inputMaxFile)
nlerror("WARNING exporting animation: no node animated to export in file " + inputMaxFile)
)
return tagThisFile

View file

@ -0,0 +1,361 @@
-- Some globals
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
-- "1" = is an accelerator type PORTAL
-- "2" = is an accelerator type CLUSTER
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
-- "17" = is an accelerator type PORTAL DYNAMIC
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
-- "0" = export me
-- "1" = DONT export me
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
NEL3D_APPDATA_LOD = 1423062537
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
NEL3D_APPDATA_COLLISION = 1423062613
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
NEL3D_APPDATA_AUTOMATIC_ANIMATION = 1423062617
-- This node is n accelerator ?
fn isAccelerator node =
(
accel = getappdata node NEL3D_APPDATA_ACCEL
if (accel != undefined) then
(
if (accel == "0") or (accel == "32") then
return false
else
return true
)
return false
)
-- Must export this node ?
fn isToBeExported node =
(
if (isAccelerator node) == true then
return false
if ((classof node) == RklPatch) then
return false
if ((classof node) == nel_ps) then
return false
if ((classof node) == nel_pacs_cylinder) then
return false
if ((classof node) == nel_pacs_box) then
return false
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
return true
)
-- Must export this node ?
fn isAnimToBeExported node =
(
automaticAnimation = getappdata node NEL3D_APPDATA_AUTOMATIC_ANIMATION
if (automaticAnimation == undefined) then
return false
if (automaticAnimation == "0") then
return false
if (isAccelerator node) == true then
return false
if ((classof node) == nel_pacs_cylinder) then
return false
if ((classof node) == nel_pacs_box) then
return false
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
if (doNotExport != undefined) then
(
if (doNotExport == "1") then
return false
)
return true
)
-- Cast shadow ?
fn isCastShadow node =
(
if (classof node == nel_ps) then
return false
if (isAccelerator node) == true then
(
return false
)
else
(
return true
)
)
-- List the lod
lod_array = #()
-- is a lod ?
fn isLod node =
(
for i = 1 to lod_array.count do
(
if (lod_array[i] == node) then
return true
)
return false
)
-- have a coarse mesh ?
fn haveCoarseMesh node =
(
-- Get lod count
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
if (nodeCount != undefined) then
(
-- For each lod
nodeCountNum = nodeCount as Integer
for lod = 1 to nodeCountNum do
(
-- Get the lod
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
-- Exist ?
if (lod != undefined) then
(
-- Select a node
nd = execute ("$'"+lod+"'")
-- Node exist ?
if (nd != undefined) then
(
-- Is a coarse mesh ?
if (getappdata nd NEL3D_APPDATA_LOD_COARSE_MESH == "1") then
return true
)
)
)
)
return false
)
fn runNelMaxExport inputMaxFile =
(
tagThisFile = false
-- Unhide category
unhidecategory()
-- Unhide
max unhide all
-- unselect
max select none
-- Exported object count
exported = 0
-- Add the lod
for node in geometry do
(
-- Get lod count
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
if (nodeCount != undefined) then
(
-- For each lod
nodeCountNum = nodeCount as Integer
for lod = 1 to nodeCountNum do
(
-- Get the lod
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
-- Exist ?
if (lod != undefined) then
(
-- Select a node
try
(
nd = execute("$'"+lod+"'")
)
catch
(
nlerror("Error in Execute $'"+lod+"' from node "+node.name)
nd = undefined
)
-- Node exist ?
if (nd != undefined) then
(
append lod_array nd
)
)
)
)
)
-- Select objects for shadows
for node in geometry do
(
if (node.parent == undefined) then
(
-- Cast shadow ?
if (isCastShadow node == true) then
(
-- Select this node
selectmore node
)
)
)
-- Tag this file ?
tagThisFile = true
-- Array of node to export
array_node = #()
-- Add geometry
for node in geometry do
append array_node node
-- Add shapes
for node in shapes do
append array_node node
-- For each node
for node in array_node do
(
-- It is root ?
if (node.parent == undefined) then
(
-- Is not a skeleton ?
if (node.name != "Bip01") then
(
-- Can be exported ?
if (isToBeExported node == true) then
(
-- Not a lod ?
if ((isLod node) == false) then
(
-- Output directory
if (haveCoarseMesh node) == true then
output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape")
else
output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape")
-- Compare file date
if (NeLTestFileDate output inputMaxFile) == true then
(
try
(
-- Export the shape
if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then
(
nlerror("OK "+output)
exported = exported +1
)
else
(
-- Error
nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile)
tagThisFile = false
)
)
catch
(
-- Error
nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile)
tagThisFile = false
)
)
else
(
nlerror("SKIPPED " + output)
exported = exported + 1
)
)
)
)
)
)
-- Export default animations
for node in objects do
(
-- Can export it ?
if (isAnimToBeExported node) == true then
(
-- Anim output directory
output = ("%OutputDirectoryAnim%/" + (node.name) + ".anim")
-- Export the animation
if (NelExportAnimation #(node) output false) == false then
(
nlerror ("ERROR exporting animation " + output)
tagThisFile = false
)
else
(
nlerror("OK " + output)
)
)
)
-- Something exported
if exported == 0 then
(
-- Error
nlerror("WARNING no shape exported from the file " + inputMaxFile)
)
return tagThisFile
)

View file

@ -1,7 +1,9 @@
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View file

@ -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 *
@ -69,6 +71,7 @@ if MaxAvailable:
outputDirectory = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%
tagDirectory = ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%
maxSourceDir = DatabaseDirectory + "/" + dir
maxRunningTagFile = tagDirectory + "/max_running.tag"
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
@ -84,13 +87,44 @@ if MaxAvailable:
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", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-vn" ])
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
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, "")

View file

@ -1,89 +1,125 @@
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]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
try
-- For each files
for i = 1 to files.count do
(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
tagThisFile = runNelMaxExport(inputMaxFile)
-- Free memory and file handles
gc()
heapfree
-- Write a tag file
if tagThisFile == true then
-- Reset 3dsmax
resetMAXFile #noprompt
-- Open the max project
nlerror("Scanning file " + inputMaxFile + " ...")
if (loadMaxFile inputMaxFile quiet:true) == true then
(
tagFile = createFile outputTagFile
if tagFile == undefined then
tagThisFile = runNelMaxExport(inputMaxFile)
-- Write a tag file
if tagThisFile == true then
(
nlerror("WARNING can't create tag file " + outputTagFile)
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
(
print "mukyu" to: tagFile
close tagFile
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting '%PreGenFileExtension%' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting '%PreGenFileExtension%' 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 '%PreGenFileExtension%' in folder %MaxSourceDirectory%")
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

View 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

View file

@ -6,7 +6,7 @@
#
# \file 1_export.py
# \brief Export anim
# \date 2010-09-19-14-19-GMT
# \date 2010-09-26-08-38-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export anim
@ -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 anim 3dsmax <<<")
mkPath(log, ExportBuildDirectory + "/" + AnimExportDirectory)
mkPath(log, ExportBuildDirectory + "/" + AnimTagExportDirectory)
for dir in AnimSourceDirectories:
mkPath(log, DatabaseDirectory + "/" + dir)
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + AnimExportDirectory, ".anim")):
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + AnimTagExportDirectory, ".max.tag")):
scriptSrc = "maxscript/anim_export.ms"
scriptDst = MaxUserDirectory + "/scripts/anim_export.ms"
outputLogfile = ScriptDirectory + "/processes/anim/log.log"
outputDirectory = ExportBuildDirectory + "/" + AnimExportDirectory
tagDirectory = ExportBuildDirectory + "/" + AnimTagExportDirectory
maxSourceDir = DatabaseDirectory + "/" + dir
tagList = findFiles(log, outputDirectory, "", ".anim")
maxRunningTagFile = tagDirectory + "/max_running.tag"
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
os.remove(scriptDst)
@ -77,23 +83,57 @@ 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", "anim_export.ms", "-q", "-mi", "-vn" ])
tagList = findFiles(log, outputDirectory, "", ".anim")
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) + " .anim 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, "")
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View 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
@ -68,7 +71,7 @@ NEL3D_APPDATA_EXPORT_NODE_ANIMATION = 1423062800
fn runNelMaxExport inputMaxFile =
(
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".anim")
tagThisFile = false
tagThisFile = true
-- Unhide category
unhidecategory()
@ -118,13 +121,12 @@ fn runNelMaxExport inputMaxFile =
else
(
nlerror("OK " + outputNelFile)
tagThisFile = true
)
)
else
(
-- Error
nlerror("ERROR exporting animation: no node animated to export in file " + inputMaxFile)
nlerror("WARNING exporting animation: no node animated to export in file " + inputMaxFile)
)
return tagThisFile
@ -132,75 +134,126 @@ 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) + ".anim")
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 'anim': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'anim': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting 'anim' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'anim' 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 'anim' in folder %MaxSourceDirectory%")
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

View file

@ -6,7 +6,7 @@
#
# \file 1_export.py
# \brief Export clodbank
# \date 2010-09-19-14-19-GMT
# \date 2010-09-26-08-38-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export clodbank
@ -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 *
@ -69,6 +71,7 @@ if MaxAvailable:
outputDirectory = ExportBuildDirectory + "/" + ClodExportDirectory
tagDirectory = ExportBuildDirectory + "/" + ClodTagExportDirectory
maxSourceDir = DatabaseDirectory + "/" + dir
maxRunningTagFile = tagDirectory + "/max_running.tag"
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
@ -84,20 +87,53 @@ if MaxAvailable:
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", "clod_export.ms", "-q", "-mi", "-vn" ])
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
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, "")
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View 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
@ -186,90 +189,126 @@ 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]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
try
-- For each files
for i = 1 to files.count do
(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
tagThisFile = runNelMaxExport(inputMaxFile)
-- Free memory and file handles
gc()
heapfree
-- Write a tag file
if tagThisFile == true then
-- Reset 3dsmax
resetMAXFile #noprompt
-- Open the max project
nlerror("Scanning file " + inputMaxFile + " ...")
if (loadMaxFile inputMaxFile quiet:true) == true then
(
tagFile = createFile outputTagFile
if tagFile == undefined then
tagThisFile = runNelMaxExport(inputMaxFile)
-- Write a tag file
if tagThisFile == true then
(
nlerror("WARNING can't create tag file " + outputTagFile)
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
(
print "mukyu" to: tagFile
close tagFile
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'clod': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'clod': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting 'clod' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'clod' 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 'clod' in folder %MaxSourceDirectory%")
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

View file

@ -29,7 +29,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 *
@ -53,6 +55,7 @@ def igExport(sourceDir, targetDir):
tagDirectory = ExportBuildDirectory + "/" + IgStaticTagExportDirectory
outputDirectory = ExportBuildDirectory + "/" + targetDir
maxSourceDir = DatabaseDirectory + "/" + sourceDir
maxRunningTagFile = tagDirectory + "/max_running.tag"
if (needUpdateDirByTagLog(log, maxSourceDir, ".max", tagDirectory, ".max.tag")):
tagList = findFiles(log, tagDirectory, "", ".tag")
tagLen = len(tagList)
@ -69,14 +72,44 @@ def igExport(sourceDir, targetDir):
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", "ig_export.ms", "-q", "-mi", "-vn" ])
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, "", ".tag")
newTagLen = len(tagList)
tagDiff = newTagLen - tagLen
tagLen = newTagLen
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)
return
@ -95,6 +128,7 @@ if MaxAvailable:
for dir in IgLandSourceDirectories:
mkPath(log, DatabaseDirectory + "/" + dir)
igExport(dir, IgStaticLandExportDirectory)
printLog(log, "")
# Export ig other 3dsmax
printLog(log, ">>> Export ig other 3dsmax <<<")
@ -102,11 +136,13 @@ if MaxAvailable:
for dir in IgOtherSourceDirectories:
mkPath(log, DatabaseDirectory + "/" + dir)
igExport(dir, IgStaticOtherExportDirectory)
printLog(log, "")
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View 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
@ -235,90 +238,126 @@ 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]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
try
-- For each files
for i = 1 to files.count do
(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
tagThisFile = runNelMaxExport(inputMaxFile)
-- Free memory and file handles
gc()
heapfree
-- Write a tag file
if tagThisFile == true then
-- Reset 3dsmax
resetMAXFile #noprompt
-- Open the max project
nlerror("Scanning file " + inputMaxFile + " ...")
if (loadMaxFile inputMaxFile quiet:true) == true then
(
tagFile = createFile outputTagFile
if tagFile == undefined then
tagThisFile = runNelMaxExport(inputMaxFile)
-- Write a tag file
if tagThisFile == true then
(
nlerror("WARNING can't create tag file " + outputTagFile)
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
(
print "mukyu" to: tagFile
close tagFile
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'ig': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'ig': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting 'ig' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'ig' 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 'ig' in folder %MaxSourceDirectory%")
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

View file

@ -6,7 +6,7 @@
#
# \file 1_export.py
# \brief Export rbank
# \date 2010-09-19-14-19-GMT
# \date 2010-09-26-08-38-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export rbank
@ -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 *
@ -69,6 +71,7 @@ if MaxAvailable:
outputDirectory = ExportBuildDirectory + "/" + RBankCmbExportDirectory
tagDirectory = ExportBuildDirectory + "/" + RBankCmbTagExportDirectory
maxSourceDir = DatabaseDirectory + "/" + dir
maxRunningTagFile = tagDirectory + "/max_running.tag"
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
@ -84,20 +87,53 @@ if MaxAvailable:
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", "cmb_export.ms", "-q", "-mi", "-vn" ])
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
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, "")
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View 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
@ -122,90 +125,126 @@ 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]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
try
-- For each files
for i = 1 to files.count do
(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
tagThisFile = runNelMaxExport(inputMaxFile)
-- Free memory and file handles
gc()
heapfree
-- Write a tag file
if tagThisFile == true then
-- Reset 3dsmax
resetMAXFile #noprompt
-- Open the max project
nlerror("Scanning file " + inputMaxFile + " ...")
if (loadMaxFile inputMaxFile quiet:true) == true then
(
tagFile = createFile outputTagFile
if tagFile == undefined then
tagThisFile = runNelMaxExport(inputMaxFile)
-- Write a tag file
if tagThisFile == true then
(
nlerror("WARNING can't create tag file " + outputTagFile)
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
(
print "mukyu" to: tagFile
close tagFile
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'cmb': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'cmb': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting 'cmb' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'cmb' 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 'cmb' in folder %MaxSourceDirectory%")
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

View file

@ -2,7 +2,7 @@
#
# \file 1_export.py
# \brief Export shape
# \date 2010-05-24 13:42GMT
# \date 2010-09-20-18-35-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export shape
@ -38,9 +38,6 @@ from process import *
from tools import *
from directories import *
def getTagFileName(filePath):
return os.path.split(filePath)[1] + ".tag"
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Export shape")
@ -56,22 +53,19 @@ if BuildQuality == 0:
ShapeExportOptLumelSize = "0.25"
ShapeExportOptOversampling = 1
# Find tools
# ...
# Export shape 3dsmax
if MaxAvailable:
# Find tools
Max = findMax(log, MaxDirectory, MaxExecutable)
ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
printLog(log, "")
# Export shape 3dsmax
printLog(log, ">>> Export shape 3dsmax <<<")
# Build paths
scriptSrc = "maxscript/shape_export.ms"
# scriptDst = MaxDirectory + "/scripts/shape_export.ms"
scriptDst = MaxUserDirectory + "/scripts/shape_export.ms"
logFile = ScriptDirectory + "/processes/shape/log.log"
outDirTag = ExportBuildDirectory + "/" + ShapeTagExportDirectory
mkPath(log, outDirTag)
tagDirectory = ExportBuildDirectory + "/" + ShapeTagExportDirectory
mkPath(log, tagDirectory)
outDirWithoutCoarse = ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory
mkPath(log, outDirWithoutCoarse)
outDirWithCoarse = ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory
@ -80,89 +74,83 @@ if MaxAvailable:
mkPath(log, outDirLightmap)
outDirAnim = ExportBuildDirectory + "/" + ShapeAnimExportDirectory
mkPath(log, outDirAnim)
tagList = findFiles(log, outDirTag, "", ".tag")
tagLen = len(tagList)
# For each directoy
if os.path.isfile(scriptDst):
os.remove(scriptDst)
for dir in ShapeSourceDirectories:
tagDiff = 1
secondTry = 1
shapeSourceDir = DatabaseDirectory + "/" + dir
mkPath(log, shapeSourceDir)
maxFiles = findFilesNoSubdir(log, shapeSourceDir, ".max")
for maxFile in maxFiles:
maxFilePath = shapeSourceDir + "/" + maxFile
tagFilePath = outDirTag + "/" + getTagFileName(maxFilePath)
if (needUpdate(log, maxFilePath, tagFilePath)):
sSrc = open(scriptSrc, "r")
sDst = open(scriptDst, "w")
for line in sSrc:
newline = line.replace("output_logfile", logFile)
# newline = newline.replace("shape_source_directory", shapeSourceDir)
newline = newline.replace("shape_max_file_path", maxFilePath)
newline = newline.replace("output_directory_tag", outDirTag)
newline = newline.replace("output_directory_without_coarse_mesh", outDirWithoutCoarse)
newline = newline.replace("output_directory_with_coarse_mesh", outDirWithCoarse)
newline = newline.replace("shape_export_opt_export_lighting", ShapeExportOptExportLighting)
newline = newline.replace("shape_export_opt_shadow", ShapeExportOptShadow)
newline = newline.replace("shape_export_opt_lighting_limit", str(ShapeExportOptLightingLimit))
newline = newline.replace("shape_export_opt_lumel_size", ShapeExportOptLumelSize)
newline = newline.replace("shape_export_opt_oversampling", str(ShapeExportOptOversampling))
newline = newline.replace("shape_export_opt_lightmap_log", ShapeExportOptLightmapLog)
newline = newline.replace("shape_lightmap_path", outDirLightmap)
newline = newline.replace("output_directory_anim", outDirAnim)
sDst.write(newline)
sSrc.close()
sDst.close()
retriesLeft = 5
while retriesLeft > 0:
printLog(log, "MAXSCRIPT " + scriptDst + "; " + maxFilePath)
subprocess.call([ ExecTimeout, str(MaxShapeExportTimeout), Max, "-U", "MAXScript", "shape_export.ms", "-q", "-mi", "-vn" ])
if os.path.exists(logFile):
try:
lSrc = open(logFile, "r")
for line in lSrc:
lineStrip = line.strip()
if (len(lineStrip) > 0):
printLog(log, lineStrip)
lSrc.close()
os.remove(logFile)
except Exception:
printLog(log, "ERROR Failed to read 3dsmax log")
else:
printLog(log, "WARNING No 3dsmax log")
if (not needUpdate(log, maxFilePath, tagFilePath)):
printLog(log, "OK " + maxFilePath)
retriesLeft = 0
else:
printLog(log, "FAIL " + maxFilePath)
retriesLeft = retriesLeft - 1
mkPath(log, DatabaseDirectory + "/" + dir)
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ShapeTagExportDirectory, ".max.tag")):
scriptSrc = "maxscript/shape_export.ms"
scriptDst = MaxUserDirectory + "/scripts/shape_export.ms"
outputLogfile = ScriptDirectory + "/processes/shape/log.log"
maxRunningTagFile = tagDirectory + "/max_running.tag"
maxSourceDir = DatabaseDirectory + "/" + dir
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
os.remove(scriptDst)
else:
printLog(log, "SKIP " + maxFilePath)
# Export clod 3dsmax
# this is historical garbage, just use the clodbank process.. :-)
#printLog(log, ">>> Export character lod shape files (.clod) from Max <<<")
#printLog(log, "********************************")
#printLog(log, "******** TODO ********")
#printLog(log, "********************************")
# cat ../clodbank/maxscript/clod_export.ms
#| sed -e "s&shape_source_directory&$database_directory/$i&g"
#| sed -e "s&output_directory_clod&$build_gamedata_directory/processes/shape/clod&g"
#| sed -e "s&output_directory_tag&$build_gamedata_directory/processes/shape/tag&g"
# > $max_directory/scripts/clod_export.ms
printLog(log, "")
tagDiff = 1
sSrc = open(scriptSrc, "r")
sDst = open(scriptDst, "w")
for line in sSrc:
newline = line.replace("%OutputLogfile%", outputLogfile)
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
newline = newline.replace("%TagDirectory%", tagDirectory)
newline = newline.replace("%OutputDirectoryWithoutCoarseMesh%", outDirWithoutCoarse)
newline = newline.replace("%OutputDirectoryWithCoarseMesh%", outDirWithCoarse)
newline = newline.replace("%OutputDirectoryLightmap%", outDirLightmap)
newline = newline.replace("%OutputDirectoryAnim%", outDirAnim)
newline = newline.replace("%ShapeExportOptExportLighting%", ShapeExportOptExportLighting)
newline = newline.replace("%ShapeExportOptShadow%", ShapeExportOptShadow)
newline = newline.replace("%ShapeExportOptLightingLimit%", str(ShapeExportOptLightingLimit))
newline = newline.replace("%ShapeExportOptLumelSize%", ShapeExportOptLumelSize)
newline = newline.replace("%ShapeExportOptOversampling%", str(ShapeExportOptOversampling))
newline = newline.replace("%ShapeExportOptLightmapLog%", ShapeExportOptLightmapLog)
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", "shape_export.ms", "-q", "-mi", "-vn" ])
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
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, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View file

@ -1,33 +1,17 @@
-- Some globals
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
-- "1" = is an accelerator type PORTAL
-- "2" = is an accelerator type CLUSTER
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
-- "17" = is an accelerator type PORTAL DYNAMIC
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
-- "0" = export me
-- "1" = DONT export me
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
NEL3D_APPDATA_LOD = 1423062537
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
NEL3D_APPDATA_COLLISION = 1423062613
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
NEL3D_APPDATA_AUTOMATIC_ANIMATION = 1423062617
-- #################################################################
-- ## WARNING : this is a generated file, don't change it !
-- #################################################################
-- Allocate 20 Me for the script
heapSize += 15000000
nlErrorFilename = "output_logfile"
-- 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
nlErrorStream = createFile nlErrorFilename
@ -80,6 +64,34 @@ fn nlerror message =
print message
)
-- Some globals
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
-- "1" = is an accelerator type PORTAL
-- "2" = is an accelerator type CLUSTER
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
-- "17" = is an accelerator type PORTAL DYNAMIC
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
-- "0" = export me
-- "1" = DONT export me
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
NEL3D_APPDATA_LOD = 1423062537
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
NEL3D_APPDATA_COLLISION = 1423062613
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
NEL3D_APPDATA_AUTOMATIC_ANIMATION = 1423062617
-- This node is n accelerator ?
fn isAccelerator node =
(
@ -241,275 +253,300 @@ fn haveCoarseMesh node =
return false
)
fn goShapeExport =
fn runNelMaxExport inputMaxFile =
(
try
tagThisFile = false
-- Unhide category
unhidecategory()
-- Unhide
max unhide all
-- unselect
max select none
-- Exported object count
exported = 0
-- Add the lod
for node in geometry do
(
-- Get filepath
filePath = "shape_max_file_path"
try
-- Get lod count
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
if (nodeCount != undefined) then
(
-- Delete lod files
lod_array = #()
-- Ok ?
ok = false
-- Free memory and file handles
gc ()
-- Reset 3dsmax
resetMAXFile #noprompt
-- Get the tag file name
tag = ("output_directory_tag/" + (getFilenameFile filePath) + (getFilenameType filePath) + ".tag")
-- Open the max project
nlerror ("Scanning file " + filePath + " ...")
if loadMaxFile filePath quiet:true == true then
-- For each lod
nodeCountNum = nodeCount as Integer
for lod = 1 to nodeCountNum do
(
-- Unhide category
unhidecategory()
-- Get the lod
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
-- Unhide
max unhide all
-- unselect
max select none
-- Exported object count
exported = 0
-- Add the lod
for node in geometry do
-- Exist ?
if (lod != undefined) then
(
-- Get lod count
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
if (nodeCount != undefined) then
-- Select a node
try
(
-- For each lod
nodeCountNum = nodeCount as Integer
for lod = 1 to nodeCountNum do
(
-- Get the lod
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
-- Exist ?
if (lod != undefined) then
(
-- Select a node
try
(
nd = execute ("$'"+lod+"'")
)
catch
(
nlerror ("Error in Execute $'"+lod+"' from node "+node.name)
nd = undefined
)
-- Node exist ?
if (nd != undefined) then
(
append lod_array nd
)
)
)
nd = execute("$'"+lod+"'")
)
catch
(
nlerror("Error in Execute $'"+lod+"' from node "+node.name)
nd = undefined
)
-- Node exist ?
if (nd != undefined) then
(
append lod_array nd
)
)
-- Select objects for shadows
for node in geometry do
)
)
)
-- Select objects for shadows
for node in geometry do
(
if (node.parent == undefined) then
(
-- Cast shadow ?
if (isCastShadow node == true) then
(
-- Select this node
selectmore node
)
)
)
-- Tag this file ?
tagThisFile = true
-- Array of node to export
array_node = #()
-- Add geometry
for node in geometry do
append array_node node
-- Add shapes
for node in shapes do
append array_node node
-- For each node
for node in array_node do
(
-- It is root ?
if (node.parent == undefined) then
(
-- Is not a skeleton ?
if (node.name != "Bip01") then
(
-- Can be exported ?
if (isToBeExported node == true) then
(
if (node.parent == undefined) then
-- Not a lod ?
if ((isLod node) == false) then
(
-- Cast shadow ?
if (isCastShadow node == true) then
(
-- Select this node
selectmore node
)
)
)
-- Tag this file ?
tagThisFile = true
-- Array of node to export
array_node = #()
-- Add geometry
for node in geometry do
append array_node node
-- Add shapes
for node in shapes do
append array_node node
-- For each node
for node in array_node do
(
-- It is root ?
if (node.parent == undefined) then
(
-- Is not a skeleton ?
if (node.name != "Bip01") then
(
-- Can be exported ?
if (isToBeExported node == true) then
(
-- Not a lod ?
if ((isLod node) == false) then
(
-- Output directory
if (haveCoarseMesh node) == true then
output = ("output_directory_with_coarse_mesh/"+(node.name)+".shape")
else
output = ("output_directory_without_coarse_mesh/"+(node.name)+".shape")
-- Compare file date
if (NeLTestFileDate output filePath) == true then
(
try
(
-- Export the shape
if (NelExportShapeEx node output shape_export_opt_shadow shape_export_opt_export_lighting "shape_lightmap_path" shape_export_opt_lighting_limit shape_export_opt_lumel_size shape_export_opt_oversampling true false shape_export_opt_lightmap_log) == true then
(
nlerror ("OK "+output)
exported = exported+1
)
else
(
-- Error
nlerror ("ERROR exporting shape "+node.name+" in file "+filePath)
tagThisFile = false
return 0
)
)
catch
(
-- Error
nlerror ("ERROR fatal error exporting shape "+node.name+" in file "+filePath)
tagThisFile = false
return 0
)
)
else
(
-- Error
nlerror ("SKIPPED "+output)
exported = exported+1
)
)
)
)
)
)
-- Export default animations
for node in objects do
(
-- Can export it ?
if (isAnimToBeExported node) == true then
(
-- Anim output directory
output = ("output_directory_anim/"+(node.name)+".anim")
-- Output directory
if (haveCoarseMesh node) == true then
output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape")
else
output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape")
-- Export the animation
if (NelExportAnimation #(node) output false) == false then
-- Compare file date
if (NeLTestFileDate output inputMaxFile) == true then
(
nlerror ("ERROR exporting animation "+output)
return 0
try
(
-- Export the shape
if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then
(
nlerror("OK "+output)
exported = exported +1
)
else
(
-- Error
nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile)
tagThisFile = false
)
)
catch
(
-- Error
nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile)
tagThisFile = false
)
)
else
(
nlerror ("OK "+output)
nlerror("SKIPPED " + output)
exported = exported + 1
)
)
)
-- Write a tag file
if tagThisFile == true then
(
tagFile = createFile tag
if tagFile == undefined then
(
nlerror ("WARNING can't create tag file "+tag)
)
else
(
print "toto" to: tagFile
close tagFile
)
)
-- Something exported
if exported == 0 then
(
-- Error
nlerror ("WARNING no shape exported from the file "+filePath)
)
)
)
)
-- Export default animations
for node in objects do
(
-- Can export it ?
if (isAnimToBeExported node) == true then
(
-- Anim output directory
output = ("%OutputDirectoryAnim%/" + (node.name) + ".anim")
-- Export the animation
if (NelExportAnimation #(node) output false) == false then
(
nlerror ("ERROR exporting animation " + output)
tagThisFile = false
)
else
(
-- Error
nlerror ("ERROR exporting shape: can't open the file "+filePath)
nlerror("OK " + output)
)
try
(
gc ()
)
catch
(
nlerror ("ERROR gc " + getCurrentException())
)
try
(
-- Reset 3dsmax
resetMAXFile #noprompt
)
catch
(
nlerror ("ERROR resetMAXFile " + getCurrentException())
)
try
(
gc ()
)
catch
(
nlerror ("ERROR gc " + getCurrentException())
)
)
catch
(
-- Error
nlerror ("ERROR fatal error exporting shape in file " + filePath)
return 0
)
)
catch
-- Something exported
if exported == 0 then
(
-- Error
nlerror ("ERROR fatal error exporting shape in file")
return 0
nlerror("WARNING no shape exported from the file " + inputMaxFile)
)
return tagThisFile
)
removeRunningTag = true
try
(
undo off
(
-- Get files in the %MaxSourceDirectory% directory
files = getFiles "%MaxSourceDirectory%/*.max"
gc()
-- Sort files
sort files
gc()
-- No file ?
if files.count != 0 then
(
-- For each files
for i = 1 to files.count do
(
inputMaxFile = files[i]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
--try
--(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
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 'shape': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'shape' in file " + inputMaxFile)
-- removeRunningTag = false
--)
)
)
else
(
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
)
)
)
undo off
catch
(
goShapeExport()
-- Error
nlerror("ERROR fatal error exporting 'shape' in folder %MaxSourceDirectory%")
removeRunningTag = false
)
nlerror ("BYE")
try
(
if (removeRunningTag) then
(
resetMAXFile #noPrompt
)
)
catch
(
nlerror("FAIL Last reset fails")
removeRunningTag = false
)
quitMAX #noPrompt
quitMAX () #noPrompt
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
nlerror("BYE")
quitMAX #noPrompt
quitMAX () #noPrompt
quitMAX() #noPrompt

View file

@ -6,7 +6,7 @@
#
# \file 1_export.py
# \brief Export veget
# \date 2010-09-19-14-19-GMT
# \date 2010-09-26-08-38-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export veget
@ -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 *
@ -69,6 +71,7 @@ if MaxAvailable:
outputDirectory = ExportBuildDirectory + "/" + VegetExportDirectory
tagDirectory = ExportBuildDirectory + "/" + VegetTagExportDirectory
maxSourceDir = DatabaseDirectory + "/" + dir
maxRunningTagFile = tagDirectory + "/max_running.tag"
tagList = findFiles(log, tagDirectory, "", ".max.tag")
tagLen = len(tagList)
if os.path.isfile(scriptDst):
@ -84,20 +87,53 @@ if MaxAvailable:
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", "veget_export.ms", "-q", "-mi", "-vn" ])
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
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, "")
printLog(log, "")
log.close()
if os.path.isfile("log.log"):
os.remove("log.log")
shutil.move("temp_log.log", "log.log")
# end of file

View 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
@ -176,90 +179,126 @@ 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]
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
try
-- For each files
for i = 1 to files.count do
(
-- Compare file date
if (NeLTestFileDate outputTagFile 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
(
tagThisFile = runNelMaxExport(inputMaxFile)
-- Free memory and file handles
gc()
heapfree
-- Write a tag file
if tagThisFile == true then
-- Reset 3dsmax
resetMAXFile #noprompt
-- Open the max project
nlerror("Scanning file " + inputMaxFile + " ...")
if (loadMaxFile inputMaxFile quiet:true) == true then
(
tagFile = createFile outputTagFile
if tagFile == undefined then
tagThisFile = runNelMaxExport(inputMaxFile)
-- Write a tag file
if tagThisFile == true then
(
nlerror("WARNING can't create tag file " + outputTagFile)
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
(
print "mukyu" to: tagFile
close tagFile
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'veget': can't open the file " + inputMaxFile)
removeRunningTag = false
)
)
else
(
-- Error
nlerror("ERROR exporting 'veget': can't open the file " + inputMaxFile)
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
else
(
nlerror("SKIPPED BY TAG " + inputMaxFile)
)
)
catch
(
-- Error
nlerror("ERROR error exporting 'veget' in files " + inputMaxFile)
--)
--catch
--(
-- -- Error
-- nlerror("ERROR error exporting 'veget' 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 'veget' in folder %MaxSourceDirectory%")
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

View file

@ -143,6 +143,7 @@ ShapeAnimExportDirectory = CommonPath + "/shape_anim"
# Animation directories
AnimExportDirectory = CommonPath + "/anim_export"
AnimTagExportDirectory = CommonPath + "/anim_tag"
# cLoD directories
ClodExportDirectory = CommonPath + "/clod_export"

View file

@ -253,6 +253,7 @@ ShapeAnimExportDirectory = CommonPath + "/shape_anim"
# Animation directories
AnimExportDirectory = CommonPath + "/anim_export"
AnimTagExportDirectory = CommonPath + "/anim_tag"
# cLoD directories
ClodExportDirectory = CommonPath + "/clod_export"

View file

@ -128,6 +128,7 @@ ZoneLightIgLandBuildDirectory = CommonPath + "/zone_lighted_ig_land" #fixme
# Animation directories
AnimExportDirectory = CommonPath + "/anim_export"
AnimTagExportDirectory = CommonPath + "/anim_tag"
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***