24 #ifndef PXR_USD_USD_PRIM_H 25 #define PXR_USD_USD_PRIM_H 30 #include "pxr/usd/usd/api.h" 34 #include "pxr/usd/usd/schemaRegistry.h" 36 #include "pxr/usd/sdf/schema.h" 44 #include "pxr/usd/sdf/path.h" 46 #include <boost/iterator/iterator_adaptor.hpp> 47 #include <boost/range/iterator_range.hpp> 50 #include <type_traits> 53 PXR_NAMESPACE_OPEN_SCOPE
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);
240 bool IsActive()
const {
return _Prim()->IsActive(); }
270 bool IsLoaded()
const {
return _Prim()->IsLoaded(); }
274 bool IsModel()
const {
return _Prim()->IsModel(); }
279 bool IsGroup()
const {
return _Prim()->IsGroup(); }
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(
512 std::string *whyNot)
const;
515 bool _CanApplyMultipleApplyAPI(
518 std::string *whyNot)
const;
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>
551 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
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;
569 UsdSchemaVersion schemaVersion)
const;
588 UsdSchemaVersion schemaVersion,
595 template <
typename SchemaType>
598 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
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,
642 UsdSchemaVersion *schemaVersion)
const;
698 template <
typename SchemaType>
701 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
702 "Provided type must derive UsdAPISchemaBase.");
703 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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>
721 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
722 "Provided type must derive UsdAPISchemaBase.");
723 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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;
758 UsdSchemaVersion schemaVersion)
const;
765 UsdSchemaVersion schemaVersion,
766 const TfToken& instanceName)
const;
782 const TfToken &schemaFamily)
const;
792 const TfToken &instanceName)
const;
805 UsdSchemaVersion schemaVersion,
817 UsdSchemaVersion schemaVersion,
819 const TfToken &instanceName)
const;
825 template <
typename SchemaType>
828 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
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 {
851 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
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;
929 UsdSchemaVersion *schemaVersion)
const;
948 UsdSchemaVersion *schemaVersion)
const;
968 template <
typename SchemaType>
970 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
971 "Provided type must derive UsdAPISchemaBase.");
972 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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>
1004 std::string *whyNot =
nullptr)
const {
1005 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1006 "Provided type must derive UsdAPISchemaBase.");
1007 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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);
1028 std::string *whyNot =
nullptr)
const;
1036 std::string *whyNot =
nullptr)
const;
1042 std::string *whyNot =
nullptr)
const;
1051 std::string *whyNot =
nullptr)
const;
1057 UsdSchemaVersion schemaVersion,
1058 std::string *whyNot =
nullptr)
const;
1066 UsdSchemaVersion schemaVersion,
1068 std::string *whyNot =
nullptr)
const;
1091 template <
typename SchemaType>
1093 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1094 "Provided type must derive UsdAPISchemaBase.");
1095 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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>
1134 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1135 "Provided type must derive UsdAPISchemaBase.");
1136 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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;
1179 UsdSchemaVersion schemaVersion)
const;
1186 UsdSchemaVersion schemaVersion,
1187 const TfToken& instanceName)
const;
1211 template <
typename SchemaType>
1213 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1214 "Provided type must derive UsdAPISchemaBase.");
1215 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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>
1255 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1256 "Provided type must derive UsdAPISchemaBase.");
1257 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
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;
1300 UsdSchemaVersion schemaVersion)
const;
1307 UsdSchemaVersion schemaVersion,
1308 const TfToken& instanceName)
const;
1426 const Usd_PrimFlagsPredicate &predicate)
const;
1506 Usd_PrimDataConstPtr prim = get_pointer(_Prim());
1507 SdfPath proxyPrimPath = _ProxyPrimPath();
1508 Usd_MoveToParent(prim, proxyPrimPath);
1509 return UsdPrim(prim, proxyPrimPath);
1530 const Usd_PrimFlagsPredicate &predicate)
const;
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;
1855 const std::string& assetPath,
const SdfPath& primPath)
const;
1968 bool instanceable =
false;
1969 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1976 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2002 return Usd_IsInstanceProxy(_Prim(), _ProxyPrimPath());
2146 friend class Usd_PrimData;
2147 friend class Usd_PrimFlagsPredicate;
2148 friend struct UsdPrim_RelTargetFinder;
2149 friend struct UsdPrim_AttrConnectionFinder;
2152 UsdPrim(
const Usd_PrimDataHandle &primData,
2154 :
UsdObject(primData, proxyPrimPath) { }
2158 const Usd_PrimDataHandle &prim,
2161 :
UsdObject(objType, prim, proxyPrimPath, propName) {}
2165 _MakeSiblingRange(
const Usd_PrimFlagsPredicate &pred)
const;
2169 _MakeDescendantsRange(
const Usd_PrimFlagsPredicate &pred)
const;
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;
2266 template <
class ForwardRange>
2270 template <
class ForwardRange>
2280 operator unspecified_bool_type()
const;
2283 bool equal(
const iterator_range&)
const;
2311 UsdPrimSiblingIterator,
2312 const Usd_PrimData *,
2314 boost::forward_traversal_tag,
2326 const Usd_PrimFlagsPredicate &predicate)
2327 : iterator_adaptor_(i)
2328 , _proxyPrimPath(proxyPrimPath)
2329 , _predicate(predicate) {
2331 if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
2336 friend class boost::iterator_core_access;
2338 return base() == other.base() &&
2339 _proxyPrimPath == other._proxyPrimPath &&
2340 _predicate == other._predicate;
2344 base_type &base = base_reference();
2345 if (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath, _predicate)) {
2352 return UsdPrim(base(), _proxyPrimPath);
2356 Usd_PrimFlagsPredicate _predicate;
2364 struct Tf_ShouldIterateOverCopy<
2367 struct Tf_ShouldIterateOverCopy<
2376 return _MakeSiblingRange(
2377 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2394 UsdPrim::_MakeSiblingRange(
const Usd_PrimFlagsPredicate &pred)
const {
2395 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2396 SdfPath firstChildPath = _ProxyPrimPath();
2397 if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2398 firstChild =
nullptr;
2402 return SiblingRange(
2458 template <
class ForwardRange>
2462 template <
class ForwardRange>
2472 operator unspecified_bool_type()
const;
2475 bool equal(
const iterator_range&)
const;
2503 UsdPrimSubtreeIterator,
2504 const Usd_PrimData *,
2506 boost::forward_traversal_tag,
2518 const Usd_PrimFlagsPredicate &predicate)
2519 : iterator_adaptor_(i)
2520 , _proxyPrimPath(proxyPrimPath)
2521 , _predicate(predicate) {
2523 base_type &base = base_reference();
2524 if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
2525 if (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath,
2534 friend class boost::iterator_core_access;
2536 return base() == other.base() &&
2537 _proxyPrimPath == other._proxyPrimPath &&
2538 _predicate == other._predicate;
2542 base_type &base = base_reference();
2543 if (!Usd_MoveToChild(base, _proxyPrimPath, _predicate)) {
2544 while (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath,
2550 return UsdPrim(base(), _proxyPrimPath);
2554 Usd_PrimFlagsPredicate _predicate;
2562 struct Tf_ShouldIterateOverCopy<
2565 struct Tf_ShouldIterateOverCopy<
2573 return _MakeDescendantsRange(
2574 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2591 UsdPrim::_MakeDescendantsRange(
const Usd_PrimFlagsPredicate &pred)
const {
2592 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2593 SdfPath firstChildPath = _ProxyPrimPath();
2594 Usd_PrimDataConstPtr endChild = firstChild;
2595 SdfPath endChildPath = firstChildPath;
2596 if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2597 while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
2600 return SubtreeRange(
2612 return UsdPrim(_prim, _proxyPrimPath);
2615 PXR_NAMESPACE_CLOSE_SCOPE
2617 #endif // PXR_USD_USD_PRIM_H const UsdPrimTypeInfo & GetPrimTypeInfo() const
Return the prim's full type info composed from its type name, applied API schemas,...
void ClearPropertyOrder() const
Remove the opinion for propertyOrder metadata on this prim at the current EditTarget.
A proxy class for applying listOp edits to the specializes list for a prim.
bool SetMetadata(const TfToken &key, const T &value) const
Set metadatum key's value to value.
iterator::value_type value_type
Iterator value_type.
USD_API std::vector< UsdRelationship > GetAuthoredRelationships() const
Like GetRelationships(), but exclude relationships without authored scene description from the result...
bool HasAPIInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy, const TfToken &instanceName) const
Overload for convenience of HasAPIInFamily that finds a registered schema for the C++ schema class Sc...
unspecified integral type difference_type
Iterator difference type.
USD_API bool HasAttribute(const TfToken &attrName) const
Return true if this prim has an attribute named attrName, false otherwise.
UsdObjType
Enum values to represent the various Usd object types.
bool SetSpecifier(SdfSpecifier specifier) const
Author an opinion for this Prim's specifier at the current edit target.
USD_API bool HasAuthoredPayloads() const
Return true if this prim has any authored payloads.
USD_API bool AddAppliedSchema(const TfToken &appliedSchemaName) const
Adds the applied API schema name token appliedSchemaName to the apiSchemas metadata for this prim at ...
bool empty() const
Return begin() == end().
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
bool CanApplyAPI(std::string *whyNot=nullptr) const
Returns whether a single-apply API schema with the given C++ type SchemaType can be applied to this p...
unspecified UsdPrimDefaultPredicate
The default predicate used for prim traversals in methods like UsdPrim::GetChildren,...
USD_API UsdInherits GetInherits() const
Return a UsdInherits object that allows one to add, remove, or mutate inherits at the currently set U...
Standard pointer typedefs.
friend bool operator!=(const UsdPrimSubtreeIterator &lhs, const UsdPrimSubtreeIterator &rhs)
Inequality.
iterator end() const
Past-the-end iterator.
SubtreeRange GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const
Return a subset of all of this prim's descendants filtered by predicate as an iterable range.
value_type reference
Iterator reference type, in this case the same as value_type.
friend bool operator==(const UsdPrimSiblingIterator &lhs, const UsdPrimSiblingIterator &rhs)
Equality.
bool CanApplyAPI(const TfToken &instanceName, std::string *whyNot=nullptr) const
Returns whether a multiple-apply API schema with the given C++ type SchemaType can be applied to this...
bool IsGroup() const
Return true if this prim is a model group based on its kind metadata, false otherwise.
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
UsdPrimSiblingIterator iterator
Iterator type.
void SetChildrenReorder(const TfTokenVector &order) const
Author an opinion for the metadata used to reorder children of this prim at the current EditTarget.
friend bool operator!=(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
USD_API UsdProperty GetProperty(const TfToken &propName) const
Return a UsdProperty with the name propName.
USD_API std::vector< UsdAttribute > GetAttributes() const
Like GetProperties(), but exclude all relationships from the result.
USD_API UsdAttribute CreateAttribute(const TfToken &name, const SdfValueTypeName &typeName, bool custom, SdfVariability variability=SdfVariabilityVarying) const
Author scene description for the attribute named attrName at the current EditTarget if none already e...
UsdPrim value_type
Iterator value type.
bool IsActive() const
Return true if this prim is active, meaning neither it nor any of its ancestors have active=false.
bool ClearInstanceable() const
Remove the authored 'instanceable' opinion at the current EditTarget.
bool HasAuthoredInstanceable() const
Return true if this prim has an authored opinion for 'instanceable', false otherwise.
friend bool operator!=(const UsdPrimSiblingIterator &lhs, const UsdPrimSiblingIterator &rhs)
Inequality.
USD_API UsdReferences GetReferences() const
Return a UsdReferences object that allows one to add, remove, or mutate references at the currently s...
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
USD_API std::vector< UsdProperty > GetProperties(const PropertyPredicateFunc &predicate={}) const
Return all of this prim's properties (attributes and relationships), including all builtin properties...
bool empty() const
Return begin() == end().
SubtreeRange GetDescendants() const
Return this prim's active, loaded, defined, non-abstract descendants as an iterable range.
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
friend bool operator==(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Represents a value type name, i.e.
Load a prim plus all its descendants.
bool IsInstanceable() const
Return true if this prim has been marked as instanceable.
A proxy class for applying listOp edits to the inherit paths list for a prim.
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
static USD_API bool IsPathInPrototype(const SdfPath &path)
Return true if the given path identifies a prototype prim or a prim or property descendant of a proto...
UsdPrimSiblingIterator & operator++()
Postincrement.
bool HasAPIInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of HasAPIInFamily that finds a registered schema for the C++ schema class Sc...
unspecified integral type difference_type
Iterator difference type.
USD_API TfTokenVector GetChildrenNames() const
Return the names of the child prims in the order they appear when iterating over GetChildren.
USD_API bool HasAuthoredInherits() const
Return true if this prim has any authored inherits.
USD_API UsdPrim GetFilteredNextSibling(const Usd_PrimFlagsPredicate &predicate) const
Return this prim's next sibling that matches predicate if it has one, otherwise return the invalid Us...
USD_API std::vector< UsdProperty > GetAuthoredPropertiesInNamespace(const std::vector< std::string > &namespaces) const
Like GetPropertiesInNamespace(), but exclude properties that do not have authored scene description f...
The base class for all API schemas.
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
Retrieve a specifically named VariantSet for editing or constructing a UsdEditTarget.
bool IsInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of IsInFamily that finds a registered schema for the C++ schema class Schema...
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
USD_API UsdPrim GetChild(const TfToken &name) const
Return this prim's direct child named name if it has one, otherwise return an invalid UsdPrim.
USD_API bool RemoveProperty(const TfToken &propName)
Remove all scene description for the property with the given propName in the current UsdEditTarget.
bool IsInstance() const
Return true if this prim is an instance of a prototype, false otherwise.
USD_API bool GetVersionIfHasAPIInFamily(const TfToken &schemaFamily, UsdSchemaVersion *schemaVersion) const
Return true if the prim has an applied API schema that is any version the schemas in the given schema...
USD_API void Load(UsdLoadPolicy policy=UsdLoadWithDescendants) const
Load this prim, all its ancestors, and by default all its descendants.
USD_API bool HasAuthoredSpecializes() const
Returns true if this prim has any authored specializes.
bool IsInPrototype() const
Return true if this prim is a prototype prim or a descendant of a prototype prim, false otherwise.
bool equal(const iterator_range &) const
Equality compare.
USD_API TfTokenVector GetPropertyOrder() const
Return the strongest propertyOrder metadata value authored on this prim.
USD_API bool IsPseudoRoot() const
Returns true if the prim is the pseudo root.
Forward iterator range of sibling UsdPrim s.
UsdReferences provides an interface to authoring and introspecting references in Usd.
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
Return a UsdAttribute with the name attrName.
UsdSchemaVersion version
The version number of the schema within its schema family.
USD_API bool HasAuthoredReferences() const
Return true if this prim has any authored references.
UsdPrimSubtreeIterator iterator
Iterator type.
iterator::value_type value_type
Iterator value_type.
USD_API bool HasRelationship(const TfToken &relName) const
Return true if this prim has a relationship named relName, false otherwise.
USD_API SdfPathVector FindAllRelationshipTargetPaths(std::function< bool(UsdRelationship const &)> const &pred=nullptr, bool recurseOnTargets=false) const
Search the prim subtree rooted at this prim for relationships for which predicate returns true,...
reference front() const
Return *begin(). This range must not be empty.
bool HasAPI(const TfToken &instanceName) const
Return true if the UsdPrim has the specific instance, instanceName, of the multiple-apply API schema ...
void SetPropertyOrder(const TfTokenVector &order) const
Author an opinion for propertyOrder metadata on this prim at the current EditTarget.
Token for efficient comparison, assignment, and hashing of known strings.
bool SetInstanceable(bool instanceable) const
Author 'instanceable' metadata for this prim at the current EditTarget.
USD_API PcpPrimIndex ComputeExpandedPrimIndex() const
Compute the prim index containing all sites that could contribute opinions to this prim.
bool RemoveAPI() const
Removes a single-apply API schema with the given C++ type SchemaType from this prim in the current ed...
reference operator *() const
Dereference.
unspecified integral type difference_type
Iterator difference type.
iterator_range & advance_end(difference_type n)
Advance this range's end iterator.
USD_API bool ClearMetadata(const TfToken &key) const
Clears the authored key's value at the current EditTarget, returning false on error.
iterator begin() const
First iterator.
const UsdPrimDefinition & GetPrimDefinition() const
Return this prim's definition based on the prim's type if the type is a registered prim type.
TfToken family
The name of the family of schema's which the schema is a version of.
UsdPrimSiblingRange(UsdPrimSiblingIterator begin, UsdPrimSiblingIterator end)
Construct with a pair of iterators.
const PcpPrimIndex & GetPrimIndex() const
Return the cached prim index containing all sites that can contribute opinions to this prim.
UsdPrimSubtreeIterator & operator++()
Postincrement.
bool IsAbstract() const
Return true if this prim or any of its ancestors is a class.
USD_API TfTokenVector GetAuthoredPropertyNames(const PropertyPredicateFunc &predicate={}) const
Return this prim's property names (attributes and relationships) that have authored scene description...
USD_API bool HasProperty(const TfToken &propName) const
Return true if this prim has an property named propName, false otherwise.
USD_API bool SetPayload(const SdfPayload &payload) const
USD_API std::vector< UsdProperty > GetPropertiesInNamespace(const std::vector< std::string > &namespaces) const
Return this prim's properties that are inside the given property namespace ordered according to the s...
A UsdVariantSet represents a single VariantSet in USD (e.g.
bool ApplyAPI() const
Applies a single-apply API schema with the given C++ type SchemaType to this prim in the current edit...
Forward iterator range of sibling UsdPrim s.
USD_API TfTokenVector GetAllChildrenNames() const
Return the names of the child prims in the order they appear when iterating over GetAllChildren.
USD_API UsdPrim GetPrototype() const
If this prim is an instance, return the UsdPrim for the corresponding prototype.
UsdPrim GetParent() const
Return this prim's parent prim.
SiblingRange GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const
Return a subset of all of this prim's children filtered by predicate as an iterable range.
SiblingRange GetChildren() const
Return this prim's active, loaded, defined, non-abstract children as an iterable range.
USD_API bool IsInFamily(const TfToken &schemaFamily) const
Return true if the prim's schema type is or inherits from the schema type of any version of the schem...
Base class for Usd scenegraph objects, providing common API.
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Represents a payload and all its meta data.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
UsdPrimSiblingRange & operator=(const ForwardRange &r)
Assign from another compatible range type.
bool IsA() const
Return true if the prim's schema type, is or inherits from the TfType of the schema class type Schema...
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
UsdPrim value_type
Iterator value type.
std::vector< TfToken > TfTokenVector
Convenience types.
friend bool operator==(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
bool IsInstanceProxy() const
Return true if this prim is an instance proxy, false otherwise.
UsdPrimSubtreeRange & operator=(const ForwardRange &r)
Assign from another compatible range type.
const TfToken & GetTypeName() const
Return this prim's composed type name.
SubtreeRange GetAllDescendants() const
Return all this prim's descendants as an iterable range.
unspecified type operator->() const
Indirection.
USD_API bool HasVariantSets() const
Return true if this prim has any authored VariantSets.
bool HasAPI() const
Return true if the UsdPrim has had an applied API schema represented by the C++ class type SchemaType...
USD_API UsdVariantSets GetVariantSets() const
Return a UsdVariantSets object representing all the VariantSets present on this prim.
A path value used to locate objects in layers or scenegraphs.
USD_API UsdResolveTarget MakeResolveTargetUpToEditTarget(const UsdEditTarget &editTarget) const
Creates and returns a resolve target that, when passed to a UsdAttributeQuery for one of this prim's ...
USD_API bool ClearPayload() const
bool GetMetadata(const TfToken &key, T *value) const
Resolve the requested metadatum named key into value, returning true on success.
iterator_range & advance_begin(difference_type n)
Advance this range's begin iterator.
VersionPolicy
A policy for filtering by schema version when querying for schemas in a particular schema family.
iterator::reference reference
Iterator reference_type.
USD_API bool HasPayload() const
USD_API UsdResolveTarget MakeResolveTargetStrongerThanEditTarget(const UsdEditTarget &editTarget) const
Creates and returns a resolve target that, when passed to a UsdAttributeQuery for one of this prim's ...
UsdPayloads provides an interface to authoring and introspecting payloads.
bool HasAuthoredActive() const
Return true if this prim has an authored opinion for 'active', false otherwise.
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
USD_API TfTokenVector GetPropertyNames(const PropertyPredicateFunc &predicate={}) const
Return all of this prim's property names (attributes and relationships), including all builtin proper...
USD_API SdfPathVector FindAllAttributeConnectionPaths(std::function< bool(UsdAttribute const &)> const &pred=nullptr, bool recurseOnSources=false) const
Search the prim subtree rooted at this prim for attributes for which predicate returns true,...
USD_API UsdRelationship GetRelationshipAtPath(const SdfPath &path) const
Returns the relationship at path on the same stage as this prim.
unspecified type operator->() const
Indirection.
USD_API void Unload() const
Unloads this prim and all its descendants.
SdfVariability
An enum that identifies variability types for attributes.
bool ClearTypeName() const
Clear the opinion for this Prim's typeName at the current edit target.
Class that holds the full type information for a prim.
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
bool RemoveAPI(const TfToken &instanceName) const
Removes a multiple-apply API schema with the given C++ type 'SchemaType' and instance name instanceNa...
USD_API std::vector< UsdPrim > GetInstances() const
If this prim is a prototype prim, returns all prims that are instances of this prototype.
friend bool operator==(const UsdPrimSubtreeIterator &lhs, const UsdPrimSubtreeIterator &rhs)
Equality.
UsdLoadPolicy
Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or not descendant prims are ...
Multiple Apply API Schema.
UsdPrim GetPrimInPrototype() const
If this prim is an instance proxy, return the UsdPrim for the corresponding prim in the instance's pr...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
USD_API std::vector< std::pair< SdfPrimSpecHandle, SdfLayerOffset > > GetPrimStackWithLayerOffsets() const
Return all the authored SdfPrimSpecs that may contain opinions for this prim in order from strong to ...
bool ClearActive() const
Remove the authored 'active' opinion at the current EditTarget.
bool SetTypeName(const TfToken &typeName) const
Author this Prim's typeName at the current EditTarget.
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
const SdfPath & GetPrimPath() const
Return this object's path if this object is a prim, otherwise this object's nearest owning prim's pat...
bool HasAuthoredTypeName() const
Return true if a typeName has been authored.
void ClearChildrenReorder() const
Remove the opinion for the metadata used to reorder children of this prim at the current EditTarget.
bool IsModel() const
Return true if this prim is a model based on its kind metadata, false otherwise.
bool IsLoaded() const
Return true if this prim is active, and either it is loadable and it is loaded, or its nearest loadab...
unspecified integral type difference_type
Iterator difference type.
Class representing the builtin definition of a prim given the schemas registered in the schema regist...
reference operator *() const
Dereference.
bool IsPrototype() const
Return true if this prim is an instancing prototype prim, false otherwise.
Forward traversal iterator of sibling UsdPrim s.
unspecified UsdPrimAllPrimsPredicate
Predicate that includes all prims.
iterator begin() const
First iterator.
USD_API bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const
Removes the applied API schema name token appliedSchemaName from the apiSchemas metadata for this pri...
UsdPrim()
Construct an invalid prim.
std::function< bool(const TfToken &propertyName)> PropertyPredicateFunc
Alias for the "predicate" function parameter passed into the various Get{Authored}{PropertyNames,...
reference front() const
Return *begin(). This range must not be empty.
TfType represents a dynamic runtime type.
UsdPrimSubtreeIterator SubtreeIterator
Convenience typedefs.
bool IsDefined() const
Return true if this prim and all its ancestors have defining specifiers, false otherwise.
USD_API SdfPrimSpecHandleVector GetPrimStack() const
Return all the authored SdfPrimSpecs that may contain opinions for this prim in order from strong to ...
bool equal(const iterator_range &) const
Equality compare.
USD_API TfTokenVector GetAppliedSchemas() const
Return a vector containing the names of API schemas which have been applied to this prim.
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
USD_API UsdSpecializes GetSpecializes() const
Return a UsdSpecializes object that allows one to add, remove, or mutate specializes at the currently...
USD_API UsdPrim GetPrimAtPath(const SdfPath &path) const
Returns the prim at path on the same stage as this prim.
UsdPrimSiblingIterator const_iterator
Const iterator type.
USD_API UsdObject GetObjectAtPath(const SdfPath &path) const
Returns the object at path on the same stage as this prim.
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
iterator end() const
Past-the-end iterator.
bool SetActive(bool active) const
Author 'active' metadata for this prim at the current EditTarget.
UsdPrimSubtreeIterator const_iterator
Const iterator type.
The base class for all schema types in Usd.
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
Return a UsdRelationship with the name relName.
iterator::reference reference
Iterator reference_type.
Forward traversal iterator of sibling UsdPrim s.
USD_API UsdAttribute GetAttributeAtPath(const SdfPath &path) const
Returns the attribute at path on the same stage as this prim.
USD_API UsdPrim GetNextSibling() const
Return this prim's next active, loaded, defined, non-abstract sibling if it has one,...
USD_API UsdProperty GetPropertyAtPath(const SdfPath &path) const
Returns the property at path on the same stage as this prim.
USD_API TfTokenVector GetFilteredChildrenNames(const Usd_PrimFlagsPredicate &predicate) const
Return the names of the child prims in the order they appear when iterating over GetFilteredChildren(...
USD_API UsdPayloads GetPayloads() const
Return a UsdPayloads object that allows one to add, remove, or mutate payloads at the currently set U...
iterator_range & advance_end(difference_type n)
Advance this range's end iterator.
Structure that holds the information about a schema that is registered with the schema registry.
UsdPrim GetPrim() const
Return this object if it is a prim, otherwise return this object's nearest owning prim.
USD_API bool GetVersionIfIsInFamily(const TfToken &schemaFamily, UsdSchemaVersion *schemaVersion) const
Return true if the prim's schema type, is or inherits from the schema type of any version the schema ...
USD_API bool HasAPIInFamily(const TfToken &schemaFamily) const
Return true if the prim has an applied API schema that is any version of the schemas in the given sch...
USD_API TfTokenVector GetChildrenReorder() const
Return the strongest opinion for the metadata used to reorder children of this prim.
UsdPrimSubtreeRange(UsdPrimSubtreeIterator begin, UsdPrimSubtreeIterator end)
Construct with a pair of iterators.
static USD_API bool IsPrototypePath(const SdfPath &path)
Return true if the given path identifies a prototype prim, false otherwise.
USD_API bool HasAuthoredMetadata(const TfToken &key) const
Returns true if the key has an authored value, false if no value was authored or the only value avail...
USD_API UsdRelationship CreateRelationship(const TfToken &relName, bool custom=true) const
Author scene description for the relationship named relName at the current EditTarget if none already...
value_type reference
Iterator reference type, in this case the same as value_type.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
USD_API std::vector< UsdRelationship > GetRelationships() const
Like GetProperties(), but exclude all attributes from the result.
bool ApplyAPI(const TfToken &instanceName) const
Applies a multiple-apply API schema with the given C++ type SchemaType and instance name instanceName...
USD_API std::vector< UsdAttribute > GetAuthoredAttributes() const
Like GetAttributes(), but exclude attributes without authored scene description from the result.
iterator_range & advance_begin(difference_type n)
Advance this range's begin iterator.
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
bool HasDefiningSpecifier() const
Return true if this prim has a specifier of type SdfSpecifierDef or SdfSpecifierClass.
USD_API std::vector< UsdProperty > GetAuthoredProperties(const PropertyPredicateFunc &predicate={}) const
Return this prim's properties (attributes and relationships) that have authored scene description,...