Run Switch Variants Script

Just like the reference path errors, these switch variants can be modified by another preprocessing script to turn these create/destroy variants into ones that will toggle the visibility on and off instead. This way, the prims will be more performant at runtime and always exist in the stage hierarchy.

The script was run using these steps:

  1. Open ConceptCar_3xf_model.usdc in the new Ingest folder. This USD file is where the switch variants on prims are defined.

    Note

    This is a different USD file than the first ingestion script.

  2. Go to Window > Script Editor.

  3. Locate the visibility_switches.py script available on GitHub.

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

  5. Select Run (Ctrl + Enter). The application may appear to freeze while the script processes the file. This should only take a few seconds.

  6. Save file. This ingestion script does not automatically save after it runs.

  7. Now, find the switch_frontLicensePlate prim in the Stage again. Notice that there are now two prims below it, frontLicensePlate_OFF and frontLicensePlate_ON, and that the variant stage now toggles the visibility on and off for those prims (see image below).

../_images/visibility-switches_1.png