Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / build_gamedata / processes / cartographer / 2_build.py
blobfdc78dd43892e18a12adb075f51a498530e2d398
1 #!/usr/bin/python
2 #
3 # \file 2_build.py
4 # \brief Build cartographer
5 # \date 2014-09-13 13:32GMT
6 # \author Jan Boon (Kaetemi)
7 # Python port of game data build pipeline.
8 # Build cartographer
9 #
10 # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
11 # Copyright (C) 2014 Jan BOON
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Affero General Public License as
15 # published by the Free Software Foundation, either version 3 of the
16 # License, or (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Affero General Public License for more details.
23 # You should have received a copy of the GNU Affero General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 import time, sys, os, shutil, subprocess, distutils.dir_util
28 sys.path.append("../../configuration")
30 if os.path.isfile("log.log"):
31 os.remove("log.log")
32 log = open("log.log", "w")
33 from scripts import *
34 from buildsite import *
35 from process import *
36 from tools import *
37 from directories import *
39 printLog(log, "")
40 printLog(log, "-------")
41 printLog(log, "--- Build cartographer")
42 printLog(log, "-------")
43 printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
44 printLog(log, "")
46 # Find tools
47 R2IslandsTextures = findTool(log, ToolDirectories, R2IslandsTexturesTool, ToolSuffix)
48 TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix)
50 if R2IslandsTextures == "":
51 toolLogFail(log, R2IslandsTexturesTool, ToolSuffix)
52 else:
53 printLog(log, ">>> Copy island_screenshots.cfg <<<")
54 cfgPath = ActiveProjectDirectory + "/generated/island_screenshots.cfg"
55 shutil.copy(cfgPath, "island_screenshots.cfg")
56 printLog(log, ">>> Build cartographer <<<")
57 mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory)
58 subprocess.call([ R2IslandsTextures ])
59 printLog(log, "")
61 printLog(log, ">>> Compress cartographer maps to DDS <<<")
62 if TgaToDds == "":
63 toolLogFail(log, TgaToDdsTool, ToolSuffix)
64 else:
65 destPath = ExportBuildDirectory + "/" + CartographerMapBuildDirectory
66 mkPath(log, destPath)
67 sourcePath = ExportBuildDirectory + "/" + CartographerBuildDirectory
68 mkPath(log, sourcePath)
69 files = os.listdir(sourcePath)
70 len_tga_png = len(".tga")
71 len_dds = len(".dds")
72 for fileName in files:
73 if isLegalFileName(fileName):
74 sourceFile = sourcePath + "/" + fileName
75 if os.path.isfile(sourceFile):
76 if (fileName[-len_tga_png:].lower() == ".tga") or (fileName[-len_tga_png:].lower() == ".png"):
77 destFile = destPath + "/" + os.path.basename(fileName)[0:-len_tga_png] + ".dds"
78 if needUpdateLogRemoveDest(log, sourceFile, destFile):
79 subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-m" ])
80 elif not os.path.isdir(sourceFile):
81 printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile)
82 printLog(log, "")
84 log.close()
87 # end of file