Added: #929 Ig build process.
parent
0ace3e9251
commit
248a8464ec
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 0_setup.py
|
||||
# \brief setup dummy
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Setup dummy
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Setup dummy")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
# Setup source directories
|
||||
printLog(log, ">>> Setup source directories <<<")
|
||||
#for dir in MapSourceDirectories:
|
||||
# mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
|
||||
# Setup export directories
|
||||
printLog(log, ">>> Setup export directories <<<")
|
||||
#mkPath(log, ExportBuildDirectory + "/" + DummyTagExportDirectory)
|
||||
|
||||
# Setup build directories
|
||||
printLog(log, ">>> Setup build directories <<<")
|
||||
#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory)
|
||||
|
||||
# Setup client directories
|
||||
printLog(log, ">>> Setup client directories <<<")
|
||||
#mkPath(log, ClientDataDirectory + "/" + DummyClientDirectory)
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,117 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 1_export.py
|
||||
# \brief Export dummy
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Export dummy
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Export dummy")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
if MaxAvailable:
|
||||
# Find tools
|
||||
Max = findMax(log, MaxDirectory, MaxExecutable)
|
||||
# ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
|
||||
printLog(log, "")
|
||||
|
||||
# Export dummy 3dsmax
|
||||
printLog(log, ">>> Export dummy 3dsmax <<<")
|
||||
|
||||
# Build paths
|
||||
#scriptSrc = "maxscript/dummy_export.ms"
|
||||
# scriptDst = MaxDirectory + "/scripts/dummy_export.ms"
|
||||
#scriptDst = MaxUserDirectory + "/scripts/dummy_export.ms"
|
||||
#logFile = ScriptDirectory + "/processes/dummy/log.log"
|
||||
#outDirTag = ExportBuildDirectory + "/" + DummyTagExportDirectory
|
||||
#mkPath(log, outDirTag)
|
||||
#outDirWithoutCoarse = ExportBuildDirectory + "/" + DummyExportDirectory
|
||||
#mkPath(log, outDirWithoutCoarse)
|
||||
#outDirWithCoarse = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory
|
||||
#mkPath(log, outDirWithCoarse)
|
||||
#outDirLightmap = ExportBuildDirectory + "/" + DummyLightmapNotOptimizedExportDirectory
|
||||
#mkPath(log, outDirLightmap)
|
||||
#outDirAnim = ExportBuildDirectory + "/" + DummyAnimExportDirectory
|
||||
#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 DummySourceDirectories:
|
||||
# tagDiff = 1
|
||||
# dummySourceDir = DatabaseDirectory + "/" + dir
|
||||
# mkPath(log, dummySourceDir)
|
||||
# sSrc = open(scriptSrc, "r")
|
||||
# sDst = open(scriptDst, "w")
|
||||
# for line in sSrc:
|
||||
# newline = line.replace("output_logfile", logFile)
|
||||
# newline = newline.replace("dummy_source_directory", dummySourceDir)
|
||||
# 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("dummy_export_opt_export_lighting", DummyExportOptExportLighting)
|
||||
# newline = newline.replace("dummy_export_opt_shadow", DummyExportOptShadow)
|
||||
# newline = newline.replace("dummy_export_opt_lighting_limit", str(DummyExportOptLightingLimit))
|
||||
# newline = newline.replace("dummy_export_opt_lumel_size", DummyExportOptLumelSize)
|
||||
# newline = newline.replace("dummy_export_opt_oversampling", str(DummyExportOptOversampling))
|
||||
# newline = newline.replace("dummy_export_opt_lightmap_log", DummyExportOptLightmapLog)
|
||||
# newline = newline.replace("dummy_lightmap_path", outDirLightmap)
|
||||
# newline = newline.replace("output_directory_anim", outDirAnim)
|
||||
# sDst.write(newline)
|
||||
# sSrc.close()
|
||||
# sDst.close()
|
||||
# while tagDiff > 0:
|
||||
# printLog(log, "MAXSCRIPT " + scriptDst)
|
||||
# subprocess.call([ Max, "-U", "MAXScript", "dummy_export.ms", "-q", "-mi", "-vn" ])
|
||||
# tagList = findFiles(log, outDirTag, "", ".tag")
|
||||
# newTagLen = len(tagList)
|
||||
# tagDiff = newTagLen - tagLen
|
||||
# tagLen = newTagLen
|
||||
# printLog(log, "Exported " + str(tagDiff) + " .max files!")
|
||||
# tagDiff += hackBdummyTree() # force rerun also when bdummy tree deleted
|
||||
# os.remove(scriptDst)
|
||||
|
||||
|
||||
printLog(log, "")
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 2_build.py
|
||||
# \brief Build dummy
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Build dummy
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Build dummy")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
# Find tools
|
||||
ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
|
||||
BuildShadowSkin = findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix)
|
||||
BuildClodtex = findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix)
|
||||
LightmapOptimizer = findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix)
|
||||
TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix)
|
||||
BuildCoarseMesh = findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix)
|
||||
|
||||
#if 1: # todo: CoarseMeshTextureNames length > 0 ...
|
||||
# printLog(log, ">>> Build coarse meshes <<<")
|
||||
# dummyWithCoarseMesh = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory
|
||||
# mkPath(log, dummyWithCoarseMesh)
|
||||
# dummyWithCoarseMeshBuilded = ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory
|
||||
# mkPath(log, dummyWithCoarseMeshBuilded)
|
||||
# cf = open("confdummy_generated.cfg", "w")
|
||||
# cf.write("texture_mul_size = " + TextureMulSizeValue + ";\n")
|
||||
# cf.write("\n")
|
||||
# cf.write("search_path = \n")
|
||||
# cf.write("{\n")
|
||||
# cf.write("\t\"" + dummyWithCoarseMesh + "\", \n")
|
||||
# for dir in MapSourceDirectories:
|
||||
# cf.write("\t\"" + DatabaseDirectory + "/" + dir + "\", \n")
|
||||
# cf.write("};\n")
|
||||
# cf.write("\n")
|
||||
# cf.write("list_mesh = \n")
|
||||
# cf.write("{\n")
|
||||
# # For each dummy with coarse mesh
|
||||
# files = findFiles(log, dummyWithCoarseMesh, "", ".dummy")
|
||||
# for file in files:
|
||||
# sourceFile = dummyWithCoarseMesh + "/" + file
|
||||
# if os.path.isfile(sourceFile):
|
||||
# destFile = dummyWithCoarseMeshBuilded + "/" + file
|
||||
# cf.write("\t\"" + file + "\", \"" + destFile + "\", \n")
|
||||
# cf.write("};\n")
|
||||
# cf.write("\n")
|
||||
# cf.write("output_textures = \n")
|
||||
# cf.write("{\n")
|
||||
# # For each dummy with coarse mesh
|
||||
# for tn in CoarseMeshTextureNames:
|
||||
# cf.write("\t\"" + dummyWithCoarseMesh + "/" + tn + ".tga\", \n")
|
||||
# cf.write("};\n")
|
||||
# cf.close()
|
||||
# subprocess.call([ BuildCoarseMesh, "confdummy_generated.cfg" ])
|
||||
# os.remove("confdummy_generated.cfg")
|
||||
# for tn in CoarseMeshTextureNames:
|
||||
# subprocess.call([ TgaToDds, dummyWithCoarseMesh + "/" + tn + ".tga", "-o", dummyWithCoarseMeshBuilded + "/" + tn + ".dds", "-a", "5" ])
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 3_install.py
|
||||
# \brief Install dummy
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Install dummy
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Install dummy")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
#clientPath = ClientDataDirectory + "/" + DummyClientDirectory
|
||||
#mkPath(log, clientPath)
|
||||
|
||||
printLog(log, ">>> Install dummy <<<")
|
||||
#mkPath(log, ExportBuildDirectory + "/" + DummyExportDirectory)
|
||||
#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyExportDirectory, clientPath, ".dummy")
|
||||
#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory)
|
||||
#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, clientPath, ".dummy")
|
||||
#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, clientPath, ".dds")
|
||||
|
||||
#mkPath(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory)
|
||||
#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory, clientPath, ".anim")
|
||||
|
||||
printLog(log, "")
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 0_setup.py
|
||||
# \brief setup ig
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Setup ig
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Setup ig")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
# Setup source directories
|
||||
printLog(log, ">>> Setup source directories <<<")
|
||||
for dir in IgLandSourceDirectories:
|
||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
for dir in IgOtherSourceDirectories:
|
||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory)
|
||||
|
||||
# Setup export directories
|
||||
printLog(log, ">>> Setup export directories <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory)
|
||||
|
||||
# Setup build directories
|
||||
printLog(log, ">>> Setup build directories <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + LigoIgLandBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory)
|
||||
|
||||
# Setup client directories
|
||||
printLog(log, ">>> Setup client directories <<<")
|
||||
#mkPath(log, ClientDataDirectory + "/" + IgClientDirectory)
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,111 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 1_export.py
|
||||
# \brief Export ig
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Export ig
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Export ig")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
Max = "" #find later
|
||||
|
||||
|
||||
def igExport(sourceDir, targetDir):
|
||||
scriptSrc = "maxscript/ig_export.ms"
|
||||
scriptDst = MaxUserDirectory + "/scripts/ig_export.ms"
|
||||
logFile = ScriptDirectory + "/processes/ig/log.log"
|
||||
outDirTag = ExportBuildDirectory + "/" + IgStaticTagExportDirectory
|
||||
outDirIg = ExportBuildDirectory + "/" + targetDir
|
||||
igSourceDir = DatabaseDirectory + "/" + sourceDir
|
||||
tagList = findFiles(log, outDirTag, "", ".tag")
|
||||
tagLen = len(tagList)
|
||||
if os.path.isfile(scriptDst):
|
||||
os.remove(scriptDst)
|
||||
tagDiff = 1
|
||||
sSrc = open(scriptSrc, "r")
|
||||
sDst = open(scriptDst, "w")
|
||||
for line in sSrc:
|
||||
newline = line.replace("output_logfile", logFile)
|
||||
newline = newline.replace("ig_source_directory", igSourceDir)
|
||||
newline = newline.replace("output_directory_tag", outDirTag)
|
||||
newline = newline.replace("output_directory_ig", outDirIg)
|
||||
sDst.write(newline)
|
||||
sSrc.close()
|
||||
sDst.close()
|
||||
while tagDiff > 0:
|
||||
printLog(log, "MAXSCRIPT " + scriptDst)
|
||||
subprocess.call([ Max, "-U", "MAXScript", "ig_export.ms", "-q", "-mi", "-vn" ])
|
||||
tagList = findFiles(log, outDirTag, "", ".tag")
|
||||
newTagLen = len(tagList)
|
||||
tagDiff = newTagLen - tagLen
|
||||
tagLen = newTagLen
|
||||
printLog(log, "Exported " + str(tagDiff) + " .max files!")
|
||||
os.remove(scriptDst)
|
||||
return
|
||||
|
||||
|
||||
if MaxAvailable:
|
||||
# Find tools
|
||||
Max = findMax(log, MaxDirectory, MaxExecutable)
|
||||
# ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
|
||||
printLog(log, "")
|
||||
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory)
|
||||
|
||||
# Export ig land 3dsmax
|
||||
printLog(log, ">>> Export ig land 3dsmax <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory)
|
||||
for dir in IgLandSourceDirectories:
|
||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
igExport(dir, IgStaticLandExportDirectory)
|
||||
|
||||
# Export ig other 3dsmax
|
||||
printLog(log, ">>> Export ig other 3dsmax <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory)
|
||||
for dir in IgOtherSourceDirectories:
|
||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
igExport(dir, IgStaticOtherExportDirectory)
|
||||
|
||||
|
||||
printLog(log, "")
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,244 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 2_build.py
|
||||
# \brief Build ig
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Build ig
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Build ig")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
# Find tools
|
||||
ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
|
||||
PrimExport = findTool(log, ToolDirectories, PrimExportTool , ToolSuffix)
|
||||
IgElevation = findTool(log, ToolDirectories, IgElevationTool, ToolSuffix)
|
||||
IgAdd = findTool(log, ToolDirectories, IgAddTool, ToolSuffix)
|
||||
|
||||
configDir = ActiveProjectDirectory + "/generated"
|
||||
mkPath(log, configDir)
|
||||
|
||||
def igElevation(inputIgDir, outputIgDir):
|
||||
printLog(log, ">>> IG Elevation <<<")
|
||||
|
||||
mkPath(log, inputIgDir)
|
||||
mkPath(log, outputIgDir)
|
||||
mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory)
|
||||
|
||||
configFile = configDir + "/ig_elevation.cfg"
|
||||
if os.path.isfile(configFile):
|
||||
os.remove(configFile)
|
||||
|
||||
printLog(log, "CONFIG " + configFile)
|
||||
cf = open(configFile, "w")
|
||||
cf.write("// ig_elevation.cfg\n")
|
||||
cf.write("\n")
|
||||
cf.write("InputIGDir = \"" + inputIgDir + "\";\n")
|
||||
cf.write("OutputIGDir = \"" + outputIgDir + "\";\n")
|
||||
cf.write("\n")
|
||||
cf.write("CellSize = 160.0;")
|
||||
cf.write("\n")
|
||||
cf.write("HeightMapFile1 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap1 + "\";\n")
|
||||
cf.write("ZFactor1 = " + LigoExportZFactor1 + ";\n")
|
||||
cf.write("HeightMapFile2 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap2 + "\";\n")
|
||||
cf.write("ZFactor2 = " + LigoExportZFactor2 + ";\n")
|
||||
cf.write("\n")
|
||||
cf.write("LandFile = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportLand + "\";\n")
|
||||
cf.write("\n")
|
||||
cf.close()
|
||||
subprocess.call([ IgElevation, configFile ])
|
||||
os.remove(configFile)
|
||||
|
||||
# Build process
|
||||
if (ContinentLeveldesignWorldDirectory != "") or (len(IgOtherSourceDirectories) > 0):
|
||||
printLog(log, ">>> Prim IG: ON <<<")
|
||||
configFile = configDir + "/prim_export.cfg"
|
||||
if os.path.isfile(configFile):
|
||||
os.remove(configFile)
|
||||
|
||||
outIgDir = ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory
|
||||
mkPath(log, outIgDir)
|
||||
zoneWDir = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory
|
||||
mkPath(log, zoneWDir)
|
||||
smallBank = DatabaseDirectory + "/" + TileRootSourceDirectory + "/" + BankTileBankName + ".bank"
|
||||
farBank = ExportBuildDirectory + "/" + FarbankBuildDirectory + "/" + BankTileBankName + MultipleTilesPostfix[0] + ".farbank"
|
||||
displaceDir = DatabaseDirectory + "/" + DisplaceSourceDirectory
|
||||
continentDir = LeveldesignWorldDirectory + "/" + ContinentLeveldesignWorldDirectory
|
||||
mkPath(log, continentDir)
|
||||
formDir = LeveldesignDirectory
|
||||
mkPath(log, LeveldesignDirectory)
|
||||
|
||||
printLog(log, "CONFIG " + configFile)
|
||||
cf = open(configFile, "w")
|
||||
cf.write("// prim_export.cfg\n")
|
||||
cf.write("\n")
|
||||
cf.write("OutIGDir = \"" + outIgDir + "\";\n")
|
||||
cf.write("ZoneWDir = \"" + zoneWDir + "\";\n")
|
||||
cf.write("\n")
|
||||
cf.write("SmallBank = \"" + smallBank + "\";\n")
|
||||
cf.write("FarBank = \"" + farBank + "\";\n")
|
||||
cf.write("DisplaceDir = \"" + displaceDir + "\";\n")
|
||||
cf.write("\n")
|
||||
cf.write("CellSize = 160.0;")
|
||||
cf.write("\n")
|
||||
cf.write("PrimDirs = {\n")
|
||||
cf.write("\t\"" + continentDir + "\", \n")
|
||||
for dir in IgPrimitiveSourceDirectories:
|
||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||
cf.write("\t\"" + DatabaseDirectory + "/" + dir + "\", \n")
|
||||
cf.write("};\n")
|
||||
cf.write("\n")
|
||||
cf.write("FormDir = \"" + formDir + "\";\n")
|
||||
cf.write("\n")
|
||||
cf.close()
|
||||
subprocess.call([ PrimExport, configFile ])
|
||||
os.remove(configFile)
|
||||
|
||||
igElevation(ExportBuildDirectory + "/" + LigoIgLandBuildDirectory, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory)
|
||||
|
||||
igElevation(ExportBuildDirectory + "/" + IgStaticLandExportDirectory, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory)
|
||||
|
||||
|
||||
printLog(log, ">>> Merge land IGs <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory)
|
||||
removeFilesRecursive(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory)
|
||||
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory)
|
||||
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory)
|
||||
igFilesPrim = findFiles(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory, "", ".ig")
|
||||
igFilesLigo = findFiles(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory, "", ".ig")
|
||||
igFilesStatic = findFiles(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory, "", ".ig")
|
||||
igFilesAll = [ ]
|
||||
for igFile in igFilesPrim:
|
||||
if not igFile in igFilesAll:
|
||||
igFilesAll += [ igFile ]
|
||||
for igFile in igFilesLigo:
|
||||
if not igFile in igFilesAll:
|
||||
igFilesAll += [ igFile ]
|
||||
for igFile in igFilesStatic:
|
||||
if not igFile in igFilesAll:
|
||||
igFilesAll += [ igFile ]
|
||||
igFilesAll.sort()
|
||||
for igFile in igFilesAll:
|
||||
primIgFile = ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory + "/" + igFile
|
||||
ligoIgFile = ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory + "/" + igFile
|
||||
staticIgFile = ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory + "/" + igFile
|
||||
tempIgFile = ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory + "/" + igFile
|
||||
outIgFile = ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile
|
||||
activeFile = ""
|
||||
needsUpdate = 0
|
||||
sourceTools = ""
|
||||
if igFile in igFilesPrim:
|
||||
if needUpdate(log, primIgFile, outIgFile):
|
||||
needsUpdate = 1
|
||||
if not needsUpdate == 1 and igFile in igFilesLigo:
|
||||
if needUpdate(log, ligoIgFile, outIgFile):
|
||||
needsUpdate = 1
|
||||
if not needsUpdate == 1 and igFile in igFilesStatic:
|
||||
if needUpdate(log, staticIgFile, outIgFile):
|
||||
needsUpdate = 1
|
||||
if needsUpdate == 1:
|
||||
if os.path.isfile(outIgFile):
|
||||
os.remove(outIgFile)
|
||||
if igFile in igFilesPrim:
|
||||
sourceTools += " [Prim]"
|
||||
activeFile = primIgFile
|
||||
if igFile in igFilesLigo:
|
||||
if activeFile == "":
|
||||
activeFile = ligoIgFile
|
||||
else:
|
||||
sourceTools += " [Ligo]"
|
||||
subprocess.call([ IgAdd, tempIgFile, ligoIgFile, activeFile ])
|
||||
activeFile = tempIgFile
|
||||
if igFile in igFilesStatic:
|
||||
if activeFile == "":
|
||||
activeFile = staticIgFile
|
||||
else:
|
||||
sourceTools += " [Static]"
|
||||
subprocess.call([ IgAdd, outIgFile, staticIgFile, activeFile ])
|
||||
activeFile = outIgFile
|
||||
else:
|
||||
shutil.copy(activeFile, outIgFile)
|
||||
printLog(log, "MERGE " + igFile + sourceTools)
|
||||
else:
|
||||
printLog(log, "SKIP " + igFile)
|
||||
|
||||
# Remove temporary land IGs
|
||||
printLog(log, ">>> Remove temporary land IGs <<<")
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory)
|
||||
removeFilesRecursive(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory)
|
||||
|
||||
# Remove outdated land IGs
|
||||
printLog(log, ">>> Remove outdated land IGs <<<")
|
||||
igFilesOut = findFiles(log, ExportBuildDirectory + "/" + IgLandBuildDirectory, "", ".ig")
|
||||
for igFile in igFilesOut:
|
||||
if not igFile in igFilesAll:
|
||||
printLog(log, "RM " + ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile)
|
||||
os.remove(ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile)
|
||||
|
||||
# Verify land IGs
|
||||
printLog(log, ">>> Verify land IGs <<<")
|
||||
for igFile in igFilesAll:
|
||||
if not igFile in igFilesOut:
|
||||
printLog(log, "MISSING " + igFile)
|
||||
|
||||
# Write land IGs TXT
|
||||
printLog(log, ">>> Write land IGs TXT <<<")
|
||||
igTxtFile = ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + LandscapeName + "_ig.txt"
|
||||
printLog(log, "WRITE " + ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + LandscapeName + "_ig.txt")
|
||||
if os.path.isfile(igTxtFile):
|
||||
os.remove(igTxtFile)
|
||||
igTxt = open(igTxtFile, "w")
|
||||
for igFile in igFilesAll:
|
||||
igTxt.write(igFile + "\n")
|
||||
igTxt.close()
|
||||
|
||||
# Merge other IGs
|
||||
printLog(log, ">>> Merge other IGs <<<") # (not true merge, since not necesserary)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory)
|
||||
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory, ".ig")
|
||||
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory, ".ig")
|
||||
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# \file 3_install.py
|
||||
# \brief Install ig
|
||||
# \date 2010-05-24 13:42GMT
|
||||
# \author Jan Boon (Kaetemi)
|
||||
# Python port of game data build pipeline.
|
||||
# Install ig
|
||||
#
|
||||
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
# Copyright (C) 2010 Winch Gate Property Limited
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
||||
sys.path.append("../../configuration")
|
||||
|
||||
if os.path.isfile("log.log"):
|
||||
os.remove("log.log")
|
||||
log = open("log.log", "w")
|
||||
from scripts import *
|
||||
from buildsite import *
|
||||
from process import *
|
||||
from tools import *
|
||||
from directories import *
|
||||
|
||||
printLog(log, "")
|
||||
printLog(log, "-------")
|
||||
printLog(log, "--- Install ig")
|
||||
printLog(log, "-------")
|
||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||
printLog(log, "")
|
||||
|
||||
clientPathIg = ClientDataDirectory + "/" + IgClientDirectory
|
||||
mkPath(log, clientPathIg)
|
||||
|
||||
printLog(log, ">>> Install ig <<<")
|
||||
landBuildDir = ExportBuildDirectory + "/" + IgLandBuildDirectory
|
||||
mkPath(log, landBuildDir)
|
||||
copyFilesExtNoTreeIfNeeded(log, landBuildDir, clientPathIg, "_ig.txt") # Copy the *_ig.txt file
|
||||
# Do not copy *.ig in ig_land, because zone process will copy zone ig lighted versions into client directory.
|
||||
# Do not copy *.ig ig_other, because ig_light process will copy ig lighted versions into client directory.
|
||||
|
||||
printLog(log, "")
|
||||
log.close()
|
||||
|
||||
|
||||
# end of file
|
@ -0,0 +1,304 @@
|
||||
-- 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_IGNAME = 1423062564 -- string : name of the Instance Group
|
||||
|
||||
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
|
||||
|
||||
NEL_OBJECT_NAME_DATA = 1970
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "output_logfile"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
-- 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
|
||||
)
|
||||
|
||||
-- Get the ig name of this object
|
||||
fn getIg node =
|
||||
(
|
||||
return (getappdata node NEL3D_APPDATA_IGNAME)
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
-- Get files in the ig_source_directory
|
||||
files = getFiles "ig_source_directory/*.max"
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc ()
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Get the tag file name
|
||||
tag = ("output_directory_tag/"+(getFilenameFile files[i])+(getFilenameType files[i])+".tag")
|
||||
|
||||
-- Compare date with the tag file
|
||||
if (NeLTestFileDate tag files[i]) == true then
|
||||
(
|
||||
-- Open the max project
|
||||
nlerror ("Scanning file "+files[i]+" ...")
|
||||
if (mergeMaxFile files[i] quiet:true) == true then
|
||||
(
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- Ig array
|
||||
ig_array = #()
|
||||
|
||||
-- Scan all the ig in this project
|
||||
for node in objects do
|
||||
(
|
||||
ig = getIg node
|
||||
if ( (ig != undefined) and (ig != "") ) then
|
||||
(
|
||||
-- Found ?
|
||||
found = false
|
||||
|
||||
-- Already found ?
|
||||
for j = 1 to ig_array.count do
|
||||
(
|
||||
if (ig_array[j]==ig) then
|
||||
(
|
||||
found = true
|
||||
exit
|
||||
)
|
||||
)
|
||||
|
||||
-- Found ?
|
||||
if (found == false) then
|
||||
(
|
||||
append ig_array ig
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Have some ig ?
|
||||
if (ig_array.count != 0) then
|
||||
(
|
||||
-- For each ig
|
||||
for ig = 1 to ig_array.count do
|
||||
(
|
||||
-- Output filename
|
||||
output = ("output_directory_ig/"+ig_array[ig]+".ig")
|
||||
|
||||
-- Check date
|
||||
if (NeLTestFileDate output files[i]) == true then
|
||||
(
|
||||
-- Select none
|
||||
max select none
|
||||
|
||||
-- Select all node in this ig
|
||||
for node in geometry do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ( (getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in lights do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ( (getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in helpers do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ( (getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
|
||||
-- Check export
|
||||
try
|
||||
(
|
||||
-- Export the ig
|
||||
instancegroup2export = $selection as array
|
||||
if (NelExportInstanceGroup instancegroup2export output) == true then
|
||||
(
|
||||
nlerror ("OK "+output)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror ("ERROR exporting ig "+ig_array[ig]+" in file "+files[i])
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror ("ERROR fatal error exporting ig "+ig_array[ig]+" in file "+files[i])
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror ("SKIPPED "+output)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror ("WARNING nothing exported from ig max file "+files[i])
|
||||
)
|
||||
|
||||
-- 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
|
||||
)
|
||||
)
|
||||
|
||||
resetMAXFile #noprompt
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror ("ERROR exporting ig: can't open the file "+files[i])
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror ("SKIPPED BY TAG "+files[i])
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror ("ERROR error exporting ig in files " + files[i])
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror ("WARNING no max file in folder ig_source_directory")
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror ("ERROR fatal error exporting ig in folder ig_source_directory")
|
||||
)
|
||||
|
||||
-- Bye
|
||||
|
||||
resetMAXFile #noprompt
|
||||
quitMAX #noPrompt
|
||||
quitMAX () #noPrompt
|
||||
|
Loading…
Reference in New Issue