PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.12k stars 1.22k forks source link

usdchecker: Warn when dropping data due to downcasted/mismatched prim types #2882

Open hybridherbst opened 10 months ago

hybridherbst commented 10 months ago

Description of Issue

I was struggling with some composition issues today. Based on help in the usd-wg Slack, I was able to figure out what was going on: referencing data with a type that did not match the type of the prim I was referencing it from effectively discarded all that data, since the referencing prim type "won".

I think usdchecker should warn if data is dropped in that way; I'm not sure if there would be valid scenarios for intentionally dropping it.

Steps to Reproduce

See these two files:

Basically, in this structure:

def "Thing"
{

    def Mesh "Geometry" 
    {
        # ...
    }
}

over "AnotherThing" (
    prepend references = </Thing/Geometry>
)
{
    # ...
}

And another file:

def Xform "Quad" (
    prepend references = @./Quad.usd@</AnotherThing>
)
{
    # ...
}

my understanding is that "AnotherThing" ends up being a "Mesh", but "Quad" ends up staying an Xform – it will have all the right data referenced to it, but since it's an Xform and not a Mesh it effectively discards it.

The solution I think is to specify the type in advance, so that it ends up being a mesh:

def Mesh "Quad" (
    prepend references = @./Quad.usd@</AnotherThing>
)
{
}

So I would kind of expect usdchecker to warn me "Hey, you are referencing a Mesh onto your Xform here, that wont work". It's not an error since the result is technically valid, but I think a warning would be good.

jesschimein commented 10 months ago

Filed as internal issue #USD-9109