24 #ifndef PXR_USD_USD_PRIM_H
25 #define PXR_USD_USD_PRIM_H
46 #include <hboost/iterator/iterator_adaptor.hpp>
47 #include <hboost/range/iterator_range.hpp>
50 #include <type_traits>
160 return _Prim()->GetPrimTypeInfo();
167 return _Prim()->GetPrimDefinition();
202 std::vector<std::pair<SdfPrimSpecHandle, SdfLayerOffset>>
208 return SetMetadata(SdfFieldKeys->Specifier, specifier);
222 return SetMetadata(SdfFieldKeys->TypeName, typeName);
291 return _Prim()->HasDefiningSpecifier();
306 std::function<bool (const TfToken &propertyName)>;
416 std::vector<UsdProperty>
424 std::vector<UsdProperty>
433 std::vector<UsdProperty>
435 const std::vector<std::string> &namespaces)
const;
443 std::vector<UsdProperty>
505 bool _HasAPIInstance(
507 const TfToken &instanceName)
const;
510 bool _CanApplySingleApplyAPI(
515 bool _CanApplyMultipleApplyAPI(
521 bool _ApplySingleApplyAPI(
525 bool _ApplyMultipleApplyAPI(
527 const TfToken &instanceName)
const;
530 bool _RemoveSingleApplyAPI(
534 bool _RemoveMultipleApplyAPI(
536 const TfToken &instanceName)
const;
549 template <
typename SchemaType>
552 "Provided type must derive UsdSchemaBase.");
553 return _IsA(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
558 bool IsA(
const TfType& schemaType)
const;
563 bool IsA(
const TfToken& schemaIdentifier)
const;
595 template <
typename SchemaType>
599 "Provided type must derive UsdSchemaBase.");
601 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
604 "UsdSchemaRegistry as a schema type. The schema may need to be "
632 const TfToken &schemaIdentifier,
698 template <
typename SchemaType>
702 "Provided type must derive UsdAPISchemaBase.");
704 "Provided type must not be UsdAPISchemaBase.");
708 "Provided schema type must be an applied API schema.");
710 return _HasAPI(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
718 template <
typename SchemaType>
722 "Provided type must derive UsdAPISchemaBase.");
724 "Provided type must not be UsdAPISchemaBase.");
726 "Provided schema type must be a multi apply API schema.");
728 return _HasAPIInstance(
729 UsdSchemaRegistry::FindSchemaInfo<SchemaType>(), instanceName);
740 const TfToken& instanceName)
const;
752 const TfToken& instanceName)
const;
766 const TfToken& instanceName)
const;
782 const TfToken &schemaFamily)
const;
792 const TfToken &instanceName)
const;
819 const TfToken &instanceName)
const;
825 template <
typename SchemaType>
829 "Provided type must derive UsdSchemaBase.");
831 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
834 "UsdSchemaRegistry as a schema type. The schema may need to be "
847 template <
typename SchemaType>
850 const TfToken &instanceName)
const {
852 "Provided type must derive UsdSchemaBase.");
854 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
857 "UsdSchemaRegistry as a schema type. The schema may need to be "
863 versionPolicy, instanceName);
883 const TfToken &instanceName)
const;
895 const TfToken &schemaIdentifier,
908 const TfToken &schemaIdentifier,
910 const TfToken &instanceName)
const;
968 template <
typename SchemaType>
971 "Provided type must derive UsdAPISchemaBase.");
973 "Provided type must not be UsdAPISchemaBase.");
975 "Provided schema type must be a single apply API schema.");
978 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
981 "UsdSchemaRegistry as a schema type. The schema may need to be "
986 return _CanApplySingleApplyAPI(*schemaInfo, whyNot);
1002 template <
typename SchemaType>
1006 "Provided type must derive UsdAPISchemaBase.");
1008 "Provided type must not be UsdAPISchemaBase.");
1010 "Provided schema type must be a multiple apply API schema.");
1013 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1016 "UsdSchemaRegistry as a schema type. The schema may need to be "
1018 TfType::Find<SchemaType>().
GetTypeName().c_str());
1021 return _CanApplyMultipleApplyAPI(*schemaInfo, instanceName, whyNot);
1091 template <
typename SchemaType>
1094 "Provided type must derive UsdAPISchemaBase.");
1096 "Provided type must not be UsdAPISchemaBase.");
1098 "Provided schema type must be a single apply API schema.");
1101 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1104 "UsdSchemaRegistry as a schema type. The schema may need to be "
1106 TfType::Find<SchemaType>().
GetTypeName().c_str());
1109 return _ApplySingleApplyAPI(*schemaInfo);
1132 template <
typename SchemaType>
1135 "Provided type must derive UsdAPISchemaBase.");
1137 "Provided type must not be UsdAPISchemaBase.");
1139 "Provided schema type must be a multiple apply API schema.");
1142 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1145 "UsdSchemaRegistry as a schema type. The schema may need to be "
1147 TfType::Find<SchemaType>().
GetTypeName().c_str());
1150 return _ApplyMultipleApplyAPI(*schemaInfo, instanceName);
1161 const TfToken& instanceName)
const;
1173 const TfToken& instanceName)
const;
1187 const TfToken& instanceName)
const;
1211 template <
typename SchemaType>
1214 "Provided type must derive UsdAPISchemaBase.");
1216 "Provided type must not be UsdAPISchemaBase.");
1218 "Provided schema type must be a single apply API schema.");
1221 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1224 "UsdSchemaRegistry as a schema type. The schema may need to be "
1226 TfType::Find<SchemaType>().
GetTypeName().c_str());
1229 return _RemoveSingleApplyAPI(*schemaInfo);
1253 template <
typename SchemaType>
1256 "Provided type must derive UsdAPISchemaBase.");
1258 "Provided type must not be UsdAPISchemaBase.");
1260 "Provided schema type must be a multiple apply API schema.");
1263 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1266 "UsdSchemaRegistry as a schema type. The schema may need to be "
1268 TfType::Find<SchemaType>().
GetTypeName().c_str());
1271 return _RemoveMultipleApplyAPI(*schemaInfo, instanceName);
1282 const TfToken& instanceName)
const;
1294 const TfToken& instanceName)
const;
1308 const TfToken& instanceName)
const;
1509 return UsdPrim(prim, proxyPrimPath);
1674 const std::vector<std::string> &nameElts,
1683 const std::vector<std::string> &nameElts,
1724 std::function<
bool (
UsdAttribute const &)>
const &pred =
nullptr,
1725 bool recurseOnSources =
false)
const;
1769 bool custom=
true)
const;
1819 bool recurseOnTargets =
false)
const;
1968 bool instanceable =
false;
1969 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1976 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2154 :
UsdObject(primData, proxyPrimPath) { }
2161 :
UsdObject(objType, prim, proxyPrimPath, propName) {}
2172 std::vector<UsdProperty>
2178 bool applyOrder=
true,
2182 std::vector<UsdProperty>
2183 _GetPropertiesInNamespace(
const std::string &namespaces,
2184 bool onlyAuthored)
const;
2187 std::vector<UsdAttribute>
2188 _GetAttributes(
bool onlyAuthored,
bool applyOrder=
false)
const;
2191 std::vector<UsdRelationship>
2192 _GetRelationships(
bool onlyAuthored,
bool applyOrder=
false)
const;
2205 {
return _Prim()->GetSourcePrimIndex(); }
2210 _MakeResolveTargetFromEditTarget(
2212 bool makeAsStrongerThan)
const;
2226 typedef unspecified-integral-
type difference_type;
2230 unspecified-
type operator->()
const;
2255 typedef unspecified-integral-
type difference_type;
2259 typedef iterator::reference reference;
2266 template <
class ForwardRange>
2270 template <
class ForwardRange>
2274 iterator
begin()
const;
2277 iterator
end()
const;
2280 operator unspecified_bool_type()
const;
2283 bool equal(
const iterator_range&)
const;
2286 reference front()
const;
2289 iterator_range& advance_begin(difference_type
n);
2292 iterator_range& advance_end(difference_type
n);
2311 UsdPrimSiblingIterator,
2312 const Usd_PrimData *,
2314 hboost::forward_traversal_tag,
2327 : iterator_adaptor_(i)
2328 , _proxyPrimPath(proxyPrimPath)
2329 , _predicate(predicate) {
2331 if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
2338 return base() == other.base() &&
2339 _proxyPrimPath == other._proxyPrimPath &&
2340 _predicate == other._predicate;
2344 base_type &base = base_reference();
2351 reference dereference()
const {
2352 return UsdPrim(base(), _proxyPrimPath);
2365 UsdPrimSiblingRange> : std::true_type {};
2368 const UsdPrimSiblingRange> : std::true_type {};
2376 return _MakeSiblingRange(
2398 firstChild =
nullptr;
2418 typedef unspecified-integral-
type difference_type;
2422 unspecified-
type operator->()
const;
2447 typedef unspecified-integral-
type difference_type;
2451 typedef iterator::reference reference;
2458 template <
class ForwardRange>
2462 template <
class ForwardRange>
2466 iterator
begin()
const;
2469 iterator
end()
const;
2472 operator unspecified_bool_type()
const;
2475 bool equal(
const iterator_range&)
const;
2478 reference front()
const;
2481 iterator_range& advance_begin(difference_type
n);
2484 iterator_range& advance_end(difference_type
n);
2503 UsdPrimSubtreeIterator,
2504 const Usd_PrimData *,
2506 hboost::forward_traversal_tag,
2519 : iterator_adaptor_(i)
2520 , _proxyPrimPath(proxyPrimPath)
2521 , _predicate(predicate) {
2523 base_type &base = base_reference();
2524 if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
2536 return base() == other.base() &&
2537 _proxyPrimPath == other._proxyPrimPath &&
2538 _predicate == other._predicate;
2542 base_type &base = base_reference();
2549 reference dereference()
const {
2550 return UsdPrim(base(), _proxyPrimPath);
2563 UsdPrimSubtreeRange> : std::true_type {};
2566 const UsdPrimSubtreeRange> : std::true_type {};
2573 return _MakeDescendantsRange(
2595 SdfPath endChildPath = firstChildPath;
2612 return UsdPrim(_prim, _proxyPrimPath);
2617 #endif // PXR_USD_USD_PRIM_H
bool HasAPIInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy, const TfToken &instanceName) const
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
USD_API UsdResolveTarget MakeResolveTargetStrongerThanEditTarget(const UsdEditTarget &editTarget) const
Usd_PrimFlagsPredicate Usd_CreatePredicateForTraversal(const PrimDataPtr &p, const SdfPath &proxyPrimPath, Usd_PrimFlagsPredicate pred)
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
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
bool HasAuthoredInstanceable() const
USD_API bool IsInFamily(const TfToken &schemaFamily) const
UsdPrimSiblingRange SiblingRange
void ClearPropertyOrder() const
GLsizei const GLchar *const * path
USD_API UsdRelationship CreateRelationship(const TfToken &relName, bool custom=true) const
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
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
USD_API UsdProperty GetPropertyAtPath(const SdfPath &path) const
USD_API UsdPrim GetPrimAtPath(const SdfPath &path) const
USD_API bool GetVersionIfHasAPIInFamily(const TfToken &schemaFamily, UsdSchemaVersion *schemaVersion) 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 bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const
USD_API std::vector< UsdProperty > GetAuthoredProperties(const PropertyPredicateFunc &predicate={}) const
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
bool HasAPI(const TfToken &instanceName) const
USD_API UsdPrim GetPrototype() const
USD_API TfTokenVector GetPropertyNames(const PropertyPredicateFunc &predicate={}) const
USD_API std::vector< UsdProperty > GetProperties(const PropertyPredicateFunc &predicate={}) const
GLenum GLuint GLint GLint layer
friend struct UsdPrim_AttrConnectionFinder
unsigned int UsdSchemaVersion
Schema versions are specified as a single unsigned integer value.
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 IsInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
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.
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.
GLdouble GLdouble GLint GLint order
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.
GLuint const GLchar * name
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 UsdResolveTarget MakeResolveTargetUpToEditTarget(const UsdEditTarget &editTarget) 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
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
bool HasAPIInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
USD_API TfTokenVector GetChildrenNames() const
USD_API UsdSpecializes GetSpecializes() const
const TfToken & GetTypeName() const
USD_API std::vector< std::pair< SdfPrimSpecHandle, SdfLayerOffset > > GetPrimStackWithLayerOffsets() const
#define PXR_NAMESPACE_CLOSE_SCOPE
USD_API TfTokenVector GetChildrenReorder() const
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
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 bool HasAPIInFamily(const TfToken &schemaFamily) 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
USD_API bool GetVersionIfIsInFamily(const TfToken &schemaFamily, UsdSchemaVersion *schemaVersion) 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
UsdSchemaVersion version
The version number of the schema within its schema family.
USD_API bool HasPayload() const
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
Multiple Apply API Schema.
Load a prim plus all its descendants.
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.