Two engineers can open the same OpenUSD fixture and review different locator geometry. A session-level selection may show the flat stop while the asset itself carries a V-block selection. Before recording a clearance result, check which variant the consumer has composed and confirm that its expected parts are present.
A variant set provides named alternatives on a prim. The list of available names does not tell you which one is selected. GetVariantSelection reports the composed selection, while the children visible under the prim show the structure that the selection contributed. Check both when the variants are expected to add or remove specific parts.
Test a temporary setup change
This Python example defines alternative locator children on a fixture. The root layer selects vBlock. A session-layer edit then selects flatStop for the current stage and clears that selection to reveal the root opinion again.
from pxr import Usd
stage = Usd.Stage.CreateInMemory()
fixture = stage.DefinePrim("/Fixture", "Xform")
setup = fixture.GetVariantSets().AddVariantSet("setup")
for name, child in (("vBlock", "VBlock"), ("flatStop", "FlatStop")):
assert setup.AddVariant(name)
assert setup.SetVariantSelection(name)
with setup.GetVariantEditContext():
stage.DefinePrim("/Fixture/" + child, "Xform")
assert setup.SetVariantSelection("vBlock")
def active_setup():
return setup.GetVariantSelection(), [
child.GetName() for child in fixture.GetChildren()
]
assert active_setup() == ("vBlock", ["VBlock"])
root_before = stage.GetRootLayer().ExportToString()
with Usd.EditContext(stage, stage.GetSessionLayer()):
assert setup.SetVariantSelection("flatStop")
assert active_setup() == ("flatStop", ["FlatStop"])
assert setup.ClearVariantSelection()
assert active_setup() == ("vBlock", ["VBlock"])
assert stage.GetRootLayer().ExportToString() == root_before
print(active_setup())
The assertions pass in OpenUSD 0.26.11. The composed child changes from VBlock to FlatStop while the session selection is active. Clearing that opinion brings VBlock back, and the serialized root layer matches its original form. The example uses transform prims as stand-ins, so it checks composition without requiring detailed fixture geometry.
The edit context determines where the selection is written. Leaving a session-layer edit context restores the previous edit target. It does not undo selection opinions written into the session layer. Clear the temporary opinion in that layer when the comparison is over, or inspect a separate review stage.
Make the result reproducible
In a workcell review, record the asset revision, the fixture prim path and the variant set name before measuring anything. Record the composed selection and a distinguishing feature such as the expected locator path. If variants preserve the same prim paths, compare a property that actually differs between configurations, such as a mesh reference or a measured dimension.
When reviewers disagree, compare the edit targets and stage composition they used, including any session-layer overrides. Compare like-for-like selections in the same asset revision and repeat the measurement. If the selected name agrees while the expected locator still differs, inspect the composed locator itself for other layer opinions before attributing the discrepancy to the variant.
Sources
OpenUSD UsdVariantSet API reference, composed selection and edit context
https://openusd.org/release/api/class_usd_variant_set.html
OpenUSD UsdStage API reference, stage edit targets and session layers
https://openusd.org/release/api/class_usd_stage.html