How do you author opinions inside one variant of a variant set using the Python API?
- 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
Use the variant set's GetVariantEditContext() as a context manager after selecting the variant
GetVariantEditContext() switches the edit target into the selected variant. Without it, edits land outside the variant.
Remember: Use the variant edit context.
How it works
Variant authoring requires targeting the variant explicitly.
In detail
- Select, then enter the edit context.
- Edits outside the context are not in the variant.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Use the variant set's GetVariantEditContext() as a context manager after selecting the variantRight
Use the variant edit context.
B. Write to an attribute named after the variantWrong
Variants are not attributes.
C. Variants cannot be edited after they are createdWrong
Variants can be edited anytime.
D. Set the variant selection and then edit normally, because edits always land in the selected variantWrongMost tempting
Edits go to the current edit target, not the variant.
Why it tempts: Selecting a variant feels like entering it.
Use case
An illustrative scenario, not a real incident.
Illustrative: a script fills a "lod" variant set with high and low meshes inside each variant's edit context.
See it in different ways
stateDiagram-v2 state "Edit target layer" as s0 state "Variant selected" as s1 state "Edit target variant" as s2 [*] --> s0 s0 --> s1: SetVariantSelection s1 --> s2: enter GetVariantEditContext s2 --> s0: exit context
How to read this chart
- It starts at "Edit target layer".
- From "Edit target layer", "SetVariantSelection" moves it to "Variant selected".
- From "Variant selected", "enter GetVariantEditContext" moves it to "Edit target variant".
- From "Edit target variant", "exit context" moves it to "Edit target layer".
flowchart LR S0["AddVariantSet"] --> S1["AddVariant"] --> S2["SetVariantSelection"] --> S3["GetVariantEditContext"] --> S4["Author"]
How to read this chart
- Read it in order: AddVariantSet, then AddVariant, then SetVariantSelection, then GetVariantEditContext, then Author.