24 #ifndef PXR_USD_USD_OBJECT_H
25 #define PXR_USD_USD_OBJECT_H
40 #include <type_traits>
69 template <UsdObjType Type>
73 "Type T must be a subclass of UsdObject.");
87 return (baseType ==
UsdTypeObject) || (baseType == subType) ||
156 explicit operator bool()
const {
165 return lhs._type == rhs._type &&
166 lhs._prim == rhs._prim &&
167 lhs._proxyPrimPath == rhs._proxyPrimPath &&
168 lhs._propName == rhs._propName;
174 return !(lhs == rhs);
190 template <
class HashState>
192 h.Append(obj._type, obj._prim, obj._proxyPrimPath, obj._propName);
205 if (!_proxyPrimPath.
IsEmpty()) {
211 p->GetPath() : p->GetPath().AppendProperty(_propName);
220 if (!_proxyPrimPath.
IsEmpty()) {
221 return _proxyPrimPath;
248 return Is<T>() ?
T(_type, _prim, _proxyPrimPath, _propName) :
T();
259 "Provided type T must derive from or be UsdObject");
668 {
return SdfPathTokens->namespaceDelimiter.GetText()[0]; }
672 bool _GetMetadataImpl(
const TfToken& key,
676 bool _GetMetadataImpl(
const TfToken& key,
681 bool _SetMetadataImpl(
const TfToken& key,
685 bool _SetMetadataImpl(
const TfToken& key,
690 template <
class Derived>
struct _Null {};
693 template <
class Derived>
695 : _type(_Detail::GetObjType<Derived>::
Value) {}
702 , _proxyPrimPath(proxyPrimPath)
704 TF_VERIFY(!_prim || _prim->GetPath() != _proxyPrimPath);
714 , _proxyPrimPath(proxyPrimPath)
715 , _propName(propName)
717 TF_VERIFY(!_prim || _prim->GetPath() != _proxyPrimPath);
758 return _GetMetadataImpl(key, value);
766 return _SetMetadataImpl(key, value);
769 template <
typename T>
776 return _GetMetadataImpl(key, value, keyPath);
779 template <
typename T>
784 const T& value)
const
786 return _SetMetadataImpl(key, value, keyPath);
791 UsdObject::_GetMetadataImpl(
const TfToken& key,
796 *
this, key, keyPath,
true, value);
801 UsdObject::_SetMetadataImpl(
const TfToken& key,
805 return _GetStage()->_SetMetadata(*
this, key, keyPath, value);
810 #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
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
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()
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
UsdStagePtr UsdStageWeakPtr
USD_API bool HasCustomData() const
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
USD_API bool HasAuthoredHidden() const
bool UsdIsConcrete(UsdObjType type)
USD_API bool SetDisplayName(const std::string &name) const
static SDF_API const SdfPath & EmptyPath()
The empty path value, equivalent to SdfPath().
USD_API VtDictionary GetCustomData() const
USD_API UsdMetadataValueMap GetAllAuthoredMetadata() const
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
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
GLuint const GLchar * name
std::map< class TfToken, VtValue, TfDictionaryLessThan > UsdMetadataValueMap
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
GLfloat GLfloat GLfloat GLfloat h
bool UsdIsConvertible(UsdObjType from, UsdObjType to)
USD_API std::string GetDescription() const
USD_API bool ClearDisplayName() 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
friend void TfHashAppend(HashState &h, const UsdObject &obj)
USD_API bool HasAssetInfo() const
USD_API bool HasAuthoredDisplayName() 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 std::string GetDisplayName() 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