< Creating a Simple USD Stage Referencing Layers >


Inspecting and Authoring Properties

This tutorial focuses on inspecting the properties containing geometric data of the prims created in the tutorial Creating a Simple USD Stage, using the operators from the Shift_USD catalog.

The USD file HelloWorld.usda can be found in the following path in the Shift installation folder: <path_to_the_shift_installation_folder>/shift/examples/USD/tutorials/tutorial_01_creating_first_stage/result/.

Tutorial

  1. Open Shift application. A new window instance of Shift should appear like the following one:
Shift UI.
Figure 1: Shift UI.
NOTE

Before creating the USD workflow, ensure that the USD nodes appear in the Node List widget. The catalogs combobox should show sUSD and sUSDTypes if USD is correctly loaded in Shift. If this is not the case, please check again the Shift_USD installation page.

  1. Add a new UsdStageOpen node to the board. Using the Inspector widget, set as the value for the filepath input plug a filepath pointing to the HelloWorld.usda file downloaded for the example. The board should look like the following:
Added the 'UsdStageOpen' node to the board for opening a given USD file.
Figure 2: Added the 'UsdStageOpen' node to the board for opening a given USD file.
  1. Add a new UsdPrimGet node to the board. Connect the stage output plug from the UsdStageOpen node to the stage input plug of the new node and set /hello as the value for the primpath input plug. Rename the node as HelloXformGet to easily identify it. The board should look like the following:
Added the 'HelloXformGet' node to the board connected to the 'UsdStageOpen' node for getting the '/hello' prim.
Figure 3: Added the 'HelloXformGet' node to the board connected to the 'UsdStageOpen' node for getting the '/hello' prim.
  1. Add another UsdPrimGet node to the board. Connect the stage output plug from the UsdStageOpen node to the stage input plug of the new node and set /hello/world as the value for the primpath input plug. Rename the node as WorldSphereGet to easily identify it. The board should look like the following:
Added the 'WorldSphereGet' node to the board connected to the 'UsdStageOpen' node for getting the '/hello/world' prim.
Figure 4: Added the 'WorldSphereGet' node to the board connected to the 'UsdStageOpen' node for getting the '/hello/world' prim.
  1. Add a new UsdPrimPropertyNamesGet node to the board. Connect the prim output plug from the HelloXformGet node to the prim input plug of the new node. Rename the node as HelloPropertyNamesGet to easily identify it. The board should look like the following:
Added the 'HelloPropertyNamesGet' node to the board connected to the 'HelloXformGet' node.
Figure 5: Added the 'HelloPropertyNamesGet' node to the board connected to the 'HelloXformGet' node.
  1. As done in the previous step, add another UsdPrimPropertyNamesGet node to the board. Connect the prim output plug from the WorldSphereGet node to the prim input plug of this new node. Rename the node as WorldPropertyNamesGet to easily identify it. The board should look like the following:
Added the 'WorldPropertyNamesGet' node to the board connected to the 'WorldSphereGet' node.
Figure 6: Added the 'WorldPropertyNamesGet' node to the board connected to the 'WorldSphereGet' node.
  1. Now, with the HelloPropertyNamesGet node selected, run the execution only for the selected nodes. The execution will run only on the necessary nodes to compute the HelloPropertyNamesGet node, meaning that from the 2 branches created, only the top one will be executed. With the HelloPropertyNamesGet node selected, Right-Click over the propertyNames output plug field and click on the Show option from the context menu. A new dialog should appear showing the value of the plug, which should be: ['proxyPrim', 'purpose', 'visibility', 'xformOpOrder']. The board should look like the following:
Executed the selected node named 'HelloPropertyNamesGet'.
Figure 7: Executed the selected node named 'HelloPropertyNamesGet'.
  1. Following the previous steps, do the same selecting now the WorldPropertyNamesGet node. Execute again only the selected node. The execution will run over the nodes on the bottom branch that were still not executed. When showing the result values from the propertyNames output plug, the values of the list are: ['doubleSided', 'extent', 'orientation', 'primvars:displayColor', 'primvars:displayOpacity', 'proxyPrim', 'purpose', 'radius', 'visibility', 'xformOpOrder']. The board should look like the following:
Executed the selected node named 'WorldPropertyNamesGet'.
Figure 8: Executed the selected node named 'WorldPropertyNamesGet'.
  1. Add a new UsdAttributeGet node to the board. Connect the prim output plug from the WorldSphereGet node to the prim input plug of the new node and set extent as the value for the name input plug. Rename the node as ExtentGet to easily identify it. The board should look like the following:
Added the 'ExtentGet' node to the board connected to the 'WorldSphereGet' node.
Figure 9: Added the 'ExtentGet' node to the board connected to the 'WorldSphereGet' node.
  1. In order to get the value of an attribute, add a new UsdAttributeValueGet node to the board. Connect the attribute output plug from the ExtentGet node to the prim input plug of the new node. Leave the useTime input plug value set to False and the time input plug value set to 0. Rename the node as ExtentValueGet to easily identify it. The board should look like the following:
Added the 'ExtentValueGet' node to the board connected to the 'ExtentGet' node.
Figure 10: Added the 'ExtentValueGet' node to the board connected to the 'ExtentGet' node.
  1. Select the ExtentValueGet node and execute the workflow again only for the selected node. Inspecting the value of the value output plug as done in the previous cases, the result list is: [(-1, -1, -1), (1, 1, 1)]. The board should look like the following:
Executed the 'ExtentValueGet' node.
Figure 11: Executed the 'ExtentValueGet' node.
  1. Add another UsdAttributeGet node to the board. Connect the prim output plug from the WorldSphereGet node to the prim input plug of this new node and set radius as the value for the name input plug. Rename the node as RadiusGet to easily identify it. The board should look like the following:
Added the 'RadiusGet' node to the board connected to the 'WorldSphereGet' node.
Figure 12: Added the 'RadiusGet' node to the board connected to the 'WorldSphereGet' node.
  1. Add a new UsdAttributeValueSet node to the board and rename it as RadiusValueSet. Connect the attribute output plug from the RadiusGet node to the attribute input plug of the new node. Leave the useTime input plug value set to False and time input plug value set to 0. The board should look like the following:
Added the 'RadiusValueSet' node to the board connected to the 'RadiusGet' node.
Figure 13: Added the 'RadiusValueSet' node to the board connected to the 'RadiusGet' node.
  1. Add a new Float node to the board and rename it as RadiusValue. Set 2,0 as the value of the input value plug. Connect the out output plug from the RadiusValue node to the value input plug of the RadiusValueSet node. The board should look like the following:
Added the 'RadiusValueSet' node to the board connected to the 'RadiusGet' node.
Figure 14: Added the 'RadiusValue' node to the board connected to the 'RadiusValueSet' node.
  1. To update the sphere's extent to reflect its new size, the same process is needed to update the value of the extent attribute. First, add a new PythonScript node and rename it as MultiplyExtent. Drag and drop a connection from the value output plug of the ExtentValueGet node over the MultiplyExtent node. In the Add Plug dialog should appear, keep the preselected values for the plug configuration and click over the OK button to create the new input plug. Create an additional output plug by pressing Right-Click over the node and selecting the Create New Plug option. In the Add Plug dialog, set the name as outValue, the type as instance and the direction as out. Finally, type outValue = value * 2 in the script input plug of the MultiplyExtent node. The board should look like the following:
Added the 'MultiplyExtent' node to the board connected to the 'ExtentValueGet' node.
Figure 15: Added the 'MultiplyExtent' node to the board connected to the 'ExtentValueGet' node.
  1. Add another UsdAttributeValueSet node to the board and rename it as ExtentValueSet. Connect the attribute output plug from the ExtentGet node to the attribute input plug of the new node. Also, connect the outValue output plug from the MultiplyExtent node to the value input plug. Leave the useTime input plug value set to False and the time input plug value set to 0. The board should look like the following:
Added the 'ExtentValueSet' node to the board connected to the 'ExtentGet' node.
Figure 16: Added the 'ExtentValueSet' node to the board connected to the 'ExtentGet' node.
  1. For authoring the displayColor attribute of the sphere, add a new UsdPrimDisplayColorSet node to the board. Connect the prim output plug from the WorldSphereGet node to the prim input plug of the new node. Set the color input plug value to [0,0,1], the indices input plug value as [], and the interpolation input plug value as constant. Rename the node as WorldDisplayColorSet to easily identify it. The board should look like the following:
Added the 'RadiusValueSet' node to the board connected to the 'RadiusGet' node.
Figure 17: Added the 'WorldDisplayColorSet' node to the board connected to the 'WorldSphereGet' node.
  1. To define the workflow execution order it is necessary to connect some trigger plugs. Connect the out-trigger output plugs from nodes HelloPropertyNamesGet, WorldPropertyNamesGet, RadiusValueSet and ExtentValueSet to the in-trigger input plug of the WorldDisplayColorSet node. Doing this, the WorldDisplayColorSet node will be executed once the other nodes are done. The board should look like the following:
Added the trigger connections to 'WorldDisplayColorSet' node.
Figure 18: Added the trigger connections to 'WorldDisplayColorSet' node.
  1. For retrieving the stage from a prim, add a new UsdPrimStageGet node and rename it as WorldStageGet. Connect the prim output plug from the WorldDisplayColorSet node to the prim input plug of the new node. Doing this, the stage is retrieved from the sphere's prim. The board should look like the following:
Added the 'WorldStageGet' node to the board connected to the 'WorldDisplayColorSet' node.
Figure 19: Added the 'WorldStageGet' node to the board connected to the 'WorldDisplayColorSet' node.
  1. For saving the stage, add a new UsdStageSave node. Connect the stage output plug from the WorldStageGet node to the stage input plug of the new node. Leave the filepath input plug value empty to override the same USD file opened at the beginning. The board should look like the following:
Added the 'UsdStageSave' node to the board connected to the 'WorldStageGet' node.
Figure 20: Added the 'UsdStageSave' node to the board connected to the 'WorldStageGet' node.
  1. Execute the entire workflow. Open again the HelloWorld.usda file, it will now contain the authored properties updated and the new displayColor attribute set.

Visualising the Stage

Shift is shipped with native plugins to visualise and inspect the stage. They can be accessed from the USD top menu:

  • USD Outliner: Shows the user the stage hierarchy sourced from specific Usd nodes in the active board workflow.

  • USD Viewer: Shows the stage in the USD viewer sourced from specific USD nodes in the active board workflow.

Shift USD Outliner and USD Viewer plugins.
Figure 21: Shift USD Outliner and USD Viewer plugins.

The USD viewer tool shipped with USD is used to visualise and inspect the stage viewport:

Visualisation of the generated stage.
Figure 22: Visualisation of the generated stage.

Workflow Resources

The workflow corresponding to this tutorial can be found in the following path in the Shift installation folder: <path_to_the_shift_installation_folder>/shift/examples/USD/tutorials/tutorial_02_authoring_properties/tutorial_02.sft


< Creating a Simple USD Stage Referencing Layers >


Inbibo Logo

consultancy, automation and digital creatures

65 Compton Street, London, United Kingdom, EC1V 0BN

info@inbibo.co.uk

Information

Products

© 2024 Inbibo LTD. - All rights reserved - Design & Development: def:studio