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>
470 bool _IsA(
const TfType& schemaType,
bool validateSchemaType)
const;
481 bool _HasAPI(
const TfType& schemaType,
bool validateSchemaType,
482 const TfToken &instanceName)
const;
488 bool _ApplyAPI(
const TfType& schemaType,
495 bool _RemoveAPI(
const TfType& schemaType,
503 template <
typename T>
506 "Provided type must derive UsdSchemaBase.");
507 return _IsA(TfType::Find<T>(),
false);
515 bool IsA(
const TfType& schemaType)
const;
554 template <
typename T>
557 "Provided type must derive UsdAPISchemaBase.");
559 "Provided type must not be UsdAPISchemaBase.");
563 "Provided schema type must be an applied API schema.");
566 && !instanceName.IsEmpty()) {
568 "not contain an application instanceName ( %s ).",
570 instanceName.GetText());
574 return _HasAPI(TfType::Find<T>(),
false,
604 template <
typename SchemaType>
607 "Provided type must derive UsdAPISchemaBase.");
609 "Provided type must not be UsdAPISchemaBase.");
611 "Provided schema type must be an single apply API schema.");
613 static TfType schemaType = TfType::Find<SchemaType>();
614 return _ApplyAPI(schemaType);
637 template <
typename SchemaType>
640 "Provided type must derive UsdAPISchemaBase.");
642 "Provided type must not be UsdAPISchemaBase.");
644 "Provided schema type must be a multiple apply API schema.");
648 "non-empty instance name must be provided.",
653 static TfType schemaType = TfType::Find<SchemaType>();
654 return _ApplyAPI(schemaType, instanceName);
691 template <
typename SchemaType>
694 "Provided type must derive UsdAPISchemaBase.");
696 "Provided type must not be UsdAPISchemaBase.");
698 "Provided schema type must be an single apply API schema.");
700 static TfType schemaType = TfType::Find<SchemaType>();
701 return _RemoveAPI(schemaType);
725 template <
typename SchemaType>
728 "Provided type must derive UsdAPISchemaBase.");
730 "Provided type must not be UsdAPISchemaBase.");
732 "Provided schema type must be a multiple apply API schema.");
734 static TfType schemaType = TfType::Find<SchemaType>();
735 return _RemoveAPI(schemaType, instanceName);
916 return UsdPrim(prim, proxyPrimPath);
1081 const std::vector<std::string> &nameElts,
1090 const std::vector<std::string> &nameElts,
1131 std::function<
bool (
UsdAttribute const &)>
const &pred =
nullptr,
1132 bool recurseOnSources =
false)
const;
1176 bool custom=
true)
const;
1226 bool recurseOnTargets =
false)
const;
1367 bool instanceable =
false;
1368 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1375 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
1505 :
UsdObject(primData, proxyPrimPath) { }
1512 :
UsdObject(objType, prim, proxyPrimPath, propName) {}
1523 std::vector<UsdProperty>
1529 bool applyOrder=
true,
1533 std::vector<UsdProperty>
1534 _GetPropertiesInNamespace(
const std::string &namespaces,
1535 bool onlyAuthored)
const;
1538 std::vector<UsdAttribute>
1539 _GetAttributes(
bool onlyAuthored,
bool applyOrder=
false)
const;
1542 std::vector<UsdRelationship>
1543 _GetRelationships(
bool onlyAuthored,
bool applyOrder=
false)
const;
1548 bool _PrimPathIsInMaster()
const;
1561 {
return _Prim()->GetSourcePrimIndex(); }
1575 typedef unspecified-integral-
type difference_type;
1579 unspecified-
type operator->()
const;
1604 typedef unspecified-integral-
type difference_type;
1615 template <
class ForwardRange>
1619 template <
class ForwardRange>
1623 iterator
begin()
const;
1626 iterator
end()
const;
1629 operator unspecified_bool_type()
const;
1632 bool equal(
const iterator_range&)
const;
1638 iterator_range& advance_begin(difference_type
n);
1641 iterator_range& advance_end(difference_type
n);
1660 UsdPrimSiblingIterator,
1661 const Usd_PrimData *,
1663 hboost::forward_traversal_tag,
1676 : iterator_adaptor_(i)
1677 , _proxyPrimPath(proxyPrimPath)
1678 , _predicate(predicate) {
1680 if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
1687 return base() == other.base() &&
1688 _proxyPrimPath == other._proxyPrimPath &&
1689 _predicate == other._predicate;
1693 base_type &base = base_reference();
1701 return UsdPrim(base(), _proxyPrimPath);
1714 UsdPrimSiblingRange> : hboost::true_type {};
1717 const UsdPrimSiblingRange> : hboost::true_type {};
1725 return _MakeSiblingRange(
1747 firstChild =
nullptr;
1767 typedef unspecified-integral-
type difference_type;
1771 unspecified-
type operator->()
const;
1796 typedef unspecified-integral-
type difference_type;
1807 template <
class ForwardRange>
1811 template <
class ForwardRange>
1815 iterator
begin()
const;
1818 iterator
end()
const;
1821 operator unspecified_bool_type()
const;
1824 bool equal(
const iterator_range&)
const;
1830 iterator_range& advance_begin(difference_type
n);
1833 iterator_range& advance_end(difference_type
n);
1852 UsdPrimSubtreeIterator,
1853 const Usd_PrimData *,
1855 hboost::forward_traversal_tag,
1868 : iterator_adaptor_(i)
1869 , _proxyPrimPath(proxyPrimPath)
1870 , _predicate(predicate) {
1872 base_type &base = base_reference();
1873 if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
1885 return base() == other.base() &&
1886 _proxyPrimPath == other._proxyPrimPath &&
1887 _predicate == other._predicate;
1891 base_type &base = base_reference();
1899 return UsdPrim(base(), _proxyPrimPath);
1912 UsdPrimSubtreeRange> : hboost::true_type {};
1915 const UsdPrimSubtreeRange> : hboost::true_type {};
1922 return _MakeDescendantsRange(
1944 SdfPath endChildPath = firstChildPath;
1961 return UsdPrim(_prim, _proxyPrimPath);
1966 #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)
Usd_PrimFlagsPredicate Usd_CreatePredicateForTraversal(const PrimDataPtr &p, const SdfPath &proxyPrimPath, Usd_PrimFlagsPredicate pred)
GLuint const GLchar * name
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.
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
USD_API std::vector< UsdAttribute > GetAuthoredAttributes() 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
USD_API UsdRelationship CreateRelationship(const TfToken &relName, bool custom=true) const
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 bool HasAuthoredReferences() const
Return true if this prim has any authored references.
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
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 UsdPrim GetMaster() 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)
GLuint GLdouble GLdouble GLint GLint order
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
bool IsMaster() const
Return true if this prim is a master prim, false otherwise.
USD_API bool HasAttribute(const TfToken &attrName) const
USD_API bool HasRelationship(const TfToken &relName) const
USD_API void Unload() const
Multiple Apply API Schema.
bool Usd_IsInstanceProxy(const PrimDataPtr &p, const SdfPath &proxyPrimPath)
USD_API bool HasAuthoredSpecializes() const
Returns true if this prim has any authored specializes.
USD_API UsdReferences GetReferences() const
friend class hboost::iterator_core_access
bool SetInstanceable(bool instanceable) const
USD_API UsdAttribute GetAttributeAtPath(const SdfPath &path) const
bool HasAuthoredActive() const
GLuint const GLuint * names
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.
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
GLuint GLuint GLsizei GLenum type
UsdPrim GetParent() const
USD_API UsdPayloads GetPayloads() const
bool ClearTypeName() const
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
USD_API void SetPropertyOrder(const TfTokenVector &order) const
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
GLsizei const GLchar *const * path
USD_API UsdVariantSets GetVariantSets() const
const Usd_PrimDataHandle & _Prim() const
SubtreeRange GetDescendants() const
GLsizei const GLchar *const * string
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
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
hboost::iterator_range< UsdPrimSiblingIterator > UsdPrimSiblingRange
USD_API const Usd_PrimFlagsPredicate UsdPrimAllPrimsPredicate
UsdPrim GetPrimInMaster() const
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 UsdSpecializes GetSpecializes() const
GLdouble GLdouble GLdouble r
const TfToken & GetTypeName() const
GLint GLboolean GLint layer
#define PXR_NAMESPACE_CLOSE_SCOPE
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
bool equal(T1 a, T2 b, T3 t)
USD_API UsdPrim GetChild(const TfToken &name) const
USD_API bool HasVariantSets() const
GLenum const void GLuint GLint reference
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
GLsizei const GLfloat * value
UsdPrimSubtreeRange SubtreeRange
USD_API bool HasPayload() const
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
SiblingRange GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const
bool IsEmpty() const
Returns true iff this token contains the empty string "".
friend const PcpPrimIndex & Usd_PrimGetSourcePrimIndex(const UsdPrim &)
USD_API bool IsPseudoRoot() const