Loading...
Searching...
No Matches
UsdPrimDefinition::Attribute Class Reference

Accessor to a attribute's definition in the prim definition. More...

#include <primDefinition.h>

+ Inheritance diagram for UsdPrimDefinition::Attribute:

Public Member Functions

 Attribute ()=default
 Default constructor returns an invalid attribute.
 
USD_API Attribute (const Property &property)
 Copy constructor from a Property to allow implicit conversion.
 
USD_API Attribute (Property &&property)
 Move constructor from a Property to allow implicit conversion.
 
 operator bool () const
 Conversion to bool returns true if this represents a valid property in the prim definition that is an attribute, and false otherwise.
 
Field Access Methods

These methods help get values for additional fields defined on a attribute in a prim definition.

None of the data access methods check that the attribute is valid before trying to access the attribute. I.e. they all assume the attribute is already known to be valid when called.

Client code is on the hook for verifying the validity of the Attribute before calling any of these methods. The validity can be determined by converting the Attribute to bool.

USD_API SdfValueTypeName GetTypeName () const
 Returns the value type name of this attribute in the prim definition.
 
USD_API TfToken GetTypeNameToken () const
 Returns the token value of the type name of this attribute in the prim definition.
 
template<class T >
bool GetFallbackValue (T *value) const
 Retrieves the fallback value of type T for this attribute and stores it in value if possible.
 
- Public Member Functions inherited from UsdPrimDefinition::Property
 Property ()=default
 Default constructor returns an invalid property.
 
USD_API const TfTokenGetName () const
 Returns the name of the requested property.
 
 operator bool () const
 Conversion to bool returns true if this represents a valid property in the prim definition, and false otherwise.
 
USD_API bool IsAttribute () const
 Return true if the property is a valid is a valid property in the prim definition and is an attribute.
 
USD_API bool IsRelationship () const
 Return true if the property is a valid is a valid property in the prim definition and is a relationship.
 
USD_API SdfSpecType GetSpecType () const
 Returns the spec type of this property in the prim definition.
 
USD_API TfTokenVector ListMetadataFields () const
 Returns the list of names of metadata fields that are defined for this property in the prim definition.
 
template<class T >
bool GetMetadata (const TfToken &key, T *value) const
 Retrieves the fallback value for the metadata field named key, that is defined for this property in the prim definition, and stores it in value if possible.
 
template<class T >
bool GetMetadataByDictKey (const TfToken &key, const TfToken &keyPath, T *value) const
 Retrieves the value at keyPath from the dictionary value for the dictionary metadata field named key, that is defined for this property in the prim definition, and stores it in value if possible.
 
USD_API SdfVariability GetVariability () const
 Returns the variability of this property in the prim definition.
 
USD_API std::string GetDocumentation () const
 Returns the documentation metadata defined by the prim definition for this property.
 

Additional Inherited Members

- Protected Member Functions inherited from UsdPrimDefinition::Property
 Property (const TfToken &name, const _LayerAndPath *layerAndPath)
 
 Property (const _LayerAndPath *layerAndPath)
 
- Protected Attributes inherited from UsdPrimDefinition::Property
TfToken _name
 
const _LayerAndPath * _layerAndPath = nullptr
 

Detailed Description

Accessor to a attribute's definition in the prim definition.

These are returned by calls to UsdPrimDefinition::GetAttributeDefinition and can be freely converted to from a Property accessor. These can be used to check that a property exists and is an attribute (via conversion to bool) and to get attribute relevant field values that are defined for a property in the prim definition.

This class is just a thin wrapper around the property representation in the UsdPrimDefinition that creates it and cannot be stored or accessed beyond the lifetime of the prim definition itself.

Definition at line 183 of file primDefinition.h.

Constructor & Destructor Documentation

◆ Attribute() [1/3]

Attribute ( )
default

Default constructor returns an invalid attribute.

◆ Attribute() [2/3]

USD_API Attribute ( const Property property)

Copy constructor from a Property to allow implicit conversion.

◆ Attribute() [3/3]

USD_API Attribute ( Property &&  property)

Move constructor from a Property to allow implicit conversion.

Member Function Documentation

◆ GetFallbackValue()

bool GetFallbackValue ( T *  value) const

Retrieves the fallback value of type T for this attribute and stores it in value if possible.

Returns true if this attribute has a fallback value defined with the expected type. Returns false otherwise.

Definition at line 653 of file primDefinition.h.

◆ GetTypeName()

USD_API SdfValueTypeName GetTypeName ( ) const

Returns the value type name of this attribute in the prim definition.

◆ GetTypeNameToken()

USD_API TfToken GetTypeNameToken ( ) const

Returns the token value of the type name of this attribute in the prim definition.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Conversion to bool returns true if this represents a valid property in the prim definition that is an attribute, and false otherwise.

Definition at line 198 of file primDefinition.h.


The documentation for this class was generated from the following file: