In Python, which call adds a reference from the prim /World/Chair to the defaultPrim of chair.usd?
- Exam domain
- Composition23% of the exam
- Difficulty
- Medium
- In this mock
- 11 questions on this domainPractise this domain
Why the exam asks this
Objective in the exam guide: Author, design with, and debug composition arcs.
Authoring composition arcs is named.
Why A is the answer
stage.DefinePrim("/World/Chair").GetReferences().AddReference("chair.usd")
References are edited through the prim's UsdReferences object. AddReference with only an asset path targets that layer's defaultPrim.
Remember: Use GetReferences().AddReference().
How it works
Composition arcs are authored through UsdPrim helper objects such as UsdReferences.
In detail
- GetReferences().AddReference(assetPath).
- No prim path means the defaultPrim.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. stage.DefinePrim("/World/Chair").GetReferences().AddReference("chair.usd")Right
Use GetReferences().AddReference().
B. Sdf.Layer.FindOrOpen("chair.usd").Reference("/World/Chair")Wrong
Sdf.Layer has no Reference method.
C. Usd.Stage.Open("chair.usd").Import("/World/Chair")Wrong
Stages have no Import method.
D. stage.DefinePrim("/World/Chair").GetAttribute("references").Set("chair.usd") on the default layerWrongMost tempting
References are composition metadata, not an attribute.
Why it tempts: References look like a property in .usda text, but they are metadata.
Use case
An illustrative scenario, not a real incident.
Illustrative: a layout script places 40 chairs by defining prims and adding the same reference to each.
See it in different ways
sequenceDiagram participant P0 as Script participant P1 as UsdReferences participant P2 as Edit target layer P0->>P1: AddReference chair.usd P1->>P2: write references list op
How to read this chart
- 1. Script sends "AddReference chair.usd" to UsdReferences.
- 2. UsdReferences sends "write references list op" to Edit target layer.
mindmap
root(("Composition arcs"))
n1["Sublayers"]
n2["Stack layers"]
n3["Department workstreams"]
n4["Inherits"]
n5["Broadcast edits from a class"]
n6["Variant sets"]
n7["Switchable alternatives"]
n8["References"]
n9["Bring in assets"]
n10["Payloads"]
n11["Deferred loading"]
n12["Specializes"]
n13["Weakest defaults"]How to read this chart
- The centre is "Composition arcs".
- "Sublayers" covers "Stack layers", "Department workstreams".
- "Inherits" covers "Broadcast edits from a class".
- "Variant sets" covers "Switchable alternatives".
- "References" covers "Bring in assets".
- "Payloads" covers "Deferred loading".
- "Specializes" covers "Weakest defaults".