Hello World - Creating Your First USD Stage
VERIFIED ON USD VERSION 0.8.3
Ensure that you have configured your python environment, this is described in the USD Tutorials document.
This tutorial will walk you through creating a simple USD stage, containing a transform and a sphere.
Python for USD
Open USD/extras/usd/tutorials/helloWorld/helloWorld.py to see the Python snippet to create and export the stage. It should look like the snippet below.
Execute the Python script to create a .usda file.
Visualizing the stage
usdview can be used to visualize/introspect the stage
Try opening the stage in usdview:
You can refine the geometry via the View --> Adjust Complexity menu or with the hotkeys CTRL+ and CTRL- to bring the complexity respectively up and down.
In usdview, you can also bring up an embedded interpreter by hitting i or using the Window --> Interpreter menu item. This interpeter has a few useful preset variables. One such variable is prim, which represents the first prim, hierarchically, in the set of currently selected prims. Select the sphere by either clicking on it in the viewport or selecting the "world" prim in the view on the left, then try out the following commands:
Viewing and editing the contents of the *.usda file
The exported file is human-readable via usdcat and ASCII-editable via usdedit (both available in USD_INSTALL_ROOT/bin in the default installation), which will bring up any .usd layer, regardless of its encoding, as plain text in your $EDITOR (follow the usdedit link for more details), and save it back out in its original format. (This particular example can be edited by invoking a text editor directly, since we created an ASCII-based USD file by calling CreateInMemory().)