24 #ifndef PXR_USD_USD_PRIM_H
25 #define PXR_USD_USD_PRIM_H
45 #include <hboost/iterator/iterator_adaptor.hpp>
46 #include <hboost/range/iterator_range.hpp>
49 #include <type_traits>
155 return _Prim()->GetPrimTypeInfo();
162 return _Prim()->GetPrimDefinition();
187 return SetMetadata(SdfFieldKeys->Specifier, specifier);
201 return SetMetadata(SdfFieldKeys->TypeName, typeName);
270 return _Prim()->HasDefiningSpecifier();
285 std::function<bool (const TfToken &propertyName)>;
395 std::vector<UsdProperty>
403 std::vector<UsdProperty>
412 std::vector<UsdProperty>
414 const std::vector<std::string> &namespaces)
const;
422 std::vector<UsdProperty>
477 bool _IsA(
const TfType& schemaType,
bool validateSchemaType)
const;
488 bool _HasAPI(
const TfType& schemaType,
bool validateSchemaType,
489 const TfToken &instanceName)
const;
498 bool _CanApplyAPI(
const TfType& schemaType,
502 bool _CanApplyAPI(
const TfType& schemaType,
507 bool _ApplyAPI(
const TfType& schemaType)
const;
510 bool _ApplyAPI(
const TfType& schemaType,
511 const TfToken& instanceName)
const;
514 bool _RemoveAPI(
const TfType& schemaType)
const;
517 bool _RemoveAPI(
const TfType& schemaType,
518 const TfToken& instanceName)
const;
525 template <
typename T>
528 "Provided type must derive UsdSchemaBase.");
529 return _IsA(TfType::Find<T>(),
false);
537 bool IsA(
const TfType& schemaType)
const;
576 template <
typename T>
579 "Provided type must derive UsdAPISchemaBase.");
581 "Provided type must not be UsdAPISchemaBase.");
585 "Provided schema type must be an applied API schema.");
588 && !instanceName.IsEmpty()) {
590 "not contain an application instanceName ( %s ).",
592 instanceName.GetText());
596 return _HasAPI(TfType::Find<T>(),
false,
623 template <
typename SchemaType>
626 "Provided type must derive UsdAPISchemaBase.");
628 "Provided type must not be UsdAPISchemaBase.");
630 "Provided schema type must be a single apply API schema.");
632 static const TfType schemaType = TfType::Find<SchemaType>();
633 return _CanApplyAPI(schemaType, whyNot);
659 template <
typename SchemaType>
663 "Provided type must derive UsdAPISchemaBase.");
665 "Provided type must not be UsdAPISchemaBase.");
667 "Provided schema type must be a multiple apply API schema.");
669 static const TfType schemaType = TfType::Find<SchemaType>();
670 return _CanApplyAPI(schemaType, instanceName, whyNot);
699 template <
typename SchemaType>
702 "Provided type must derive UsdAPISchemaBase.");
704 "Provided type must not be UsdAPISchemaBase.");
706 "Provided schema type must be a single apply API schema.");
708 static const TfType schemaType = TfType::Find<SchemaType>();
709 return _ApplyAPI(schemaType);
741 template <
typename SchemaType>
744 "Provided type must derive UsdAPISchemaBase.");
746 "Provided type must not be UsdAPISchemaBase.");
748 "Provided schema type must be a multiple apply API schema.");
750 static const TfType schemaType = TfType::Find<SchemaType>();
751 return _ApplyAPI(schemaType, instanceName);
779 template <
typename SchemaType>
782 "Provided type must derive UsdAPISchemaBase.");
784 "Provided type must not be UsdAPISchemaBase.");
786 "Provided schema type must be a single apply API schema.");
788 static const TfType schemaType = TfType::Find<SchemaType>();
789 return _RemoveAPI(schemaType);
822 template <
typename SchemaType>
825 "Provided type must derive UsdAPISchemaBase.");
827 "Provided type must not be UsdAPISchemaBase.");
829 "Provided schema type must be a multiple apply API schema.");
831 static const TfType schemaType = TfType::Find<SchemaType>();
832 return _RemoveAPI(schemaType, instanceName);
843 const TfToken& instanceName)
const;
1042 return UsdPrim(prim, proxyPrimPath);
1207 const std::vector<std::string> &nameElts,
1216 const std::vector<std::string> &nameElts,
1257 std::function<
bool (
UsdAttribute const &)>
const &pred =
nullptr,
1258 bool recurseOnSources =
false)
const;
1302 bool custom=
true)
const;
1352 bool recurseOnTargets =
false)
const;
1501 bool instanceable =
false;
1502 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1509 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
1658 :
UsdObject(primData, proxyPrimPath) { }
1665 :
UsdObject(objType, prim, proxyPrimPath, propName) {}
1676 std::vector<UsdProperty>
1682 bool applyOrder=
true,
1686 std::vector<UsdProperty>
1687 _GetPropertiesInNamespace(
const std::string &namespaces,
1688 bool onlyAuthored)
const;
1691 std::vector<UsdAttribute>
1692 _GetAttributes(
bool onlyAuthored,
bool applyOrder=
false)
const;
1695 std::vector<UsdRelationship>
1696 _GetRelationships(
bool onlyAuthored,
bool applyOrder=
false)
const;
1709 {
return _Prim()->GetSourcePrimIndex(); }
1723 typedef unspecified-integral-
type difference_type;
1727 unspecified-
type operator->()
const;
1752 typedef unspecified-integral-
type difference_type;
1763 template <
class ForwardRange>
1767 template <
class ForwardRange>
1771 iterator begin()
const;
1774 iterator
end()
const;
1777 operator unspecified_bool_type()
const;
1780 bool equal(
const iterator_range&)
const;
1786 iterator_range& advance_begin(difference_type
n);
1789 iterator_range& advance_end(difference_type
n);
1808 UsdPrimSiblingIterator,
1809 const Usd_PrimData *,
1811 hboost::forward_traversal_tag,
1824 : iterator_adaptor_(i)
1825 , _proxyPrimPath(proxyPrimPath)
1826 , _predicate(predicate) {
1828 if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
1835 return base() == other.base() &&
1836 _proxyPrimPath == other._proxyPrimPath &&
1837 _predicate == other._predicate;
1841 base_type &base = base_reference();
1849 return UsdPrim(base(), _proxyPrimPath);
1862 UsdPrimSiblingRange> : hboost::true_type {};
1865 const UsdPrimSiblingRange> : hboost::true_type {};
1873 return _MakeSiblingRange(
1895 firstChild =
nullptr;
1915 typedef unspecified-integral-
type difference_type;
1919 unspecified-
type operator->()
const;
1944 typedef unspecified-integral-
type difference_type;
1955 template <
class ForwardRange>
1959 template <
class ForwardRange>
1963 iterator begin()
const;
1966 iterator
end()
const;
1969 operator unspecified_bool_type()
const;
1972 bool equal(
const iterator_range&)
const;
1978 iterator_range& advance_begin(difference_type
n);
1981 iterator_range& advance_end(difference_type
n);
2000 UsdPrimSubtreeIterator,
2001 const Usd_PrimData *,
2003 hboost::forward_traversal_tag,
2016 : iterator_adaptor_(i)
2017 , _proxyPrimPath(proxyPrimPath)
2018 , _predicate(predicate) {
2020 base_type &base = base_reference();
2021 if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
2033 return base() == other.base() &&
2034 _proxyPrimPath == other._proxyPrimPath &&
2035 _predicate == other._predicate;
2039 base_type &base = base_reference();
2047 return UsdPrim(base(), _proxyPrimPath);
2060 UsdPrimSubtreeRange> : hboost::true_type {};
2063 const UsdPrimSubtreeRange> : hboost::true_type {};
2070 return _MakeDescendantsRange(
2092 SdfPath endChildPath = firstChildPath;
2109 return UsdPrim(_prim, _proxyPrimPath);
2114 #endif // PXR_USD_USD_PRIM_H
USD_API SdfPrimSpecHandleVector GetPrimStack() const
void Usd_MoveToParent(PrimDataPtr &p, SdfPath &proxyPrimPath)
USD_API SdfPathVector FindAllRelationshipTargetPaths(std::function< bool(UsdRelationship const &)> const &pred=nullptr, bool recurseOnTargets=false) const
Color4< T > operator*(S a, const Color4< T > &v)
GLuint GLdouble GLdouble GLint GLint order
Usd_PrimFlagsPredicate Usd_CreatePredicateForTraversal(const PrimDataPtr &p, const SdfPath &proxyPrimPath, Usd_PrimFlagsPredicate pred)
GLenum GLuint GLint GLint layer
friend class hboost::iterator_core_access
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
USD_API bool HasAuthoredPayloads() const
Return true if this prim has any authored payloads.
UsdPrim GetPrimInPrototype() const
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
USD_API std::vector< UsdAttribute > GetAuthoredAttributes() const
bool CanApplyAPI(std::string *whyNot=nullptr) const
SiblingRange GetChildren() const
USD_API bool HasAuthoredInherits() const
Return true if this prim has any authored inherits.
USD_API bool HasAuthoredMetadata(const TfToken &key) const
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
static TF_API std::string GetCanonicalTypeName(const std::type_info &)
bool HasAuthoredInstanceable() const
UsdPrimSiblingRange SiblingRange
void ClearPropertyOrder() const
GLsizei const GLchar *const * path
USD_API UsdRelationship CreateRelationship(const TfToken &relName, bool custom=true) const
GLenum const void GLuint GLint reference
static USD_API bool IsPathInPrototype(const SdfPath &path)
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
const UsdPrimTypeInfo & GetPrimTypeInfo() const
USD_API UsdAttribute CreateAttribute(const TfToken &name, const SdfValueTypeName &typeName, bool custom, SdfVariability variability=SdfVariabilityVarying) const
bool IsInstanceProxy() const
SubtreeRange GetAllDescendants() const
USD_API TfTokenVector GetAllChildrenNames() const
USD_API bool HasAuthoredReferences() const
Return true if this prim has any authored references.
void ClearChildrenReorder() const
const UsdPrimDefinition & GetPrimDefinition() const
USD_API UsdProperty GetPropertyAtPath(const SdfPath &path) const
Load a prim plus all its descendants.
USD_API UsdPrim GetPrimAtPath(const SdfPath &path) const
bool SetMetadata(const TfToken &key, const T &value) const
GLuint const GLchar * name
USD_API bool HasProperty(const TfToken &propName) const
USD_API void Load(UsdLoadPolicy policy=UsdLoadWithDescendants) const
USD_API bool RemoveProperty(const TfToken &propName)
bool GetMetadata(const TfToken &key, T *value) const
USD_API bool ClearMetadata(const TfToken &key) const
USD_API bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const
USD_API std::vector< UsdProperty > GetAuthoredProperties(const PropertyPredicateFunc &predicate={}) const
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
USD_API UsdPrim GetPrototype() const
bool HasAPI(const TfToken &instanceName=TfToken()) const
USD_API TfTokenVector GetPropertyNames(const PropertyPredicateFunc &predicate={}) const
USD_API std::vector< UsdProperty > GetProperties(const PropertyPredicateFunc &predicate={}) const
friend struct UsdPrim_AttrConnectionFinder
USD_API bool ClearPayload() const
USD_API SdfPathVector FindAllAttributeConnectionPaths(std::function< bool(UsdAttribute const &)> const &pred=nullptr, bool recurseOnSources=false) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
bool RemoveAPI(const TfToken &instanceName) const
USD_API UsdProperty GetProperty(const TfToken &propName) const
GLint GLint GLsizei GLint GLenum GLenum type
USD_API bool HasAttribute(const TfToken &attrName) const
USD_API bool HasRelationship(const TfToken &relName) const
USD_API void Unload() const
USD_API TfTokenVector GetFilteredChildrenNames(const Usd_PrimFlagsPredicate &predicate) const
bool Usd_IsInstanceProxy(const PrimDataPtr &p, const SdfPath &proxyPrimPath)
USD_API bool HasAuthoredSpecializes() const
Returns true if this prim has any authored specializes.
GLsizei const GLchar *const * string
USD_API UsdReferences GetReferences() const
friend class hboost::iterator_core_access
const SdfPath & GetPrimPath() const
bool SetInstanceable(bool instanceable) const
USD_API UsdAttribute GetAttributeAtPath(const SdfPath &path) const
bool HasAuthoredActive() const
static USD_API bool IsPrototypePath(const SdfPath &path)
void SetPropertyOrder(const TfTokenVector &order) const
USD_API bool AddAppliedSchema(const TfToken &appliedSchemaName) const
USD_API bool SetPayload(const SdfPayload &payload) const
bool ApplyAPI(const TfToken &instanceName) const
std::function< bool(const TfToken &propertyName)> PropertyPredicateFunc
std::vector< TfToken > TfTokenVector
Convenience types.
GLuint const GLuint * names
friend struct UsdPrim_RelTargetFinder
hboost::iterator_range< UsdPrimSubtreeIterator > UsdPrimSubtreeRange
const SdfPath & _ProxyPrimPath() const
bool IsAbstract() const
Return true if this prim or any of its ancestors is a class.
USD_API PcpPrimIndex ComputeExpandedPrimIndex() const
bool HasAuthoredTypeName() const
Return true if a typeName has been authored.
USD_API UsdRelationship GetRelationshipAtPath(const SdfPath &path) const
bool ClearInstanceable() const
USD_API TfTokenVector GetAppliedSchemas() const
void SetChildrenReorder(const TfTokenVector &order) const
UsdPrim GetParent() const
USD_API UsdPayloads GetPayloads() const
bool ClearTypeName() const
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
bool Usd_MoveToChild(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
USD_API TfTokenVector GetAuthoredPropertyNames(const PropertyPredicateFunc &predicate={}) const
USD_API UsdInherits GetInherits() const
USD_API UsdPrim GetNextSibling() const
USD_API UsdVariantSets GetVariantSets() const
const Usd_PrimDataHandle & _Prim() const
SubtreeRange GetDescendants() const
USD_API std::vector< UsdRelationship > GetRelationships() const
Like GetProperties(), but exclude all attributes from the result.
SubtreeRange GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate
Multiple Apply API Schema.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
hboost::iterator_range< UsdPrimSiblingIterator > UsdPrimSiblingRange
USD_API const Usd_PrimFlagsPredicate UsdPrimAllPrimsPredicate
bool Usd_MoveToNextSiblingOrParent(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
const PcpPrimIndex & GetPrimIndex() const
USD_API std::vector< UsdProperty > GetAuthoredPropertiesInNamespace(const std::vector< std::string > &namespaces) const
USD_API TfTokenVector GetPropertyOrder() const
Return the strongest propertyOrder metadata value authored on this prim.
bool IsInstanceable() const
UsdPrimSubtreeIterator SubtreeIterator
Convenience typedefs.
USD_API UsdObject GetObjectAtPath(const SdfPath &path) const
USD_API std::vector< UsdRelationship > GetAuthoredRelationships() const
USD_API TfTokenVector GetChildrenNames() const
USD_API UsdSpecializes GetSpecializes() const
const TfToken & GetTypeName() const
#define PXR_NAMESPACE_CLOSE_SCOPE
USD_API TfTokenVector GetChildrenReorder() const
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
GLsizei const GLfloat * value
bool equal(T1 a, T2 b, T3 t)
USD_API UsdPrim GetChild(const TfToken &name) const
USD_API bool HasVariantSets() const
bool CanApplyAPI(const TfToken &instanceName, std::string *whyNot=nullptr) const
USD_API std::vector< UsdAttribute > GetAttributes() const
Like GetProperties(), but exclude all relationships from the result.
USD_API std::vector< UsdPrim > GetInstances() const
bool SetTypeName(const TfToken &typeName) const
Author this Prim's typeName at the current EditTarget.
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
bool SetSpecifier(SdfSpecifier specifier) const
USD_API UsdPrim GetFilteredNextSibling(const Usd_PrimFlagsPredicate &predicate) const
UsdPrim()
Construct an invalid prim.
bool SetActive(bool active) const
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
bool HasDefiningSpecifier() const
USD_API std::vector< UsdProperty > GetPropertiesInNamespace(const std::vector< std::string > &namespaces) const
UsdPrimSubtreeRange SubtreeRange
USD_API bool HasPayload() const
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
bool IsInPrototype() const
SiblingRange GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const
friend const PcpPrimIndex & Usd_PrimGetSourcePrimIndex(const UsdPrim &)
USD_API bool IsPseudoRoot() const