All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdModelAPI Class Reference

UsdModelAPI is an API schema that provides an interface to a prim's model qualities, if it does, in fact, represent the root prim of a model. More...

+ Inheritance diagram for UsdModelAPI:

Public Member Functions

 UsdModelAPI (const UsdPrim &prim=UsdPrim())
 Construct a UsdModelAPI on UsdPrim prim . More...
 
 UsdModelAPI (const UsdSchemaBase &schemaObj)
 Construct a UsdModelAPI on the prim held by schemaObj . More...
 
virtual USD_API ~UsdModelAPI ()
 Destructor. More...
 
Model Asset Info API

USD_API bool GetAssetIdentifier (SdfAssetPath *identifier) const
 Returns the model's asset identifier as authored in the composed assetInfo dictionary. More...
 
USD_API void SetAssetIdentifier (const SdfAssetPath &identifier) const
 Sets the model's asset identifier to the given asset path, identifier. More...
 
USD_API bool GetAssetName (std::string *assetName) const
 Returns the model's asset name from the composed assetInfo dictionary. More...
 
USD_API void SetAssetName (const std::string &assetName) const
 Sets the model's asset name to assetName. More...
 
USD_API bool GetAssetVersion (std::string *version) const
 Returns the model's resolved asset version. More...
 
USD_API void SetAssetVersion (const std::string &version) const
 Sets the model's asset version string. More...
 
USD_API bool GetPayloadAssetDependencies (VtArray< SdfAssetPath > *assetDeps) const
 Returns the list of asset dependencies referenced inside the payload of the model. More...
 
USD_API void SetPayloadAssetDependencies (const VtArray< SdfAssetPath > &assetDeps) const
 Sets the list of external asset dependencies referenced inside the payload of a model. More...
 
USD_API bool GetAssetInfo (VtDictionary *info) const
 Returns the model's composed assetInfo dictionary. More...
 
USD_API void SetAssetInfo (const VtDictionary &info) const
 Sets the model's assetInfo dictionary to info in the current edit target. More...
 
- Public Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 Construct a UsdAPISchemaBase on UsdPrim prim . More...
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 Construct a UsdAPISchemaBase on the prim held by schemaObj . More...
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor. More...
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 Returns whether or not this class corresponds to a concrete instantiable prim type in scene description. More...
 
bool IsTyped () const
 Returns whether or not this class inherits from UsdTyped. More...
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 Returns whether this is an applied API schema or not. More...
 
bool IsMultipleApplyAPISchema () const
 Returns whether this is an applied API schema or not. More...
 
UsdSchemaType GetSchemaType () const
 
USD_API UsdSchemaBase (const UsdPrim &prim=UsdPrim())
 Construct and store prim as the held prim. More...
 
USD_API UsdSchemaBase (const UsdSchemaBase &otherSchema)
 Construct and store for the same prim held by otherSchema. More...
 
virtual USD_API ~UsdSchemaBase ()
 Destructor. More...
 
USD_API operator bool () const
 Return true if this schema object is compatible with its held prim, false otherwise. More...
 
UsdPrim GetPrim () const
 Return this schema object's held prim. More...
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath(). More...
 
USD_API SdfPrimSpecHandle GetSchemaClassPrimDefinition () const
 Return the prim definition associated with this schema instance if one exists, otherwise return null. More...
 

Static Public Member Functions

static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. More...
 
static USD_API UsdModelAPI Get (const UsdStagePtr &stage, const SdfPath &path)
 Return a UsdModelAPI holding the prim adhering to this schema at path on stage. More...
 
- Static Public Member Functions inherited from UsdAPISchemaBase
static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. More...
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI
 Compile time constant representing what kind of schema this class is. More...
 
- Static Public Attributes inherited from UsdAPISchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 Compile time constant representing what kind of schema this class is. More...
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 Compile time constant representing what kind of schema this class is. More...
 

Protected Member Functions

USD_API UsdSchemaType _GetSchemaType () const override
 Returns the type of schema this class belongs to. More...
 
