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

#include <modelAPI.h>

+ Inheritance diagram for UsdModelAPI:

Public Member Functions

 UsdModelAPI (const UsdPrim &prim=UsdPrim())
 
 UsdModelAPI (const UsdSchemaBase &schemaObj)
 
virtual USD_API ~UsdModelAPI ()
 Destructor. More...
 
Model Asset Info API

USD_API bool GetAssetIdentifier (SdfAssetPath *identifier) const
 
USD_API void SetAssetIdentifier (const SdfAssetPath &identifier) const
 
USD_API bool GetAssetName (std::string *assetName) const
 
USD_API void SetAssetName (const std::string &assetName) const
 
USD_API bool GetAssetVersion (std::string *version) const
 
USD_API void SetAssetVersion (const std::string &version) const
 
USD_API bool GetPayloadAssetDependencies (VtArray< SdfAssetPath > *assetDeps) const
 
USD_API void SetPayloadAssetDependencies (const VtArray< SdfAssetPath > &assetDeps) const
 
USD_API bool GetAssetInfo (VtDictionary *info) const
 
USD_API void SetAssetInfo (const VtDictionary &info) const
 
- Public Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor. More...
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 
bool IsTyped () const
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 
bool IsMultipleApplyAPISchema () const
 
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
 
UsdPrim GetPrim () const
 Return this schema object's held prim. More...
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath(). More...
 
USD_API SdfPrimSpecHandle GetSchemaClassPrimDefinition () const
 

Static Public Member Functions

static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USD_API UsdModelAPI Get (const UsdStagePtr &stage, const SdfPath &path)
 
- Static Public Member Functions inherited from UsdAPISchemaBase
static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI
 
- Static Public Attributes inherited from UsdAPISchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 

Protected Member Functions

USD_API UsdSchemaType _GetSchemaType () const override
 
template<typename T >
bool _GetAssetInfoByKey (const TfToken &key, T *val) const
 
- Protected Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName)
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName)
 
const TfToken_GetInstanceName () const
 
USD_API bool _IsCompatible () const override
 
- 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 }
 
USD_API bool GetKind (TfToken *kind) const
 
USD_API bool SetKind (const TfToken &kind)
 
USD_API bool IsKind (const TfToken &baseKind, KindValidation validation=KindValidationModelHierarchy) const
 
USD_API bool IsModel () const
 
USD_API bool IsGroup () const
 

Additional Inherited Members

- Static Protected Member Functions inherited from UsdAPISchemaBase
template<typename APISchemaType >
static APISchemaType _ApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName)
 
template<typename APISchemaType >
static APISchemaType _MultipleApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName, const TfToken &instanceName)
 

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.

Todo:

establish an _IsCompatible() override that returns IsModel()

GetModelInstanceName()

Definition at line 72 of file modelAPI.h.

Member Enumeration Documentation

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

See Also
IsKind()
Enumerator
KindValidationNone 
KindValidationModelHierarchy 

Definition at line 161 of file modelAPI.h.

Constructor & Destructor Documentation

UsdModelAPI::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::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::~UsdModelAPI ( )
virtual

Destructor.

Member Function Documentation

template<typename T >
bool UsdModelAPI::_GetAssetInfoByKey ( const TfToken key,
T val 
) const
inlineprotected

Definition at line 322 of file modelAPI.h.

USD_API UsdSchemaType UsdModelAPI::_GetSchemaType ( ) const
overrideprotectedvirtual

Returns the type of schema this class belongs to.

See Also
UsdSchemaType

Reimplemented from UsdAPISchemaBase.

static USD_API UsdModelAPI 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 UsdModelAPI::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 UsdModelAPI::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 UsdModelAPI::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 UsdModelAPI::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 UsdModelAPI::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 UsdModelAPI::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& UsdModelAPI::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 UsdModelAPI::IsGroup ( ) const

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

USD_API bool UsdModelAPI::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 UsdModelAPI::IsModel ( ) const

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

USD_API void UsdModelAPI::SetAssetIdentifier ( const SdfAssetPath identifier) const

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

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

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

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

Sets the model's asset name to assetName.

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

Sets the model's asset version string.

See Also
GetAssetVersion()
USD_API bool UsdModelAPI::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 UsdModelAPI::SetPayloadAssetDependencies ( const VtArray< SdfAssetPath > &  assetDeps) const

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

See Also
GetPayloadAssetDependencies()

Friends And Related Function Documentation

friend class UsdSchemaRegistry
friend

Definition at line 131 of file modelAPI.h.

Member Data Documentation

const UsdSchemaType UsdModelAPI::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: