Skip to content

writing example of authoring variants with reference#57

Merged
mxpv merged 6 commits intomxpv:mainfrom
ankmachine:write_variant_example
Apr 25, 2026
Merged

writing example of authoring variants with reference#57
mxpv merged 6 commits intomxpv:mainfrom
ankmachine:write_variant_example

Conversation

@ankmachine
Copy link
Copy Markdown
Contributor

@ankmachine ankmachine commented Apr 24, 2026

FIxed the bug for #58

VariantSetNames and variantSelection are store under internal names that differ from the USD text grammar keywords.

Also, writing of example of how to author variants which are referencing different prim from another usda file. In this case scene.usda is referencing prims "/BlueSphere", "/GreenSphere", "/RedSphere" from sphere.usda

run code

cargo run --example author_variant_and_reference

scene.usda

#usda 1.0
(
    defaultPrim = "ColoredSphere"
)

def "ColoredSphere" (
    prepend variantSets = "color"
    variants = { string "color" = "blue" }
)
{
    variantSet "color" = {
        "blue" (
            prepend references = @./sphere.usda@
        ) {
        }
        "green" (
            prepend references = @./sphere.usda@</GreenSphere>
        ) {
        }
        "red" (
            prepend references = @./sphere.usda@</RedSphere>
        ) {
        }
    }
}

sphere.usda

#usda 1.0
(
    defaultPrim = "BlueSphere"
)

def Sphere "BlueSphere"
{
    color3f[] primvars:displayColor = [(0.0, 0.0, 1.0)]
}

def Sphere "GreenSphere"
{
    color3f[] primvars:displayColor = [(0.0, 1.0, 0.0)]
}

def Sphere "RedSphere"
{
    color3f[] primvars:displayColor = [(1.0, 0.0, 0.0)]
}

@ankmachine ankmachine marked this pull request as ready for review April 24, 2026 12:08
ankmachine and others added 2 commits April 25, 2026 11:36
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv
Copy link
Copy Markdown
Owner

mxpv commented Apr 25, 2026

Thanks!

@mxpv mxpv merged commit a82baf0 into mxpv:main Apr 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants