46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
import sys, os
|
|
from args import inputAssets, args
|
|
from processasset import processAsset
|
|
from processpalette import processPaletteList
|
|
from processtileset import processTilesetList
|
|
from assethelpers import getBuiltAssetsRelativePath
|
|
import zipfile
|
|
|
|
# Setup headers directory.
|
|
# setOutputDir(args.output)
|
|
# outputHeaders = []
|
|
|
|
# # Create output directory if it doesn't exist
|
|
# if not os.path.exists(args.output):
|
|
# os.makedirs(args.output)
|
|
|
|
files = []
|
|
|
|
for asset in inputAssets:
|
|
asset = processAsset(asset)
|
|
files.extend(asset['files'])
|
|
|
|
# Take assets and add to a zip archive.
|
|
outputFileName = args.output_file
|
|
print(f"Creating output file: {outputFileName}")
|
|
with zipfile.ZipFile(outputFileName, 'w') as zipf:
|
|
for file in files:
|
|
relativeOutputPath = getBuiltAssetsRelativePath(file)
|
|
zipf.write(file, arcname=relativeOutputPath)
|
|
|
|
# Generate additional headers.
|
|
processPaletteList()
|
|
processTilesetList()
|
|
|
|
# Finalize build
|
|
if args.build_type == 'header':
|
|
print("Error: Header build not implemented yet.")
|
|
sys.exit(1)
|
|
|
|
elif args.build_type == 'wad':
|
|
# Nothing to do, already created above!
|
|
pass
|
|
|
|
else:
|
|
print("Error: Unknown build type.")
|
|
sys.exit(1) |