template<typename T >
bool _GetAssetInfoByKey (const TfToken &key, T *val) const
 
- Protected Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim with the specified instanceName. More...
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj with the given instanceName. More...
 
const TfToken_GetInstanceName () const
 Returns the instance name of the API schema object belonging to a multiple-apply API schema. More...
 
USD_API bool _IsCompatible () const override
 Check whether this APISchema object is valid for the currently held prim. More...
 
- Protected Member Functions inherited from UsdSchemaBase
const TfType_GetType () const
 
USD_API UsdAttribute _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
 

Friends

class UsdSchemaRegistry
 

Kind and Model-ness

enum  KindValidation { KindValidationNone, KindValidationModelHierarchy }
 Option for validating queries to a prim's kind metadata. More...
 
USD_API bool GetKind (TfToken *kind) const
 Retrieve the authored kind for this prim. More...
 
USD_API bool SetKind (const TfToken &kind)
 Author a kind for this prim, at the current UsdEditTarget. More...
 
USD_API bool IsKind (const TfToken &baseKind, KindValidation validation=KindValidationModelHierarchy) const
 Return true if the prim's kind metadata is or inherits from baseKind as defined by the Kind Registry. More...
 
USD_API bool IsModel () const
 Return true if this prim represents a model, based on its kind metadata. More...
 
USD_API bool IsGroup () const
 Return true if this prim represents a model group, based on its kind metadata. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from UsdAPISchemaBase
template<typename APISchemaType >
static APISchemaType _ApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName)
 Helper method to apply a single-apply API schema with the given schema name apiSchemaName' and C++ type 'APISchemaType'. More...
 
template<typename APISchemaType >
static APISchemaType _MultipleApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName, const TfToken &instanceName)
 Helper method to apply a multiple-apply API schema with the given schema name apiSchemaName', C++ type 'APISchemaType' and instance name instanceName. More...
 

Detailed Description

UsdModelAPI is an API schema that provides an interface to a prim's model qualities, if it does, in fact, represent the root prim of a model.

The first and foremost model quality is its kind, i.e. the metadata that establishes it as a model (See KindRegistry). UsdModelAPI provides various methods for setting and querying the prim's kind, as well as queries (also available on UsdPrim) for asking what category of model the prim is. See Kind and Model-ness.

UsdModelAPI also provides access to a prim's assetInfo data. While any prim can host assetInfo, it is common that published (referenced) assets are packaged as models, therefore it is convenient to provide access to the one from the other.

Definition at line 72 of file modelAPI.h.

Member Enumeration Documentation

Option for validating queries to a prim's kind metadata.

See Also
IsKind()

Definition at line 161 of file modelAPI.h.

Constructor & Destructor Documentation

UsdModelAPI ( const UsdPrim prim = UsdPrim())
inlineexplicit

Construct a UsdModelAPI on UsdPrim prim .

Equivalent to UsdModelAPI::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim

Definition at line 84 of file modelAPI.h.

UsdModelAPI ( const UsdSchemaBase schemaObj)
inlineexplicit

Construct a UsdModelAPI on the prim held by schemaObj .

Should be preferred over UsdModelAPI(schemaObj.GetPrim()), as it preserves SchemaBase state.

Definition at line 92 of file modelAPI.h.

virtual USD_API ~UsdModelAPI ( )
virtual

Destructor.

Member Function Documentation

USD_API UsdSchemaType _GetSchemaType ( ) const
overrideprotectedvirtual

Returns the type of schema this class belongs to.

See Also
UsdSchemaType

Reimplemented from UsdAPISchemaBase.

static USD_API UsdModelAPI Get ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Return a UsdModelAPI holding the prim adhering to this schema at path on stage.

If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:

* UsdModelAPI(stage->GetPrimAtPath(path));
*
USD_API bool GetAssetIdentifier ( SdfAssetPath identifier) const

Returns the model's asset identifier as authored in the composed assetInfo dictionary.

The asset identifier can be used to resolve the model's root layer via the asset resolver plugin.

