mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +02:00
add baking of skyboxes
This commit is contained in:
parent
67ec766af2
commit
5fdcd12375
2 changed files with 9 additions and 4 deletions
|
@ -71,7 +71,8 @@ def bakeFilesInDirectory(directory, outputDirectory):
|
||||||
absFilePath = os.path.abspath(filePath)
|
absFilePath = os.path.abspath(filePath)
|
||||||
outputFolder = os.path.join(outputDirectory, appendPath)
|
outputFolder = os.path.join(outputDirectory, appendPath)
|
||||||
print "Baking file: " + filename
|
print "Baking file: " + filename
|
||||||
bakeFile(absFilePath, outputFolder, 'png')
|
bakeType = os.path.splitext(filename)[1][1:]
|
||||||
|
bakeFile(absFilePath, outputFolder, bakeType)
|
||||||
else:
|
else:
|
||||||
filePath = os.sep.join([root, filename])
|
filePath = os.sep.join([root, filename])
|
||||||
absFilePath = os.path.abspath(filePath)
|
absFilePath = os.path.abspath(filePath)
|
||||||
|
|
|
@ -6,7 +6,7 @@ def createAssetMapping(assetDirectory):
|
||||||
baseDirectory = os.path.basename(os.path.normpath(assetDirectory))
|
baseDirectory = os.path.basename(os.path.normpath(assetDirectory))
|
||||||
for root, subfolder, filenames in os.walk(assetDirectory):
|
for root, subfolder, filenames in os.walk(assetDirectory):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if not filename.endswith('.ktx'):
|
if not filename.endswith('.ktx') or os.path.basename(root) == 'skyboxes':
|
||||||
substring = os.path.commonprefix([assetDirectory, root])
|
substring = os.path.commonprefix([assetDirectory, root])
|
||||||
newPath = root.replace(substring, '');
|
newPath = root.replace(substring, '');
|
||||||
filePath = os.sep.join([newPath, filename])
|
filePath = os.sep.join([newPath, filename])
|
||||||
|
@ -30,7 +30,7 @@ def handleURL(url):
|
||||||
baseFilename = os.path.basename(url)
|
baseFilename = os.path.basename(url)
|
||||||
filename = os.path.splitext(baseFilename)[0]
|
filename = os.path.splitext(baseFilename)[0]
|
||||||
newUrl = MAP[filename]
|
newUrl = MAP[filename]
|
||||||
print newUrl
|
print url + ' -> ' + newUrl
|
||||||
return newUrl
|
return newUrl
|
||||||
|
|
||||||
def handleOptions():
|
def handleOptions():
|
||||||
|
@ -43,8 +43,12 @@ def main():
|
||||||
argsLength = len(sys.argv)
|
argsLength = len(sys.argv)
|
||||||
if argsLength == 3:
|
if argsLength == 3:
|
||||||
jsonFile = sys.argv[1]
|
jsonFile = sys.argv[1]
|
||||||
gzipFile = jsonFile + '.gz'
|
|
||||||
assetDirectory = sys.argv[2]
|
assetDirectory = sys.argv[2]
|
||||||
|
inputFilename = os.path.basename(jsonFile);
|
||||||
|
absPath = os.path.abspath(assetDirectory)
|
||||||
|
finalPath = absPath.replace('\\', '/');
|
||||||
|
gzipFile = finalPath + '/' + inputFilename + '.gz'
|
||||||
|
print gzipFile
|
||||||
createAssetMapping(assetDirectory)
|
createAssetMapping(assetDirectory)
|
||||||
f = open(jsonFile)
|
f = open(jsonFile)
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
Loading…
Reference in a new issue