HDK
|
#include <object.h>
Classes | |
struct | _Null |
Static Public Member Functions | |
static char | GetNamespaceDelimiter () |
Protected Member Functions | |
template<class Derived > | |
UsdObject (_Null< Derived >) | |
UsdObject (const Usd_PrimDataHandle &prim, const SdfPath &proxyPrimPath) | |
UsdObject (UsdObjType objType, const Usd_PrimDataHandle &prim, const SdfPath &proxyPrimPath, const TfToken &propName) | |
UsdStage * | _GetStage () const |
USD_API SdfSpecType | _GetDefiningSpecType () const |
const Usd_PrimDataHandle & | _Prim () const |
const TfToken & | _PropName () const |
const SdfPath & | _ProxyPrimPath () const |
Friends | |
class | UsdStage |
UsdObjType | Usd_GetObjType (const UsdObject &obj) |
Structural and Integrity Info about the Object itself | |
bool | operator== (const UsdObject &lhs, const UsdObject &rhs) |
bool | operator!= (const UsdObject &lhs, const UsdObject &rhs) |
bool | operator< (const UsdObject &lhs, const UsdObject &rhs) |
size_t | hash_value (const UsdObject &obj) |
template<class HashState > | |
void | TfHashAppend (HashState &h, const UsdObject &obj) |
bool | IsValid () const |
Return true if this is a valid object, false otherwise. More... | |
operator bool () const | |
Returns true if this object is valid, false otherwise. More... | |
USD_API UsdStageWeakPtr | GetStage () const |
SdfPath | GetPath () const |
const SdfPath & | GetPrimPath () const |
UsdPrim | GetPrim () const |
const TfToken & | GetName () const |
template<class T > | |
T | As () const |
template<class T > | |
bool | Is () const |
USD_API std::string | GetDescription () const |
Base class for Usd scenegraph objects, providing common API.
The commonality between the three types of scenegraph objects in Usd (UsdPrim, UsdAttribute, UsdRelationship) is that they can all have metadata. Other objects in the API (UsdReferences, UsdVariantSets, etc.) simply are kinds of metadata.
UsdObject's API primarily provides schema for interacting with the metadata common to all the scenegraph objects, as well as generic access to metadata.
section Usd_UsdObject_Lifetime Lifetime Management and Object Validity
Every derived class of UsdObject supports explicit detection of object validity through an explicit-bool operator, so client code should always be able use objects safely, even across edits to the owning UsdStage. UsdObject classes also perform some level of validity checking upon every use, in order to facilitate debugging of unsafe code, although we reserve the right to activate that behavior only in debug builds, if it becomes compelling to do so for performance reasons. This per-use checking will cause a fatal error upon failing the inline validity check, with an error message describing the namespace location of the dereferenced object on its owning UsdStage.
|
inline |
|
inlineexplicitprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
Clear the authored opinion for this object's assetInfo dictionary at the current EditTarget. Do nothing if there is no such authored opinion.
Clear the authored opinion identified by keyPath
in this object's assetInfo dictionary at the current EditTarget. The keyPath
is a ':'-separated path identifying a value in subdictionaries. Do nothing if there is no such authored opinion.
Clear the authored opinion for this object's customData dictionary at the current EditTarget. Do nothing if there is no such authored opinion.
Clear the authored opinion identified by keyPath
in this object's customData dictionary at the current EditTarget. The keyPath
is a ':'-separated path identifying a value in subdictionaries. Do nothing if there is no such authored opinion.
USD_API bool UsdObject::ClearDisplayName | ( | ) | const |
Clears this object's display name (metadata) in the current EditTarget (only). Returns true on success.
USD_API bool UsdObject::ClearDocumentation | ( | ) | const |
Clears this object's documentation (metadata) in the current EditTarget (only). Returns true on success.
USD_API bool UsdObject::ClearHidden | ( | ) | const |
Clears the opinion for "Hidden" at the current EditTarget.
Clears the authored key's value at the current EditTarget, returning false on error.
If no value is present, this method is a no-op and returns true. It is considered an error to call ClearMetadata when no spec is present for this UsdObject, i.e. if the object has no presence in the current UsdEditTarget.
USD_API bool UsdObject::ClearMetadataByDictKey | ( | const TfToken & | key, |
const TfToken & | keyPath | ||
) | const |
Clear any authored value identified by key
and keyPath
at the current EditTarget. The keyPath
is a ':'-separated path identifying a path in subdictionaries stored in the metadata field at key
. Return true if the value is cleared successfully, false otherwise.
USD_API UsdMetadataValueMap UsdObject::GetAllAuthoredMetadata | ( | ) | const |
Resolve and return all user-authored metadata on this object, sorted lexicographically.
USD_API UsdMetadataValueMap UsdObject::GetAllMetadata | ( | ) | const |
Resolve and return all metadata (including both authored and fallback values) on this object, sorted lexicographically.
USD_API VtDictionary UsdObject::GetAssetInfo | ( | ) | const |
Return this object's composed assetInfo dictionary.
The asset info dictionary is used to annotate objects representing the root-prims of assets (generally organized as models) with various data related to asset management. For example, asset name, root layer identifier, asset version etc.
The elements of this dictionary are composed element-wise, and are nestable.
There is no means to query an assetInfo field's valuetype other than fetching the value and interrogating it.
Return the element identified by keyPath
in this object's composed assetInfo dictionary. The keyPath
is a ':'-separated path identifying a value in subdictionaries. This is in general more efficient than composing the entire assetInfo dictionary than pulling out one sub-element.
USD_API VtDictionary UsdObject::GetCustomData | ( | ) | const |
Return this object's composed customData dictionary.
CustomData is "custom metadata", a place for applications and users to put uniform data that is entirely dynamic and subject to no schema known to Usd. Unlike metadata like 'hidden', 'displayName' etc, which must be declared in code or a data file that is considered part of one's Usd distribution (e.g. a plugInfo.json file) to be used, customData keys and the datatypes of their corresponding values are ad hoc. No validation will ever be performed that values for the same key in different layers are of the same type - strongest simply wins.
Dictionaries like customData are composed element-wise, and are nestable.
There is no means to query a customData field's valuetype other than fetching the value and interrogating it.
Return the element identified by keyPath
in this object's composed customData dictionary. The keyPath
is a ':'-separated path identifying a value in subdictionaries. This is in general more efficient than composing the entire customData dictionary and then pulling out one sub-element.
USD_API std::string UsdObject::GetDescription | ( | ) | const |
Return a string that provides a brief summary description of the object. This method, along with IsValid()/bool_operator, is always safe to call on a possibly-expired object, and the description will specify whether the object is valid or expired, along with a few other bits of data.
USD_API std::string UsdObject::GetDisplayName | ( | ) | const |
Return this object's display name (metadata). This returns the empty string if no display name has been set.
USD_API std::string UsdObject::GetDocumentation | ( | ) | const |
Return this object's documentation (metadata). This returns the empty string if no documentation has been set.
Resolve the requested metadatum named key
into value
, returning true on success.
key
was not resolvable, or if value's
type T
differed from that of the resolved metadatum.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Type-erased access
|
inline |
Resolve the requested dictionary sub-element keyPath
of dictionary-valued metadatum named key
into value
, returning true on success.
If you know you neeed just a small number of elements from a dictionary, accessing them element-wise using this method can be much less expensive than fetching the entire dictionary with GetMetadata(key).
key
was not resolvable, or if value's
type T
differed from that of the resolved metadatum.The keyPath
is a ':'-separated path addressing an element in subdictionaries.
USD_API bool UsdObject::GetMetadataByDictKey | ( | const TfToken & | key, |
const TfToken & | keyPath, | ||
VtValue * | value | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
USD_API UsdStageWeakPtr UsdObject::GetStage | ( | ) | const |
Return the stage that owns the object, and to whose state and lifetime this object's validity is tied.
USD_API bool UsdObject::HasAssetInfo | ( | ) | const |
Return true if there are any authored or fallback opinions for this object's assetInfo dictionary, false otherwise.
Return true if there are any authored or fallback opinions for the element identified by keyPath
in this object's assetInfo dictionary, false otherwise. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
USD_API bool UsdObject::HasAuthoredAssetInfo | ( | ) | const |
Return true if there are any authored opinions (excluding fallback) for this object's assetInfo dictionary, false otherwise.
Return true if there are any authored opinions (excluding fallback) for the element identified by keyPath
in this object's assetInfo dictionary, false otherwise. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
USD_API bool UsdObject::HasAuthoredCustomData | ( | ) | const |
Return true if there are any authored opinions (excluding fallback) for this object's customData dictionary, false otherwise.
Return true if there are any authored opinions (excluding fallback) for the element identified by keyPath
in this object's customData dictionary, false otherwise. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
USD_API bool UsdObject::HasAuthoredDisplayName | ( | ) | const |
Returns true if displayName was explicitly authored and GetMetadata() will return a meaningful value for displayName.
USD_API bool UsdObject::HasAuthoredDocumentation | ( | ) | const |
Returns true if documentation was explicitly authored and GetMetadata() will return a meaningful value for documentation.
USD_API bool UsdObject::HasAuthoredHidden | ( | ) | const |
Returns true if hidden was explicitly authored and GetMetadata() will return a meaningful value for Hidden.
Note that IsHidden returns a fallback value (false) when hidden is not authored.
Returns true if the key has an authored value, false if no value was authored or the only value available is a prim's metadata fallback.
USD_API bool UsdObject::HasAuthoredMetadataDictKey | ( | const TfToken & | key, |
const TfToken & | keyPath | ||
) | const |
Return true if there exists any authored opinion (excluding fallbacks) for key
and keyPath
. The keyPath
is a ':'-separated path identifying a value in subdictionaries stored in the metadata field at key
.
USD_API bool UsdObject::HasCustomData | ( | ) | const |
Return true if there are any authored or fallback opinions for this object's customData dictionary, false otherwise.
Return true if there are any authored or fallback opinions for the element identified by keyPath
in this object's customData dictionary, false otherwise. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
Returns true if the key has a meaningful value, that is, if GetMetadata() will provide a value, either because it was authored or because a prim's metadata fallback will be provided.
Return true if there exists any authored or fallback opinion for key
and keyPath
. The keyPath
is a ':'-separated path identifying a value in subdictionaries stored in the metadata field at key
.
|
inline |
USD_API bool UsdObject::IsHidden | ( | ) | const |
Gets the value of the 'hidden' metadata field, false if not authored.
When an object is marked as hidden, it is an indicator to clients who generically display objects (such as GUI widgets) that this object should not be included, unless explicitly asked for. Although this is just a hint and thus up to each application to interpret, we use it primarily as a way of simplifying hierarchy displays, by hiding only the representation of the object itself, not its subtree, instead "pulling up" everything below it one level in the hierarchical nesting.
Note again that this is a hint for UI only - it should not be interpreted by any renderer as making a prim invisible to drawing.
|
inline |
|
inlineexplicit |
USD_API void UsdObject::SetAssetInfo | ( | const VtDictionary & | customData | ) | const |
Author this object's assetInfo dictionary to assetInfo
at the current EditTarget.
Author the element identified by keyPath
in this object's assetInfo dictionary at the current EditTarget. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
USD_API void UsdObject::SetCustomData | ( | const VtDictionary & | customData | ) | const |
Author this object's customData dictionary to customData
at the current EditTarget.
Author the element identified by keyPath
in this object's customData dictionary at the current EditTarget. The keyPath
is a ':'-separated path identifying a value in subdictionaries.
USD_API bool UsdObject::SetDisplayName | ( | const std::string & | name | ) | const |
Sets this object's display name (metadata). Returns true on success.
DisplayName is meant to be a descriptive label, not necessarily an alternate identifier; therefore there is no restriction on which characters can appear in it.
USD_API bool UsdObject::SetDocumentation | ( | const std::string & | doc | ) | const |
Sets this object's documentation (metadata). Returns true on success.
USD_API bool UsdObject::SetHidden | ( | bool | hidden | ) | const |
Sets the value of the 'hidden' metadata field. See IsHidden() for details.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Author value
to the field identified by key
and keyPath
at the current EditTarget. The keyPath
is a ':'-separated path identifying a value in subdictionaries stored in the metadata field at key
. Return true if the value is authored successfully, false otherwise.
USD_API bool UsdObject::SetMetadataByDictKey | ( | const TfToken & | key, |
const TfToken & | keyPath, | ||
const VtValue & | value | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
friend |
|
friend |