-
Notifications
You must be signed in to change notification settings - Fork 7
/
regenerate_schema.sh
executable file
·41 lines (29 loc) · 1.58 KB
/
regenerate_schema.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#/bin/bash
PROJECT_ROOT=`dirname -- "$( readlink -f -- "$0"; )"`
NVIDIA_USD_ROOT="$PROJECT_ROOT/extern/nvidia/_build/target-deps/usd/release"
NVIDIA_USD_LIBS="$NVIDIA_USD_ROOT/lib"
NVIDIA_USD_PYTHON_LIBS="$NVIDIA_USD_ROOT/lib/python"
NVIDIA_PYTHON_ROOT="$PROJECT_ROOT/extern/nvidia/_build/target-deps/python"
NVIDIA_PYTHON_EXECUTABLE="$NVIDIA_PYTHON_ROOT/python"
SCHEMA_INPUT_PATH="$PROJECT_ROOT/exts/cesium.usd.plugins/schemas/cesium_schemas.usda"
SCHEMA_OUTPUT_PATH="$PROJECT_ROOT/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas"
export PYTHONPATH="$NVIDIA_USD_PYTHON_LIBS:$PYTHONPATH"
export PATH="$NVIDIA_USD_LIBS:$PATH"
$NVIDIA_PYTHON_EXECUTABLE -m pip install jinja2
# Temporarily move module.cpp and moduleDeps.cpp out of the folder.
mv "$SCHEMA_OUTPUT_PATH/module.cpp" "$PROJECT_ROOT/module.cpp"
mv "$SCHEMA_OUTPUT_PATH/moduleDeps.cpp" "$PROJECT_ROOT/moduleDeps.cpp"
# Clear out the old files.
rm $SCHEMA_OUTPUT_PATH/*
# Generate the new files.
$NVIDIA_PYTHON_EXECUTABLE "$NVIDIA_USD_ROOT/bin/usdGenSchema" $SCHEMA_INPUT_PATH $SCHEMA_OUTPUT_PATH
# Move the generatedSchema.usda and plugInfo.json files up.
mv "$SCHEMA_OUTPUT_PATH/generatedSchema.usda" "$SCHEMA_OUTPUT_PATH/../../generatedSchema.usda.in"
mv "$SCHEMA_OUTPUT_PATH/plugInfo.json" "$SCHEMA_OUTPUT_PATH/../../plugInfo.json.in"
# Delete the Pixar junk from the first 23 lines of the generated code.
for f in $SCHEMA_OUTPUT_PATH/*; do
sed -i '1,23d' "$f"
done
# Move module.cpp and moduleDeps.cpp back.
mv "$PROJECT_ROOT/module.cpp" "$SCHEMA_OUTPUT_PATH/module.cpp"
mv "$PROJECT_ROOT/moduleDeps.cpp" "$SCHEMA_OUTPUT_PATH/moduleDeps.cpp"