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;
482 bool _HasSingleApplyAPI(
const TfType& schemaType)
const;
485 bool _HasMultiApplyAPI(
const TfType& schemaType,
486 const TfToken &instanceName)
const;
495 bool _CanApplyAPI(
const TfType& schemaType,
499 bool _CanApplyAPI(
const TfType& schemaType,
504 bool _ApplyAPI(
const TfType& schemaType)
const;
507 bool _ApplyAPI(
const TfType& schemaType,
508 const TfToken& instanceName)
const;
511 bool _RemoveAPI(
const TfType& schemaType)
const;
514 bool _RemoveAPI(
const TfType& schemaType,
515 const TfToken& instanceName)
const;
522 template <
typename T>
525 "Provided type must derive UsdSchemaBase.");
526 return _IsA(TfType::Find<T>(),
false);
534 bool IsA(
const TfType& schemaType)
const;
569 template <
typename T>
574 "Provided type must derive UsdAPISchemaBase.");
576 "Provided type must not be UsdAPISchemaBase.");
583 "Provided schema type must be a single apply API schema.");
585 return _HasSingleApplyAPI(TfType::Find<T>());
596 template <
typename T>
601 "Provided type must derive UsdAPISchemaBase.");
603 "Provided type must not be UsdAPISchemaBase.");
605 "Provided schema type must be a multi apply API schema.");
607 return _HasMultiApplyAPI(TfType::Find<T>(), instanceName);
640 template <
typename SchemaType>
643 "Provided type must derive UsdAPISchemaBase.");
645 "Provided type must not be UsdAPISchemaBase.");
647 "Provided schema type must be a single apply API schema.");
649 static const TfType schemaType = TfType::Find<SchemaType>();
650 return _CanApplyAPI(schemaType, whyNot);
676 template <
typename SchemaType>
680 "Provided type must derive UsdAPISchemaBase.");
682 "Provided type must not be UsdAPISchemaBase.");
684 "Provided schema type must be a multiple apply API schema.");
686 static const TfType schemaType = TfType::Find<SchemaType>();
687 return _CanApplyAPI(schemaType, instanceName, whyNot);
716 template <
typename SchemaType>
719 "Provided type must derive UsdAPISchemaBase.");
721 "Provided type must not be UsdAPISchemaBase.");
723 "Provided schema type must be a single apply API schema.");
725 static const TfType schemaType = TfType::Find<SchemaType>();
726 return _ApplyAPI(schemaType);
758 template <
typename SchemaType>
761 "Provided type must derive UsdAPISchemaBase.");
763 "Provided type must not be UsdAPISchemaBase.");
765 "Provided schema type must be a multiple apply API schema.");
767 static const TfType schemaType = TfType::Find<SchemaType>();
768 return _ApplyAPI(schemaType, instanceName);
796 template <
typename SchemaType>
799 "Provided type must derive UsdAPISchemaBase.");
801 "Provided type must not be UsdAPISchemaBase.");
803 "Provided schema type must be a single apply API schema.");
805 static const TfType schemaType = TfType::Find<SchemaType>();
806 return _RemoveAPI(schemaType);
839 template <
typename SchemaType>
842 "Provided type must derive UsdAPISchemaBase.");
844 "Provided type must not be UsdAPISchemaBase.");
846 "Provided schema type must be a multiple apply API schema.");
848 static const TfType schemaType = TfType::Find<SchemaType>();
849 return _RemoveAPI(schemaType, instanceName);
860 const TfToken& instanceName)
const;
1059 return UsdPrim(prim, proxyPrimPath);
1224 const std::vector<std::string> &nameElts,
1233 const std::vector<std::string> &nameElts,
1274 std::function<
bool (
UsdAttribute const &)>
const &pred =
nullptr,
1275 bool recurseOnSources =
false)
const;
1319 bool custom=
true)
const;
1369 bool recurseOnTargets =
false)
const;
1518 bool instanceable =
false;
1519 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1526 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
1675 :
UsdObject(primData, proxyPrimPath) { }
1682 :
UsdObject(objType, prim, proxyPrimPath, propName) {}
1693 std::vector<UsdProperty>
1699 bool applyOrder=
true,
1703 std::vector<UsdProperty>
1704 _GetPropertiesInNamespace(
const std::string &namespaces,
1705 bool onlyAuthored)
const;
1708 std::vector<UsdAttribute>
1709 _GetAttributes(
bool onlyAuthored,
bool applyOrder=
false)
const;
1712 std::vector<UsdRelationship>
1713 _GetRelationships(
bool onlyAuthored,
bool applyOrder=
false)
const;
1726 {
return _Prim()->GetSourcePrimIndex(); }
1740 typedef unspecified-integral-
type difference_type;
1744 unspecified-
type operator->()
const;
1769 typedef unspecified-integral-
type difference_type;
1780 template <
class ForwardRange>
1784 template <
class ForwardRange>
1788 iterator
begin()
const;
1791 iterator
end()
const;
1794 operator unspecified_bool_type()
const;
1797 bool equal(
const iterator_range&)
const;
1803 iterator_range& advance_begin(difference_type
n);
1806 iterator_range& advance_end(difference_type
n);
1825 UsdPrimSiblingIterator,
1826 const Usd_PrimData *,
1828 hboost::forward_traversal_tag,
1841 : iterator_adaptor_(i)
1842 , _proxyPrimPath(proxyPrimPath)
1843 , _predicate(predicate) {
1845 if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
1852 return base() == other.base() &&
1853 _proxyPrimPath == other._proxyPrimPath &&
1854 _predicate == other._predicate;
1858 base_type &base = base_reference();
1866 return UsdPrim(base(), _proxyPrimPath);
1879 UsdPrimSiblingRange> : hboost::true_type {};
1882 const UsdPrimSiblingRange> : hboost::true_type {};
1890 return _MakeSiblingRange(
1912 firstChild =
nullptr;
1932 typedef unspecified-integral-
type difference_type;
1936 unspecified-
type operator->()
const;
1961 typedef unspecified-integral-
type difference_type;
1972 template <
class ForwardRange>
1976 template <
class ForwardRange>
1980 iterator
begin()
const;
1983 iterator
end()
const;
1986 operator unspecified_bool_type()
const;
1989 bool equal(
const iterator_range&)
const;
1995 iterator_range& advance_begin(difference_type
n);
1998 iterator_range& advance_end(difference_type
n);
2017 UsdPrimSubtreeIterator,
2018 const Usd_PrimData *,
2020 hboost::forward_traversal_tag,
2033 : iterator_adaptor_(i)
2034 , _proxyPrimPath(proxyPrimPath)
2035 , _predicate(predicate) {
2037 base_type &base = base_reference();
2038 if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
2050 return base() == other.base() &&
2051 _proxyPrimPath == other._proxyPrimPath &&
2052 _predicate == other._predicate;
2056 base_type &base = base_reference();
2064 return UsdPrim(base(), _proxyPrimPath);
2077 UsdPrimSubtreeRange> : hboost::true_type {};
2080 const UsdPrimSubtreeRange> : hboost::true_type {};
2087 return _MakeDescendantsRange(
2109 SdfPath endChildPath = firstChildPath;
2126 return UsdPrim(_prim, _proxyPrimPath);
2131 #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
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.
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
std::enable_if< T::schemaKind==UsdSchemaKind::MultipleApplyAPI, bool >::type HasAPI(const TfToken &instanceName=TfToken()) 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
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
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
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
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
IMATH_HOSTDEVICE constexpr Color4< T > operator*(S a, const Color4< T > &v) IMATH_NOEXCEPT
Reverse multiplication: S * Color4.
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
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.
std::enable_if< T::schemaKind!=UsdSchemaKind::MultipleApplyAPI, bool >::type HasAPI() const
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
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.