31 lines
898 B
Python
31 lines
898 B
Python
import sys, os
|
|
import argparse
|
|
from assetparser import parseAsset
|
|
from header import setOutputDir
|
|
|
|
# Check if the script is run with the correct arguments
|
|
parser = argparse.ArgumentParser(description="Generate chunk header files")
|
|
parser.add_argument('--output', required=True, help='Dir to output headers')
|
|
parser.add_argument('--input', required=True, help='Input assets to process', nargs='+')
|
|
args = parser.parse_args()
|
|
|
|
# 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)
|
|
|
|
# Split input assets by comma
|
|
inputAssets = []
|
|
for inputArg in args.input:
|
|
inputAssets.extend(inputArg.split(','))
|
|
|
|
# Begin processing assets
|
|
if not inputAssets:
|
|
print("Error: No input assets provided.")
|
|
sys.exit(1)
|
|
|
|
for asset in inputAssets:
|
|
outputHeaders.extend(parseAsset(asset)) |