Exercise: Working With Relocates#
Let’s go through some of the relocates we discussed with a hands-on exercise in usdview.
Renaming a Referenced Prim#
In the Visual Studio Code terminal, run the code below to open the file in usdview:
Windows:
.\scripts\usdview.bat .\composition_arcs\relocates\simple_example\relocates_simple.usd
Linux:
./scripts/usdview.sh ./composition_arcs/relocates/simple_example/relocates_simple.usd
In the tree view, expand
Worldand thenStreetLamp.
Notice that the child prim is called geometry, with pole and bulb beneath it.
Now open
composition_arcs/relocates/simple_example/lamp_asset.usdin Visual Studio Code.
The asset on disk has no prim called geometry. Its child is named lamp_grp_v2_FINAL. The name you saw in usdview is produced entirely by the relocate in relocates_simple.usd.
Open
composition_arcs/relocates/simple_example/relocates_simple.usdin Visual Studio Code and look at the layer metadata at the top:
1relocates = {
2 </World/StreetLamp/lamp_grp_v2_FINAL>: </World/StreetLamp/geometry>
3}
That single entry is doing all the work. The referenced asset is untouched.
Back in usdview, select the
geometryprim and open the Composition tab.
The composition index shows the reference arc that brought the prim in, alongside the relocate that renamed it.
Tip
Try editing the target path in relocates_simple.usd to something else, such as </World/StreetLamp/geo>, save, and reload usdview with File > Reload All Layers. The prim’s name in the tree view follows whatever you put on the right-hand side of the mapping.
Reparenting a Referenced Prim#
A relocate can also move a prim out of the subtree it arrived in.
In the terminal, run the code below to open the next file in usdview:
Windows:
.\scripts\usdview.bat .\composition_arcs\relocates\reparent_example\relocates_reparent.usd
Linux:
./scripts/usdview.sh ./composition_arcs/relocates/reparent_example/relocates_reparent.usd
In the tree view, expand
World.
District_01 carries the reference to block_asset.usd and contains office_tower and warehouse. But clock_tower — which is authored inside that same asset — appears under Landmarks instead.
Open
composition_arcs/relocates/reparent_example/block_asset.usdto confirm thatclock_towerreally is a sibling of the other two buildings in the source asset.
The relocate lifted it out of District_01 and grafted it under Landmarks, without editing the asset:
1relocates = {
2 </World/District_01/clock_tower>: </World/Landmarks/clock_tower>
3}
This is the pattern to reach for when an asset’s internal organization doesn’t match how your pipeline needs to group things downstream.