Skip to content

in Usd version 22.11 Usd.PrimDefinition doesn't have a method called GetAttributeDefinition #4303

@daniele-niero

Description

@daniele-niero

I'm using MayaUsd version 0.33.0 with Maya 2024.
This version uses USD version 22.11.
In this version of USD Usd.PrimDefinition doesn't have the GetAttributeDefinition method, it was introduced later (from version 23, maybe)

If I have a codeless schema applied to a prim, the attribute editor will report this error when I click on it:

AttributeError: file ...\Maya2024\0.33.0\MayaUSD\lib\python\ufe_ae\usd\nodes\usdschemabase\ae_template.py line 566: 'PrimDefinition' object has no attribute 'GetAttributeDefinition'

and display a "broken" widget (an attribute editor UI that is not useful and doesn't include all the elements that it is supposed to include)

The part of the code that lead to this problem is this:

    ...
        if schemaType.pythonClass:
            ...
        else:
                schemaPrimDef   = Usd.SchemaRegistry().FindAppliedAPIPrimDefinition(typeName)
                attrList = schemaPrimDef.GetPropertyNames()
                attrList = [name for name in attrList if schemaPrimDef.GetAttributeDefinition(name)]

                if isMultipleApplyAPISchema:
                    instanceName = typeAndInstance[1]
                    attrList = [name.replace('__INSTANCE_NAME__', instanceName) for name in attrList]
                schemasAttributes[typeName] = attrList

and it should be replaced by something like this

    ...
        if schemaType.pythonClass:
            ...
        else:
                schemaPrimDef   = Usd.SchemaRegistry().FindAppliedAPIPrimDefinition(typeName)
                attrList = schemaPrimDef.GetPropertyNames()
                if usdVer > (0, 22, 11):
                    attrList = [name for name in attrList if schemaPrimDef.GetAttributeDefinition(name)]

                if isMultipleApplyAPISchema:
                    instanceName = typeAndInstance[1]
                    attrList = [name.replace('__INSTANCE_NAME__', instanceName) for name in attrList]
                schemasAttributes[typeName] = attrList

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions