< Inspecting and Authoring Properties Converting Between Layer Formats >


Referencing Layers

This tutorial is focused on creating a new stage that references the stage created in the previous tutorials, using the operators from the Shift_USD catalog. The example will reuse the HelloWorld.usda file generated during the last tutorial Inspecting and Authoring Properties.

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_02_authoring_properties/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 and rename it to StageOpen. Using the Inspector widget, set as the value for the filepath plug a filepath pointing to the HelloWorld.usda file downloaded for the example. The board should look like the following:
Added the 'StageOpen' node to the board for opening a given USD file.
Figure 2: Added the 'StageOpen' node to the board for opening a given USD file.
  1. Add a new UsdPrimGet node to the board and rename it to HelloGet. Connect the stage output plug from the StageOpen node to the stage input plug of the new node. Set /hello as the value to the primpath input plug. The board should look like the following:
Added the 'HelloGet' node to the board connected to the 'StageOpen' node.
Figure 3: Added the 'HelloGet' node to the board connected to the 'StageOpen' node.
  1. Add a new UsdStageDefaultPrimSet node to the board and rename it to DefaultPrimSet. Connect the stage output plug from the StageOpen node to the stage input plug of the new node, also, connect the prim output plug from the HelloGet node to the prim input plug of the new node. The board should look like the following:
Added the 'DefaultPrimSet' node to the board connected to the 'HelloGet' and 'StageOpen' nodes.
Figure 4: Added the 'DefaultPrimSet' node to the board connected to the 'HelloGet' and 'StageOpen' nodes.
  1. For adding a translation to the Hello prim, add a new UsdXformSet node to the board and rename it to HelloXformSet. Connect the prim output plug from the HelloGet node to the prim input plug of the new node and connect the out-trigger from the DefaultPrimSet node to the in-trigger of the new node. Set [4, 5, 6] as the value for the translate input plug, leave the useTime input plug value set as False, the time input plug value set as 0, and the rotate, scale and pivot input plugs values set as None. The board should look like the following:
Added the 'HelloXformSet' node to the board connected to the 'DefaultPrimSet' and 'HelloGet' nodes.
Figure 5: Added the 'HelloXformSet' node to the board connected to the 'DefaultPrimSet' and 'HelloGet' nodes.
  1. Add a new UsdPrimStageGet node to the board and rename it to HelloStageGet. Connect the prim output plug from the HelloXformSet node to the prim input plug of the new node. The board should look like the following:
Added the 'HelloStageGet' node to the board connected to the 'HelloXformSet' node.
Figure 6: Added the 'HelloStageGet' node to the board connected to the 'HelloXformSet' node.
  1. Add a new UsdStageSave node to the board and rename it to HelloWorldStageSave. Connect the stage output plug from the HelloStageGet node to the stage input plug of the new node. Leave the filepath input plug empty to override the original file. The board should look like the following:
Added the 'HelloWorldStageSave' node to the board connected to the 'HelloStageGet' node.
Figure 7: Added the 'HelloWorldStageSave' node to the board connected to the 'HelloStageGet' node.
  1. Add a new UsdStageNew node to the board and rename it to RefExampleStageNew. Connect the out-trigger output plug from the HelloWorldStageSave node to the in-trigger input plug of the new node. Set as the value for the filepath input plug a filepath pointing to a file named RefExample.usda. That file will be used for adding references to the previous modified stage. The board should look like the following:
Added the 'RefExampleStageNew' node to the board connected to the 'HelloWorldStageSave' node.
Figure 8: Added the 'RefExampleStageNew' node to the board connected to the 'HelloWorldStageSave' node.
  1. For overriding a prim in a stage, add a new UsdPrimOverride node to the board and rename it to RefSphereOverride. Connect the stage output plug from the RefExampleStageNew node to the stage input plug of the new node. Set /refSphere as the value for the primpath input plug. The board should look like the following:
