UsdPrimDefinition Class Reference

Class representing the builtin definition of a prim given the schemas registered in the schema registry. More...

Public Member Functions

const TfTokenVectorGetPropertyNames () const
 Return the list of names of builtin properties for this prim definition. More...
 
const TfTokenVectorGetAppliedAPISchemas () const
 Return the list of names of the API schemas that have been applied to this prim definition in order. More...
 
SdfSpecType GetSpecType (const TfToken &propName) const
 Return the SdfSpecType for propName if it is a builtin property of the prim type represented by this prim definition. More...
 
SdfPropertySpecHandle GetSchemaPropertySpec (const TfToken &propName) const
 Return the property spec that defines the fallback for the property named propName on prims of this prim definition's type. More...
 
SdfAttributeSpecHandle GetSchemaAttributeSpec (const TfToken &attrName) const
 This is a convenience method. More...
 
SdfRelationshipSpecHandle GetSchemaRelationshipSpec (const TfToken &relName) const
 This is a convenience method. More...
 
template<class T >
bool GetAttributeFallbackValue (const TfToken &attrName, T *value) const
 Retrieves the fallback value for the attribute named attrName and stores it in value if possible. More...
 
TfTokenVector ListMetadataFields () const
 Returns the list of names of metadata fields that are defined by this prim definition for the prim itself. More...
 
template<class T >
bool GetMetadata (const TfToken &key, T *value) const
 Retrieves the fallback value for the metadata field named key, that is defined by this prim definition for the prim itself and stores it in value if possible. More...
 
template<class T >
bool GetMetadataByDictKey (const TfToken &key, const TfToken &keyPath, T *value) const
 Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field named key, that is defined by this prim definition for the prim itself, and stores it in value if possible. More...
 
USD_API std::string GetDocumentation () const
 Returns the documentation metadata defined by the prim definition for the prim itself. More...
 
TfTokenVector ListPropertyMetadataFields (const TfToken &propName) const
 Returns the list of names of metadata fields that are defined by this prim definition for property propName if a property named propName exists. More...
 
template<class T >
bool GetPropertyMetadata (const TfToken &propName, const TfToken &key, T *value) const
 Retrieves the fallback value for the metadata field named key, that is defined by this prim definition for the property named propName, and stores it in value if possible. More...
 
template<class T >
bool GetPropertyMetadataByDictKey (const TfToken &propName, const TfToken &key, const TfToken &keyPath, T *value) const
 Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field named key, that is defined by this prim definition for the property named propName, and stores it in value if possible. More...
 
USD_API std::string GetPropertyDocumentation (const TfToken &propName) const
 Returns the documentation metadata defined by the prim definition for the property named propName if it exists. More...
 
USD_API bool FlattenTo (const SdfLayerHandle &layer, const SdfPath &path, SdfSpecifier newSpecSpecifier=SdfSpecifierOver) const
 Copies the contents of this prim definition to a prim spec on the given layer at the given path. More...
 
USD_API UsdPrim FlattenTo (const UsdPrim &parent, const TfToken &name, SdfSpecifier newSpecSpecifier=SdfSpecifierOver) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Copies the contents of this prim definition to a prim spec at the current edit target for a prim with the given name under the prim parent. More...
 
USD_API UsdPrim FlattenTo (const UsdPrim &prim, SdfSpecifier newSpecSpecifier=SdfSpecifierOver) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Copies the contents of this prim definition to a prim spec at the current edit target for the given prim. More...
 

Friends

class UsdSchemaRegistry
 

Detailed Description

Class representing the builtin definition of a prim given the schemas registered in the schema registry.

It provides access to the the builtin properties and metadata of a prim whose type is defined by this definition.

Instances of this class can only be created by the UsdSchemaRegistry.

Definition at line 47 of file primDefinition.h.

Member Function Documentation

◆ FlattenTo() [1/3]

USD_API bool FlattenTo ( const SdfLayerHandle &  layer,
const SdfPath path,
SdfSpecifier  newSpecSpecifier = SdfSpecifierOver 
) const

Copies the contents of this prim definition to a prim spec on the given layer at the given path.

This includes the entire property spec for each of this definition's built-in properties as well as all of this definition's prim metadata.

If the prim definition represents a concrete prim type, the type name of the prim spec is set to the the type name of this prim definition. Otherwise the type name is set to empty. The 'apiSchemas' metadata on the prim spec will always be explicitly set to the combined list of all API schemas applied to this prim definition, i.e. the list returned by UsdPrimDefinition::GetAppliedAPISchemas. Note that if this prim definition is an API schema prim definition (see UsdSchemaRegistry::FindAppliedAPIPrimDefinition) then 'apiSchemas' will be empty as this prim definition does not "have" an applied API because instead it "is" an applied API.

If there is no prim spec at the given path, a new prim spec is created at that path with the specifier newSpecSpecifier. Any necessary ancestor specs will be created as well but they will always be created as overs. If a spec does exist at path, then all of its properties and schema allowed metadata are cleared before it is populated from the prim definition.

◆ FlattenTo() [2/3]

