OpenUSD Exchange Dev Tools#
Most users of OpenUSD Exchange SDK will have their own build systems & CI/CD processes, and our custom dev tools may be of limited use outside of the usd-exchange
and usd-exchange-samples
repositories.
However, there are three tools that we highly recommend using:
The Omniverse Asset Validator is a python module & command line interface for validating OpenUSD Stage/Layer data.
The
usd-exchange
python wheels include an optional test module, which we recommend for integrating into CI/CD processes to ensure valid output of data converters.For C++ or mixed language developers, the repo install_usdex tool can be used to acquire all of the OpenUSD Exchange build & runtime requirements, including the public headers for all relevant compiled libraries.
Asset Validator#
The Omniverse Asset Validator provides both a python module & command line interface for validating OpenUSD Stage/Layer data.
It includes a suite of validation rules that check for common USD authoring mistakes:
All rules from OpenUSD’s usdchecker CLI.
Many additional rules, developed by NVIDIA, which are applicable to all OpenUSD Ecosystem products.
It is easily extended & configured with your own custom python rules specific to your data or workflows.
It can be used in several ways:
Interactively, to validate data on import into your application.
As a runtime component in data exchange workflows, for validating at each hand-off gate in your pipeline.
Integrated into CI/CD processes to test for correctness & compliance of OpenUSD data models.
See Python Wheel Optional Test Dependencies for the simplest installation instructions.
To use the validator from python, with the default rules enabled, simply provide any layer URI (or composed Usd.Stage
object) and validate:
import omni.asset_validator
# validate an existing layer file
engine = omni.asset_validator.ValidationEngine()
print(engine.validate("foo.usd"))
# validate a stage in memory
stage = Usd.Stage.CreateAnonymous()
# define prims
engine = omni.asset_validator.ValidationEngine()
print(engine.validate(stage))
There are also CLI examples of the Asset Validator in OpenUSD Exchange Samples.
If you are using Python’s unittest framework for your regression testing, consider trying the usdex.test
python module in your test suite. It includes a few unittest.TestCase
derived classes to simplify some common OpenUSD testing scenarios, including the Asset Validator (e.g self.assertIsValidUsd()
).
Unfortunately, the Omniverse Asset Validator is not yet available for pure C++ testing, but recent OpenUSD versions now include a UsdValidatorSuite that is implemented in C++. Over time these two frameworks will align & validation should be possible from either C++ or Python.
Python Wheel Optional Test Dependencies#
If you would like to use the usdex.test
python module that comes with the usd-exchange
wheels, you will need to opt-in to the optional test
dependencies as well. This pulls an additional wheel for the Omniverse Asset Validator.
Important
Each OpenUSD Exchange SDK release supports many OpenUSD versions and python versions. When using wheels, the python version is automatically determined based on the interpreter. However, the version of OpenUSD is currently locked in the python wheels. If you need to control OpenUSD version use the install_usdex CLI instead of the python wheels.
# Create a virtual environment
python -m venv usdex-env
# Activate the virtual environment
source usdex-env/bin/activate
# Install the OpenUSD Exchange modules with test dependency
pip install usd-exchange[test]
# Create a virtual environment
python -m venv usdex-env
# Activate the virtual environment
usdex-env\Scripts\activate
# Install the OpenUSD Exchange modules with test dependency
pip install usd-exchange[test]
install_usdex#
If you want to build a native application or plugin, or if you need more flexibility than the python wheels provide, we include a CLI to install the OpenUsd Exchange SDK.
Assembling the minimal runtime requirements of the SDK can be arduous. The install_usdex
tool can be used to download precompiled binary artifacts for any flavor of the SDK, including all runtime dependencies, and assemble them into a single file tree on your local disk.
Important
Be sure to configure the --usd-flavor
, --usd-version
, --python-version
, and --version
arguments appropriately to download your preferred flavor of OpenUSD Exchange SDK. See repo install_usdex -h
for available options.
This tool can be invoked from a clone of the GitHub repository or from a source archive downloaded from an official release.
Install usdex_core#
By default, the tool will install the core library and module from OpenUSD Exchange SDK. For example, to download & assemble a USD 24.05 & Python 3.11 compatible binaries for OpenUSD Exchange v2.0.0 call:
./repo.sh install_usdex --usd-version 24.05 --python-version 3.11 --version 2.0.0
.\repo.bat install_usdex --usd-version 24.05 --python-version 3.11 --version 2.0.0
Similarly, to download & assemble a minimal monolithic USD 24.11, with no python support, for OpenUSD Exchange v2.0.0 call:
./repo.sh install_usdex --usd-flavor usd-minimal --usd-version 24.11 --python-version 0 --version 2.0.0
.\repo.bat install_usdex --usd-flavor usd-minimal --usd-version 24.11 --python-version 0 --version 2.0.0
Extra OpenUSD plugins#
If you need more OpenUSD modules than the strict minimal requirements of OpenUSD Exchange SDK, you can install them using --install-extra-plugins
.
For example, to add on usdSkel
and usdSemantics
call:
./repo.sh install_usdex --version 2.0.0 --install-extra-plugins usdSkel usdSemantics
.\repo.bat install_usdex --version 2.0.0 --install-extra-plugins usdSkel usdSemantics
Install usdex_rtx#
If you are interested in RTX Rendering via NVIDIA Omniverse, you may want to use usdex_rtx
to assist with MDL Shader authoring. Use the --install-rtx
argument to install the usdex_rtx library and usdex.rtx
python module.
./repo.sh install_usdex --version 2.0.0 --install-rtx
.\repo.bat install_usdex --version 2.0.0 --install-rtx
Python Test Helpers#
If you would like to use our usdex.test
python module, or the Omniverse Asset Validator, you can use --install-test
to install them both.
./repo.sh install_usdex --version 2.0.0 --install-test
.\repo.bat install_usdex --version 2.0.0 --install-test
repo_tools configuration#
If you do use repo_tools
in your project, you can configure install_usdex
by adding the following to your repo.toml
along with any tool configuration overrides from the default values:
[repo]
extra_tool_paths."++" = [
"_build/target-deps/usd-exchange/release/dev/tools/repoman/repo_tools.toml",
]
[repo_install_usdex]
enabled = true
If you would like to run this process automatically during a build, add it to the post build commands:
[repo_build.post_build]
commands = [
["$root/repo${shell_ext}", "install_usdex", "-c", "$config"],
]
- staging_dir#
Sets the staging root folder for package links.
Required compile, link, and runtime dependencies will be downloaded & linked this folder.
Default value:
staging_dir = "$root/_install"
- install_dir#
Sets the install root folder.
Required runtime files will be assembled into this folder.
Default value:
install_dir = "$root/_install/$platform/$config"
- usd_flavor#
Sets the usd flavor (set ‘usd’ for stock pxr builds of OpenUSD)
Default value:
usd_flavor = "usd"
- usd_ver#
Sets the usd version (YY.MM)
Default value:
usd_ver = ""
- python_ver#
Sets the python version.
Use “0” to indicate that python should be disabled.
Default value:
python_ver = ""