Run Optimization Script#

At this point, an ingestion script named optimize_file.py is used to address the export issues noted above. NVIDIA recommends you use this script on every DELTAGEN 2023x USD file. This recommendation may change for future versions of DELTAGEN. This script is a sample and could also be adapted for other data sources that export USD files.

Note

Be mindful of the USD Layer structure (in the Layers panel) and the active Authoring Layer when applying the following scripts, which will impact USD strength ordering (LIVRPS).

The script was run using these steps:

  1. First, copy all files in the 2_ConceptCar_DeltagenExport_106.0.3 folder into a new, empty folder named Ingest (this folder, in its finished state, is provided along with the Sample Assets inside the 3_ConceptCar_Example_106.0.3 folder). This copy is performed to preserve the files exported from DELTAGEN in their original state in case they are needed for reference later.

  2. Open ConceptCar.usdc in the new Ingest folder.

  3. Go to Window > Script Editor.

  4. Locate the OptimizeFile.py script available on GitHub.

  5. Copy the full script and paste it into the Script Editor Python window.

  6. Select Run (Ctrl + Enter). The application may appear to freeze while the script processes the files. This may take several minutes.

    Note

    As listed above, this script automatically saves the files that it edits. Running it multiple times on the same file should not cause any issues, but it is important to be aware of this potential issue.

  7. When the script is finished, an output appears in the Script Editor’s upper output panel (see image below).

  8. Close the file. There is no need to save since this script automatically saves when it completes.

../_images/optimize-file_1.png

The OptimizeFile.py script performs the following edits:

  • Moved all stage prims under the parent prim World instead of prim scene.

  • Set the World prim to be the defaultPrim.

  • Set the World prim to have Type = Xform.

  • This change prevents the file from triggering an Asset Validator rule that advises that all prims have a type.

  • Fixed the inconsistency in the syntax of the reference path to the Materials USD file in the Variants file to prevent a reference path error.

  • Changed materials\ to ./materials/.

  • Fixed the inconsistency in the syntax of the reference paths to the texture files in the Materials USD file to prevent reference path errors in some use cases.

  • Changed textures\ to ./textures/.

  • Edited the top level project USD (ConceptCar.usdc) to add the Variants USD file as a layer instead of a reference for improved readability and in preparation for a layer-based workflow.

  • Automatically saved all necessary files in place.