USD_API UsdPrim FlattenTo ( const UsdPrim parent,
const TfToken name,
SdfSpecifier  newSpecSpecifier = SdfSpecifierOver 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Copies the contents of this prim definition to a prim spec at the current edit target for a prim with the given name under the prim parent.

◆ FlattenTo() [3/3]

USD_API UsdPrim FlattenTo ( const UsdPrim prim,
SdfSpecifier  newSpecSpecifier = SdfSpecifierOver 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Copies the contents of this prim definition to a prim spec at the current edit target for the given prim.

◆ GetAppliedAPISchemas()

const TfTokenVector& GetAppliedAPISchemas ( ) const
inline

Return the list of names of the API schemas that have been applied to this prim definition in order.

Definition at line 57 of file primDefinition.h.

◆ GetAttributeFallbackValue()

bool GetAttributeFallbackValue ( const TfToken attrName,
T *  value 
) const
inline

Retrieves the fallback value for the attribute named attrName and stores it in value if possible.

Returns true if the attribute exists in this prim definition and it has a fallback value defined. Returns false otherwise.

Definition at line 111 of file primDefinition.h.

◆ GetDocumentation()

USD_API std::string GetDocumentation ( ) const

Returns the documentation metadata defined by the prim definition for the prim itself.

◆ GetMetadata()

bool GetMetadata ( const TfToken key,
T *  value 
) const
inline

Retrieves the fallback value for the metadata field named key, that is defined by this prim definition for the prim itself and stores it in value if possible.

Returns true if a fallback value is defined for the given metadata key. Returns false otherwise.

Definition at line 130 of file primDefinition.h.

◆ GetMetadataByDictKey()

bool GetMetadataByDictKey ( const TfToken key,
const TfToken keyPath,
T *  value 
) const
inline

Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field named key, that is defined by this prim definition for the prim itself, and stores it in value if possible.

Returns true if a fallback dictionary value is defined for the given metadata key and it contains a value at keyPath. Returns false otherwise.

Definition at line 147 of file primDefinition.h.

◆ GetPropertyDocumentation()

USD_API std::string GetPropertyDocumentation ( const TfToken propName) const

Returns the documentation metadata defined by the prim definition for the property named propName if it exists.

◆ GetPropertyMetadata()

bool GetPropertyMetadata ( const TfToken propName,
const TfToken key,
T *  value 
) const
inline

Retrieves the fallback value for the metadata field named key, that is defined by this prim definition for the property named propName, and stores it in value if possible.

Returns true if a fallback value is defined for the given metadata key for the named property. Returns false otherwise.

Definition at line 177 of file primDefinition.h.

◆ GetPropertyMetadataByDictKey()

bool GetPropertyMetadataByDictKey ( const TfToken propName,
const TfToken key,
const TfToken keyPath,
T *  value 
) const
inline

Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field named key, that is defined by this prim definition for the property named propName, and stores it in value if possible.

Returns true if a fallback dictionary value is defined for the given metadata key for the named property and it contains a value at keyPath. Returns false otherwise.

Definition at line 195 of file primDefinition.h.

◆ GetPropertyNames()

const TfTokenVector& GetPropertyNames ( ) const
inline

Return the list of names of builtin properties for this prim definition.

Definition at line 53 of file primDefinition.h.

◆ GetSchemaAttributeSpec()

SdfAttributeSpecHandle GetSchemaAttributeSpec ( const TfToken attrName) const
inline

This is a convenience method.

It is shorthand for TfDynamic_cast<SdfAttributeSpecHandle>( GetSchemaPropertySpec(primType, attrName));

Definition at line 86 of file primDefinition.h.

◆ GetSchemaPropertySpec()

SdfPropertySpecHandle GetSchemaPropertySpec ( const TfToken propName) const
inline

Return the property spec that defines the fallback for the property named propName on prims of this prim definition's type.

Return null if there is no such property spec.

Definition at line 75 of file primDefinition.h.

◆ GetSchemaRelationshipSpec()

SdfRelationshipSpecHandle GetSchemaRelationshipSpec ( const TfToken relName) const
inline

This is a convenience method.

It is shorthand for TfDynamic_cast<SdfRelationshipSpecHandle>( GetSchemaPropertySpec(primType, relName));

Definition at line 97 of file primDefinition.h.

◆ GetSpecType()

SdfSpecType GetSpecType ( const TfToken propName) const
inline

Return the SdfSpecType for propName if it is a builtin property of the prim type represented by this prim definition.

Otherwise return SdfSpecTypeUnknown.

Definition at line 64 of file primDefinition.h.

◆ ListMetadataFields()

TfTokenVector ListMetadataFields ( ) const
inline

Returns the list of names of metadata fields that are defined by this prim definition for the prim itself.

Definition at line 118 of file primDefinition.h.

◆ ListPropertyMetadataFields()

TfTokenVector ListPropertyMetadataFields ( const TfToken propName) const
inline

Returns the list of names of metadata fields that are defined by this prim definition for property propName if a property named propName exists.

Definition at line 164 of file primDefinition.h.


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