24 #ifndef PXR_USD_USD_OBJECT_H
25 #define PXR_USD_USD_OBJECT_H
38 #include <type_traits>
67 template <UsdObjType Type>
71 "Type T must be a subclass of UsdObject.");
85 return (baseType ==
UsdTypeObject) || (baseType == subType) ||
154 explicit operator bool()
const {
163 return lhs._type == rhs._type &&
164 lhs._prim == rhs._prim &&
165 lhs._proxyPrimPath == rhs._proxyPrimPath &&
166 lhs._propName == rhs._propName;
172 return !(lhs == rhs);
196 if (!_proxyPrimPath.
IsEmpty()) {
202 p->GetPath() :
p->GetPath().AppendProperty(_propName);
211 if (!_proxyPrimPath.
IsEmpty()) {
212 return _proxyPrimPath;
239 return Is<T>() ?
T(_type, _prim, _proxyPrimPath, _propName) :
T();
250 "Provided type T must derive from or be UsdObject");
635 {
return SdfPathTokens->namespaceDelimiter.GetText()[0]; }
639 bool _GetMetadataImpl(
const TfToken& key,
643 bool _GetMetadataImpl(
const TfToken& key,
648 bool _SetMetadataImpl(
const TfToken& key,
652 bool _SetMetadataImpl(
const TfToken& key,
657 template <
class Derived>
struct _Null {};
660 template <
class Derived>
662 : _type(_Detail::GetObjType<Derived>::
Value) {}
669 , _proxyPrimPath(proxyPrimPath)
671 TF_VERIFY(!_prim || _prim->GetPath() != _proxyPrimPath);
681 , _proxyPrimPath(proxyPrimPath)
682 , _propName(propName)
684 TF_VERIFY(!_prim || _prim->GetPath() != _proxyPrimPath);
725 return _GetMetadataImpl(key, value);
733 return _SetMetadataImpl(key, value);
736 template <
typename T>
743 return _GetMetadataImpl(key, value, keyPath);
746 template <
typename T>
751 const T& value)
const
753 return _SetMetadataImpl(key, value, keyPath);
758 UsdObject::_GetMetadataImpl(
const TfToken& key,
763 *
this, key, keyPath,
true, value);
768 UsdObject::_SetMetadataImpl(
const TfToken& key,
772 return _GetStage()->_SetMetadata(*
this, key, keyPath, value);
777 #endif //PXR_USD_USD_OBJECT_H
USD_API bool IsHidden() const
USD_API bool ClearDocumentation() const
UsdStage * _GetStage() const
USD_API void SetAssetInfoByKey(const TfToken &keyPath, const VtValue &value) const
USD_API void SetCustomData(const VtDictionary &customData) const
USD_API bool SetHidden(bool hidden) const
USD_API bool HasAuthoredAssetInfo() const
USD_API void ClearAssetInfoByKey(const TfToken &keyPath) const
USD_API bool HasAuthoredMetadata(const TfToken &key) const
USD_API VtValue GetCustomDataByKey(const TfToken &keyPath) const
UsdObject()
Default constructor produces an invalid object.
USD_API void SetCustomDataByKey(const TfToken &keyPath, const VtValue &value) const
bool UsdIsSubtype(UsdObjType baseType, UsdObjType subType)
USD_API void ClearCustomData() const
static char GetNamespaceDelimiter()
USD_API friend size_t hash_value(const UsdObject &obj)
friend bool operator<(const UsdObject &lhs, const UsdObject &rhs)
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
bool SetMetadata(const TfToken &key, const T &value) const
UsdObject(_Null< Derived >)
bool GetMetadata(const TfToken &key, T *value) const
USD_API bool ClearMetadata(const TfToken &key) const
bool GetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, T *value) const
USD_API bool HasCustomData() const
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
USD_API bool HasAuthoredHidden() const
bool UsdIsConcrete(UsdObjType type)
static SDF_API const SdfPath & EmptyPath()
The empty path value, equivalent to SdfPath().
USD_API VtDictionary GetCustomData() const
USD_API UsdMetadataValueMap GetAllAuthoredMetadata() const
std::map< class TfToken, VtValue, TfDictionaryLessThan > UsdMetadataValueMap
USD_API VtValue GetAssetInfoByKey(const TfToken &keyPath) const
A generic, discriminated value, whose type may be queried dynamically.
USD_API bool HasAuthoredMetadataDictKey(const TfToken &key, const TfToken &keyPath) const
USD_API bool HasMetadata(const TfToken &key) const
GLsizei const GLchar *const * string
USD_API void ClearAssetInfo() const
const SdfPath & GetPrimPath() const
USD_API void SetAssetInfo(const VtDictionary &customData) const
USD_API bool HasCustomDataKey(const TfToken &keyPath) const
USD_API void ClearCustomDataByKey(const TfToken &keyPath) const
const SdfPath & _ProxyPrimPath() const
USD_API SdfSpecType _GetDefiningSpecType() const
const TfToken & GetName() const
USD_API VtDictionary GetAssetInfo() const
USD_API bool HasAuthoredAssetInfoKey(const TfToken &keyPath) const
SDF_API const TfToken & GetNameToken() const
UsdObject(const Usd_PrimDataHandle &prim, const SdfPath &proxyPrimPath)
USD_API bool ClearMetadataByDictKey(const TfToken &key, const TfToken &keyPath) const
USD_API bool HasAssetInfoKey(const TfToken &keyPath) const
USD_API UsdStageWeakPtr GetStage() const
SDF_API SdfPath AppendProperty(TfToken const &propName) const
UsdObject(UsdObjType objType, const Usd_PrimDataHandle &prim, const SdfPath &proxyPrimPath, const TfToken &propName)
const Usd_PrimDataHandle & _Prim() const
UsdStagePtr UsdStageWeakPtr
bool UsdIsConvertible(UsdObjType from, UsdObjType to)
USD_API std::string GetDescription() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
bool IsValid() const
Return true if this is a valid object, false otherwise.
friend UsdObjType Usd_GetObjType(const UsdObject &obj)
friend bool operator==(const UsdObject &lhs, const UsdObject &rhs)
friend bool operator!=(const UsdObject &lhs, const UsdObject &rhs)
#define PXR_NAMESPACE_CLOSE_SCOPE
USD_API UsdMetadataValueMap GetAllMetadata() const
GLsizei const GLfloat * value
USD_API bool HasAssetInfo() const
const TfToken & _PropName() const
USD_API std::string GetDocumentation() const
USD_API bool SetDocumentation(const std::string &doc) const
Sets this object's documentation (metadata). Returns true on success.
USD_API bool HasAuthoredCustomDataKey(const TfToken &keyPath) const
bool SetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, const T &value) const
USD_API bool HasMetadataDictKey(const TfToken &key, const TfToken &keyPath) const
USD_API bool HasAuthoredCustomData() const
USD_API bool ClearHidden() const
Clears the opinion for "Hidden" at the current EditTarget.
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_PTRS(UsdStage)
USD_API bool HasAuthoredDocumentation() const