Added the 'RefSphereOverride' node to the board connected to the 'RefExampleStageNew' node.
Figure 9: Added the 'RefSphereOverride' node to the board connected to the 'RefExampleStageNew' node.
  1. Add a new UsdPrimReferenceAdd node to the board and rename it to RefSphereReferenceAdd. Connect the prim output plug from the RefSphereOverride node to the prim input plug of the new node. Set Reference as the value for the mode input plug and None as the value for the reference input plug. For the filepath input plug, set as value the path to the updated HelloWorld.usda file used at the beginning of the tutorial, D:/USD_TUTORIALS/03/HelloWorld.usda. Leave the value empty for the primpath input plug, None as the value for the variantSet input plug and empty value for the variantName input plug. The board should look like the following:
Added the 'RefSphereReferenceAdd' node to the board connected to the 'RefSphereOverride' node.
Figure 10: Added the 'RefSphereReferenceAdd' node to the board connected to the 'RefSphereOverride' node.
  1. Add another UsdPrimStageGet node to the board and rename it to RefSphereStageGet. Connect the prim output plug from the RefSphereReferenceAdd node to the prim input plug of the new node. The board should look like the following:
Added the 'RefSphereStageGet' node to the board connected to the 'RefSphereReferenceAdd' node.
Figure 11: Added the 'RefSphereStageGet' node to the board connected to the 'RefSphereReferenceAdd' node.
  1. Add another UsdStageSave node to the board and rename it to RefSphereStageSave. Connect the stage output plug from the RefSphereStageGet node to the stage input plug of the new node. Leave the filepath input plug empty to override the original file. The board should look like the following:
Added the 'RefSphereStageSave' node to the board connected to the 'RefSphereStageGet' node.
Figure 12: Added the 'RefSphereStageSave' node to the board connected to the 'RefSphereStageGet' node.
  1. In order to reset the transform of the /refSphere prim, add a new UsdXformOpOrderClear node to the board and rename it to RefSphereOpOrderClear. Connect the prim output plug from the RefSphereReferenceAdd node to the prim input plug of the new node, also, connect the out-trigger output plug from the RefSphereStageSave node to the in-trigger plug of the new node. The board should look like the following:
Added the 'RefSphereOpOrderClear' node to the board connected to the 'RefSphereReferenceAdd' and 'RefSphereStageSave' nodes.
Figure 13: Added the 'RefSphereOpOrderClear' node to the board connected to the 'RefSphereReferenceAdd' and 'RefSphereStageSave' nodes.
  1. Add a new UsdPrimOverride node to the board and rename it to RefSphere2Override. Connect the stage output plug from the RefSphereStageGet node to the stage input plug of the new node, also, connect the out-trigger output plug from the RefSphereOpOrderClear node to the in-trigger input plug of the new node. Set /refSphere2 as the value for the primpath input plug. The board should look like the following:
Added the 'RefSphere2Override' node to the board connected to the 'RefSphereStageGet' and 'RefSphereOpOrderClear' nodes.
Figure 14: Added the 'RefSphere2Override' node to the board connected to the 'RefSphereStageGet' and 'RefSphereOpOrderClear' nodes.
  1. Add another UsdPrimReferenceAdd node to the board and rename it to RefSphere2ReferenceAdd. Connect the prim output plug from the RefSphere2Override node to the prim input plug of the new node. As done in the previous step 10, set Reference as the value for the mode input plug and None as the value for the reference input plug. For the filepath input plug, set as value the path to the updated HelloWorld.usda file used at the beginning of the tutorial, D:/USD_TUTORIALS/03/HelloWorld.usda. Leave the value empty for the primpath input plug, None as the value for the variantSet input plug and empty value for the variantName input plug. The board should look like the following:
Added the 'RefSphere2ReferenceAdd' node to the board connected to the 'RefSphere2Override' node.
Figure 15: Added the 'RefSphere2ReferenceAdd' node to the board connected to the 'RefSphere2Override' node.
  1. Add a new UsdPrimStageGet node to the board and rename it to RefSphere2StageGet. Connect the prim output plug from the RefSphere2ReferenceAdd node to the prim input plug of the new node. The board should look like the following:
Added the 'RefSphere2StageGet' node to the board connected to the 'RefSphere2ReferenceAdd' node.
Figure 16: Added the 'RefSphere2StageGet' node to the board connected to the 'RefSphere2ReferenceAdd' node.
  1. Add another UsdStageSave node to the board and rename it to RefSphere2StageSave. Connect the stage output plug from the RefSphere2StageGet node to the stage input plug of the new node. Leave empty the value for the filepath input plug, doing this, the original file will be overriden. The board should look like the following:
Added the 'RefSphere2StageSave' node to the board connected to the 'RefSphere2StageGet' node.
Figure 17: Added the 'RefSphere2StageSave' node to the board connected to the 'RefSphere2StageGet' node.
  1. Add a new UsdPrimGet node to the board and rename it to WorldGet. Connect the stage output plug from the RefSphere2StageGet node to the stage input plug of the new node. Set /refSphere2/world as the value of the primpath input plug of the new node. Also, connect the out-trigger output plug from the RefSphere2StageSave node to the in-trigger input plug of the new node. The board should look like the following:
Added the 'WorldGet' node to the board connected to the 'RefSphere2StageGet' and 'RefSphere2StageSave' nodes.
Figure 18: Added the 'WorldGet' node to the board connected to the 'RefSphere2StageGet' and 'RefSphere2StageSave' nodes.
  1. Add a new UsdPrimDisplayColorSet node to the board and rename it to WorldDisplayColorSet. Connect the prim output plug from the WorldGet node to the prim input plug of the new node. Set [1, 0, 0] as the value for the color input plug, [] as the value for the indices input plug and constant as the value for the interpolation input plug of the new node. The board should look like the following:
Added the 'WorldDisplayColorSet' node to the board connected to the 'WorldGet' node.
Figure 19: Added the 'WorldDisplayColorSet' node to the board connected to the 'WorldGet' node.
  1. Add another UsdPrimStageGet node to the board and rename it to WorldStageGet. Connect the prim output plug from the WorldDisplayColorSet node to the prim input plug of the new node. The board should look like the following:
Added the 'WorldStageGet' node to the board connected to the 'WorldDisplayColorSet' node.
Figure 20: Added the 'WorldStageGet' node to the board connected to the 'WorldDisplayColorSet' node.
  1. Add another UsdStageSave node to the board and rename it to WorldStageSave. Connect the stage output plug from the WorldStageGet node to the stage input plug of the new node. Leave empty the value for the filepath input plug, doing this, the original file will be overridden. The board should look like the following:
Added the 'WorldStageSave' node to the board connected to the 'WorldStageGet' node.
Figure 21: Added the 'WorldStageSave' node to the board connected to the 'WorldStageGet' node.
  1. To flatten the resulting stage, add a new UsdStageFlatten node to the board and rename it to StageFlatten. Connect the stage output plug from the WorldStageGet node to the stage input plug of the new node. Leave the layer input plug with the default value to None. Finally, connect the out-trigger output plug from the WorldStageSave node to the in-trigger input plug of the new node. The board should look like the following:
Added the 'StageFlatten' node to the board connected to the 'WorldStageGet' node.
Figure 22: Added the 'StageFlatten' node to the board connected to the 'WorldStageGet' node.
  1. For saving the stage after flattening it, add another UsdStageSave node to the board and rename it to FlattenStageSave. Connect the stage output plug from the StageFlatten node to the stage input plug of the new node. Now, set the value for the filepath input plug to point to a new .usda file to avoid overwriting the final result, for example, D:/USD_TUTORIALS/03/RefExampleFlatten.usda. The board should look like the following:
Added the 'FlattenStageSave' node to the board connected to the 'StageFlatten' node.
Figure 23: Added the 'FlattenStageSave' node to the board connected to the 'StageFlatten' node.
  1. Execute the entire workflow. Open the RefExample.usda file, it will contain the references and overrides updated. Also, preview the RefExampleFlatten.usda for checking how flattening the stage works.

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 24: 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 25: 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_03_referencing_layers/tutorial_03.sft


< Inspecting and Authoring Properties Converting Between Layer Formats >


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