USD_API bool GetAssetInfo ( VtDictionary info) const

Returns the model's composed assetInfo dictionary.

The asset info dictionary is used to annotate models with various data related to asset management. For example, asset name, identifier, version etc.

The elements of this dictionary are composed element-wise, and are nestable.

USD_API bool GetAssetName ( std::string *  assetName) const

Returns the model's asset name from the composed assetInfo dictionary.

The asset name is the name of the asset, as would be used in a database query.

USD_API bool GetAssetVersion ( std::string *  version) const

Returns the model's resolved asset version.

If you publish assets with an embedded version, then you may receive that version string. You may, however, cause your authoring tools to record the resolved version at the time at which a reference to the asset was added to an aggregate, at the referencing site. In such a pipeline, this API will always return that stronger opinion, even if the asset is republished with a newer version, and even though that newer version may be the one that is resolved when the UsdStage is opened.

USD_API bool GetKind ( TfToken kind) const

Retrieve the authored kind for this prim.

To test whether the returned kind matches a particular known "clientKind":

* TfToken kind;
*
* bool isClientKind = UsdModelAPI(prim).GetKind(&kind) and
* KindRegistry::IsA(kind, clientKind);
*
Returns
true if there was an authored kind that was successfully read, otherwise false.
See Also
The Kind module for further details on how to use Kind for classification, and how to extend the taxonomy.
USD_API bool GetPayloadAssetDependencies ( VtArray< SdfAssetPath > *  assetDeps) const

Returns the list of asset dependencies referenced inside the payload of the model.

This typically contains identifiers of external assets that are referenced inside the model's payload. When the model is created, this list is compiled and set at the root of the model. This enables efficient dependency analysis without the need to include the model's payload.

static USD_API const TfTokenVector& GetSchemaAttributeNames ( bool  includeInherited = true)
static

Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.

Does not include attributes that may be authored by custom/extended methods of the schemas involved.

USD_API bool IsGroup ( ) const

Return true if this prim represents a model group, based on its kind metadata.

USD_API bool IsKind ( const TfToken baseKind,
KindValidation  validation = KindValidationModelHierarchy 
) const

Return true if the prim's kind metadata is or inherits from baseKind as defined by the Kind Registry.

If validation is KindValidationModelHierarchy (the default), then this also ensures that if baseKind is a model, the prim conforms to the rules of model hierarchy, as defined by IsModel. If set to KindValidationNone, no additional validation is done.

IsModel and IsGroup are preferrable to IsKind("model") as they are optimized for fast traversal.

Note
If a prim's model hierarchy is not valid, it is possible that that prim.IsModel() and prim.IsKind("model", Usd.ModelAPI.KindValidationNone) return different answers. (As a corallary, this is also true for for prim.IsGroup())
USD_API bool IsModel ( ) const

Return true if this prim represents a model, based on its kind metadata.

USD_API void SetAssetIdentifier ( const SdfAssetPath identifier) const

Sets the model's asset identifier to the given asset path, identifier.

See Also
GetAssetIdentifier()
USD_API void SetAssetInfo ( const VtDictionary info) const

Sets the model's assetInfo dictionary to info in the current edit target.

USD_API void SetAssetName ( const std::string &  assetName) const

Sets the model's asset name to assetName.

See Also
GetAssetName()
USD_API void SetAssetVersion ( const std::string &  version) const

Sets the model's asset version string.

See Also
GetAssetVersion()
USD_API bool SetKind ( const TfToken kind)

Author a kind for this prim, at the current UsdEditTarget.

Returns
true if kind was successully authored, otherwise false.
USD_API void SetPayloadAssetDependencies ( const VtArray< SdfAssetPath > &  assetDeps) const

Sets the list of external asset dependencies referenced inside the payload of a model.

See Also
GetPayloadAssetDependencies()

Member Data Documentation

const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI
static

Compile time constant representing what kind of schema this class is.

See Also
UsdSchemaType

Definition at line 78 of file modelAPI.h.


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