All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
prim.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_PRIM_H
8#define PXR_USD_USD_PRIM_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usd/api.h"
14#include "pxr/usd/usd/common.h"
15#include "pxr/usd/usd/object.h"
17#include "pxr/usd/usd/schemaRegistry.h"
18
19#include "pxr/usd/sdf/schema.h"
21
23#include "pxr/base/tf/refBase.h"
24#include "pxr/base/tf/token.h"
26
27#include "pxr/usd/sdf/path.h"
28
29#include <iterator>
30#include <string>
31#include <type_traits>
32#include <vector>
33
34PXR_NAMESPACE_OPEN_SCOPE
35
36class UsdPrim;
38class UsdPrimRange;
39class Usd_PrimData;
40
41class UsdAttribute;
42class UsdEditTarget;
43class UsdRelationship;
44class UsdPayloads;
45class UsdReferences;
47class UsdSchemaBase;
49class UsdInherits;
50class UsdSpecializes;
51class UsdVariantSets;
52class UsdVariantSet;
53
54class SdfPayload;
55
58
61
116class UsdPrim : public UsdObject
117{
118public:
122
126
128 UsdPrim() : UsdObject(_Null<UsdPrim>()) {}
129
141 return _Prim()->GetPrimTypeInfo();
142 }
143
148 return _Prim()->GetPrimDefinition();
149 }
150
152 SdfSpecifier GetSpecifier() const { return _Prim()->GetSpecifier(); };
153
167 USD_API
168 SdfPrimSpecHandleVector GetPrimStack() const;
169
182 USD_API
183 std::vector<std::pair<SdfPrimSpecHandle, SdfLayerOffset>>
185
188 bool SetSpecifier(SdfSpecifier specifier) const {
189 return SetMetadata(SdfFieldKeys->Specifier, specifier);
190 }
191
199 const TfToken &GetTypeName() const { return _Prim()->GetTypeName(); };
200
202 bool SetTypeName(const TfToken & typeName) const {
203 return SetMetadata(SdfFieldKeys->TypeName, typeName);
204 }
205
208 bool ClearTypeName() const {
209 return ClearMetadata(SdfFieldKeys->TypeName);
210 }
211
213 bool HasAuthoredTypeName() const {
214 return HasAuthoredMetadata(SdfFieldKeys->TypeName);
215 }
216
221 bool IsActive() const { return _Prim()->IsActive(); }
222
227 bool SetActive(bool active) const {
228 return SetMetadata(SdfFieldKeys->Active, active);
229 }
230
236 bool ClearActive() const {
237 return ClearMetadata(SdfFieldKeys->Active);
238 }
239
244 bool HasAuthoredActive() const {
245 return HasAuthoredMetadata(SdfFieldKeys->Active);
246 }
247
251 bool IsLoaded() const { return _Prim()->IsLoaded(); }
252
255 bool IsModel() const { return _Prim()->IsModel(); }
256
263 bool IsGroup() const { return _Prim()->IsGroup(); }
264
268 bool IsComponent() const { return _Prim()->IsComponent(); }
269
276 USD_API
277 bool IsSubComponent() const { return _Prim()->IsSubComponent(); }
278
280 bool IsAbstract() const { return _Prim()->IsAbstract(); }
281
284 bool IsDefined() const { return _Prim()->IsDefined(); }
285
288 bool HasDefiningSpecifier() const {
289 return _Prim()->HasDefiningSpecifier();
290 }
291
298 USD_API
300
304 std::function<bool (const TfToken &propertyName)>;
305
317 USD_API
319 const PropertyPredicateFunc &predicate={}) const;
320
334 USD_API
336 const PropertyPredicateFunc &predicate={}) const;
337
381 USD_API
382 std::vector<UsdProperty> GetProperties(
383 const PropertyPredicateFunc &predicate={}) const;
384
398 USD_API
399 std::vector<UsdProperty> GetAuthoredProperties(
400 const PropertyPredicateFunc &predicate={}) const;
401
413 USD_API
414 std::vector<UsdProperty>
415 GetPropertiesInNamespace(const std::vector<std::string> &namespaces) const;
416
421 USD_API
422 std::vector<UsdProperty>
423 GetPropertiesInNamespace(const std::string &namespaces) const;
424
430 USD_API
431 std::vector<UsdProperty>
433 const std::vector<std::string> &namespaces) const;
434
440 USD_API
441 std::vector<UsdProperty>
442 GetAuthoredPropertiesInNamespace(const std::string &namespaces) const;
443
445 USD_API
447
450 void SetPropertyOrder(const TfTokenVector &order) const {
451 SetMetadata(SdfFieldKeys->PropertyOrder, order);
452 }
453
456 void ClearPropertyOrder() const {
457 ClearMetadata(SdfFieldKeys->PropertyOrder);
458 }
459
468 USD_API
469 bool RemoveProperty(const TfToken &propName);
470
483 USD_API
484 UsdProperty GetProperty(const TfToken &propName) const;
485
488 USD_API
489 bool HasProperty(const TfToken &propName) const;
490
509 USD_API
510 bool GetKind(TfToken *kind) const;
511
514 USD_API
515 bool SetKind(const TfToken &kind) const;
516
517private:
518 // Helper functions for the public schema query and API schema
519 // authoring functions. The public functions have overloads that take
520 // a type, an identifier, or a family which all are used to find the
521 // SchemaInfo from the schema registry.
522 USD_API
523 bool _IsA(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
524
525 USD_API
526 bool _HasAPI(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
527
528 USD_API
529 bool _HasAPIInstance(
530 const UsdSchemaRegistry::SchemaInfo *schemaInfo,
531 const TfToken &instanceName) const;
532
533 USD_API
534 bool _CanApplySingleApplyAPI(
535 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
536 std::string *whyNot) const;
537
538 USD_API
539 bool _CanApplyMultipleApplyAPI(
540 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
541 const TfToken& instanceName,
542 std::string *whyNot) const;
543
544 USD_API
545 bool _ApplySingleApplyAPI(
546 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
547
548 USD_API
549 bool _ApplyMultipleApplyAPI(
550 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
551 const TfToken &instanceName) const;
552
553 USD_API
554 bool _RemoveSingleApplyAPI(
555 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
556
557 USD_API
558 bool _RemoveMultipleApplyAPI(
559 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
560 const TfToken &instanceName) const;
561
562public:
566
573 template <typename SchemaType>
574 bool IsA() const {
575 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
576 "Provided type must derive UsdSchemaBase.");
577 return _IsA(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
578 };
579
581 USD_API
582 bool IsA(const TfType& schemaType) const;
583
586 USD_API
587 bool IsA(const TfToken& schemaIdentifier) const;
588
591 USD_API
592 bool IsA(const TfToken& schemaFamily,
593 UsdSchemaVersion schemaVersion) const;
594
596
600
603 USD_API
604 bool IsInFamily(const TfToken &schemaFamily) const;
605
609 USD_API
611 const TfToken &schemaFamily,
612 UsdSchemaVersion schemaVersion,
613 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
614
619 template <typename SchemaType>
621 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
622 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
623 "Provided type must derive UsdSchemaBase.");
624 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
625 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
626 if (!schemaInfo) {
627 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
628 "UsdSchemaRegistry as a schema type. The schema may need to be "
629 "regenerated.",
630 TfType::Find<SchemaType>().GetTypeName().c_str());
631 return false;
632 }
633 return IsInFamily(schemaInfo->family, schemaInfo->version,
634 versionPolicy);
635 };
636
641 USD_API
643 const TfType &schemaType,
644 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
645
654 USD_API
656 const TfToken &schemaIdentifier,
657 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
658
663 USD_API
665 const TfToken &schemaFamily,
666 UsdSchemaVersion *schemaVersion) const;
667
669
715
722 template <typename SchemaType>
723 bool
724 HasAPI() const {
725 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
726 "Provided type must derive UsdAPISchemaBase.");
727 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
728 "Provided type must not be UsdAPISchemaBase.");
729 static_assert(
730 SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI ||
731 SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
732 "Provided schema type must be an applied API schema.");
733
734 return _HasAPI(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
735 }
736
742 template <typename SchemaType>
743 bool
744 HasAPI(const TfToken &instanceName) const {
745 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
746 "Provided type must derive UsdAPISchemaBase.");
747 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
748 "Provided type must not be UsdAPISchemaBase.");
749 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
750 "Provided schema type must be a multi apply API schema.");
751
752 return _HasAPIInstance(
753 UsdSchemaRegistry::FindSchemaInfo<SchemaType>(), instanceName);
754 }
755
757 USD_API
758 bool HasAPI(const TfType& schemaType) const;
759
762 USD_API
763 bool HasAPI(const TfType& schemaType,
764 const TfToken& instanceName) const;
765
768 USD_API
769 bool HasAPI(const TfToken& schemaIdentifier) const;
770
774 USD_API
775 bool HasAPI(const TfToken& schemaIdentifier,
776 const TfToken& instanceName) const;
777
780 USD_API
781 bool HasAPI(const TfToken& schemaFamily,
782 UsdSchemaVersion schemaVersion) const;
783
787 USD_API
788 bool HasAPI(const TfToken& schemaFamily,
789 UsdSchemaVersion schemaVersion,
790 const TfToken& instanceName) const;
791
793
797
804 USD_API
806 const TfToken &schemaFamily) const;
807
813 USD_API
815 const TfToken &schemaFamily,
816 const TfToken &instanceName) const;
817
826 USD_API
828 const TfToken &schemaFamily,
829 UsdSchemaVersion schemaVersion,
830 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
831
838 USD_API
840 const TfToken &schemaFamily,
841 UsdSchemaVersion schemaVersion,
843 const TfToken &instanceName) const;
844
849 template <typename SchemaType>
851 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
852 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
853 "Provided type must derive UsdSchemaBase.");
854 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
855 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
856 if (!schemaInfo) {
857 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
858 "UsdSchemaRegistry as a schema type. The schema may need to be "
859 "regenerated.",
860 TfType::Find<SchemaType>().GetTypeName().c_str());
861 return false;
862 }
863 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
864 versionPolicy);
865 };
866
871 template <typename SchemaType>
874 const TfToken &instanceName) const {
875 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
876 "Provided type must derive UsdSchemaBase.");
877 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
878 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
879 if (!schemaInfo) {
880 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
881 "UsdSchemaRegistry as a schema type. The schema may need to be "
882 "regenerated.",
883 TfType::Find<SchemaType>().GetTypeName().c_str());
884 return false;
885 }
886 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
887 versionPolicy, instanceName);
888 };
889
894 USD_API
896 const TfType &schemaType,
897 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
898
903 USD_API
905 const TfType &schemaType,
907 const TfToken &instanceName) const;
908
917 USD_API
919 const TfToken &schemaIdentifier,
920 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
921
930 USD_API
932 const TfToken &schemaIdentifier,
934 const TfToken &instanceName) const;
935
949 USD_API
950 bool
952 const TfToken &schemaFamily,
953 UsdSchemaVersion *schemaVersion) const;
954
967 USD_API
968 bool
970 const TfToken &schemaFamily,
971 const TfToken &instanceName,
972 UsdSchemaVersion *schemaVersion) const;
973
975
979
992 template <typename SchemaType>
993 bool CanApplyAPI(std::string *whyNot = nullptr) const {
994 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
995 "Provided type must derive UsdAPISchemaBase.");
996 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
997 "Provided type must not be UsdAPISchemaBase.");
998 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
999 "Provided schema type must be a single apply API schema.");
1000
1001 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1002 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1003 if (!schemaInfo) {
1004 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1005 "UsdSchemaRegistry as a schema type. The schema may need to be "
1006 "regenerated.",
1007 TfType::Find<SchemaType>().GetTypeName().c_str());
1008 return false;
1009 }
1010 return _CanApplySingleApplyAPI(*schemaInfo, whyNot);
1011 }
1012
1026 template <typename SchemaType>
1027 bool CanApplyAPI(const TfToken &instanceName,
1028 std::string *whyNot = nullptr) const {
1029 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1030 "Provided type must derive UsdAPISchemaBase.");
1031 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1032 "Provided type must not be UsdAPISchemaBase.");
1033 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1034 "Provided schema type must be a multiple apply API schema.");
1035
1036 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1037 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1038 if (!schemaInfo) {
1039 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1040 "UsdSchemaRegistry as a schema type. The schema may need to be "
1041 "regenerated.",
1042 TfType::Find<SchemaType>().GetTypeName().c_str());
1043 return false;
1044 }
1045 return _CanApplyMultipleApplyAPI(*schemaInfo, instanceName, whyNot);
1046 }
1047
1050 USD_API
1051 bool CanApplyAPI(const TfType& schemaType,
1052 std::string *whyNot = nullptr) const;
1053
1057 USD_API
1058 bool CanApplyAPI(const TfType& schemaType,
1059 const TfToken& instanceName,
1060 std::string *whyNot = nullptr) const;
1061
1064 USD_API
1065 bool CanApplyAPI(const TfToken& schemaIdentifier,
1066 std::string *whyNot = nullptr) const;
1067
1072 USD_API
1073 bool CanApplyAPI(const TfToken& schemaIdentifier,
1074 const TfToken& instanceName,
1075 std::string *whyNot = nullptr) const;
1076
1079 USD_API
1080 bool CanApplyAPI(const TfToken& schemaFamily,
1081 UsdSchemaVersion schemaVersion,
1082 std::string *whyNot = nullptr) const;
1083
1088 USD_API
1089 bool CanApplyAPI(const TfToken& schemaFamily,
1090 UsdSchemaVersion schemaVersion,
1091 const TfToken& instanceName,
1092 std::string *whyNot = nullptr) const;
1093
1095
1099
1115 template <typename SchemaType>
1116 bool ApplyAPI() const {
1117 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1118 "Provided type must derive UsdAPISchemaBase.");
1119 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1120 "Provided type must not be UsdAPISchemaBase.");
1121 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1122 "Provided schema type must be a single apply API schema.");
1123
1124 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1125 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1126 if (!schemaInfo) {
1127 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1128 "UsdSchemaRegistry as a schema type. The schema may need to be "
1129 "regenerated.",
1130 TfType::Find<SchemaType>().GetTypeName().c_str());
1131 return false;
1132 }
1133 return _ApplySingleApplyAPI(*schemaInfo);
1134 }
1135
1156 template <typename SchemaType>
1157 bool ApplyAPI(const TfToken &instanceName) const {
1158 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1159 "Provided type must derive UsdAPISchemaBase.");
1160 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1161 "Provided type must not be UsdAPISchemaBase.");
1162 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1163 "Provided schema type must be a multiple apply API schema.");
1164
1165 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1166 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1167 if (!schemaInfo) {
1168 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1169 "UsdSchemaRegistry as a schema type. The schema may need to be "
1170 "regenerated.",
1171 TfType::Find<SchemaType>().GetTypeName().c_str());
1172 return false;
1173 }
1174 return _ApplyMultipleApplyAPI(*schemaInfo, instanceName);
1175 }
1176
1178 USD_API
1179 bool ApplyAPI(const TfType& schemaType) const;
1180
1183 USD_API
1184 bool ApplyAPI(const TfType& schemaType,
1185 const TfToken& instanceName) const;
1186
1189 USD_API
1190 bool ApplyAPI(const TfToken& schemaIdentifier) const;
1191
1195 USD_API
1196 bool ApplyAPI(const TfToken& schemaIdentifier,
1197 const TfToken& instanceName) const;
1198
1201 USD_API
1202 bool ApplyAPI(const TfToken& schemaFamily,
1203 UsdSchemaVersion schemaVersion) const;
1204
1208 USD_API
1209 bool ApplyAPI(const TfToken& schemaFamily,
1210 UsdSchemaVersion schemaVersion,
1211 const TfToken& instanceName) const;
1212
1214
1218
1235 template <typename SchemaType>
1236 bool RemoveAPI() const {
1237 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1238 "Provided type must derive UsdAPISchemaBase.");
1239 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1240 "Provided type must not be UsdAPISchemaBase.");
1241 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1242 "Provided schema type must be a single apply API schema.");
1243
1244 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1245 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1246 if (!schemaInfo) {
1247 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1248 "UsdSchemaRegistry as a schema type. The schema may need to be "
1249 "regenerated.",
1250 TfType::Find<SchemaType>().GetTypeName().c_str());
1251 return false;
1252 }
1253 return _RemoveSingleApplyAPI(*schemaInfo);
1254 }
1255
1277 template <typename SchemaType>
1278 bool RemoveAPI(const TfToken &instanceName) const {
1279 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1280 "Provided type must derive UsdAPISchemaBase.");
1281 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1282 "Provided type must not be UsdAPISchemaBase.");
1283 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1284 "Provided schema type must be a multiple apply API schema.");
1285
1286 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1287 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1288 if (!schemaInfo) {
1289 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1290 "UsdSchemaRegistry as a schema type. The schema may need to be "
1291 "regenerated.",
1292 TfType::Find<SchemaType>().GetTypeName().c_str());
1293 return false;
1294 }
1295 return _RemoveMultipleApplyAPI(*schemaInfo, instanceName);
1296 }
1297
1299 USD_API
1300 bool RemoveAPI(const TfType& schemaType) const;
1301
1304 USD_API
1305 bool RemoveAPI(const TfType& schemaType,
1306 const TfToken& instanceName) const;
1307
1310 USD_API
1311 bool RemoveAPI(const TfToken& schemaIdentifier) const;
1312
1316 USD_API
1317 bool RemoveAPI(const TfToken& schemaIdentifier,
1318 const TfToken& instanceName) const;
1319
1322 USD_API
1323 bool RemoveAPI(const TfToken& schemaFamily,
1324 UsdSchemaVersion schemaVersion) const;
1325
1329 USD_API
1330 bool RemoveAPI(const TfToken& schemaFamily,
1331 UsdSchemaVersion schemaVersion,
1332 const TfToken& instanceName) const;
1333
1335
1359 USD_API
1360 bool AddAppliedSchema(const TfToken &appliedSchemaName) const;
1361
1386 USD_API
1387 bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const;
1388
1389 // --------------------------------------------------------------------- //
1391 // --------------------------------------------------------------------- //
1392
1398 USD_API
1399 UsdPrim GetChild(const TfToken &name) const;
1400
1409 inline SiblingRange GetChildren() const;
1410
1412 inline SiblingRange GetAllChildren() const;
1413
1433 inline SiblingRange
1434 GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const;
1435
1438 USD_API
1440
1443 USD_API
1445
1448 USD_API
1450 const Usd_PrimFlagsPredicate &predicate) const;
1451
1464 inline SubtreeRange GetDescendants() const;
1465
1474 inline SubtreeRange GetAllDescendants() const;
1475
1499 inline SubtreeRange
1500 GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const;
1501
1507 USD_API
1509
1512 void SetChildrenReorder(const TfTokenVector &order) const {
1513 SetMetadata(SdfFieldKeys->PrimOrder, order);
1514 }
1515
1519 ClearMetadata(SdfFieldKeys->PrimOrder);
1520 }
1521
1522public:
1523 // --------------------------------------------------------------------- //
1525 // --------------------------------------------------------------------- //
1526
1530 Usd_PrimDataConstPtr prim = get_pointer(_Prim());
1531 SdfPath proxyPrimPath = _ProxyPrimPath();
1532 Usd_MoveToParent(prim, proxyPrimPath);
1533 return UsdPrim(prim, proxyPrimPath);
1534 }
1535
1544 USD_API
1546
1552 USD_API
1554 const Usd_PrimFlagsPredicate &predicate) const;
1555
1562 USD_API
1563 bool IsPseudoRoot() const;
1564
1568 USD_API UsdPrim GetPrimAtPath(const SdfPath& path) const;
1569
1573 USD_API UsdObject GetObjectAtPath(const SdfPath& path) const;
1574
1583 USD_API UsdProperty GetPropertyAtPath(const SdfPath& path) const;
1584
1593 USD_API UsdAttribute GetAttributeAtPath(const SdfPath& path) const;
1594
1604
1605 // --------------------------------------------------------------------- //
1607 // --------------------------------------------------------------------- //
1608
1614 USD_API
1616
1624 USD_API
1625 UsdVariantSet GetVariantSet(const std::string& variantSetName) const;
1626
1632 USD_API
1633 bool HasVariantSets() const;
1634
1635 // --------------------------------------------------------------------- //
1637 // --------------------------------------------------------------------- //
1638
1678 USD_API
1681 const SdfValueTypeName &typeName,
1682 bool custom,
1683 SdfVariability variability = SdfVariabilityVarying) const;
1686 USD_API
1689 const SdfValueTypeName &typeName,
1690 SdfVariability variability = SdfVariabilityVarying) const;
1691
1696 USD_API
1698 const std::vector<std::string> &nameElts,
1699 const SdfValueTypeName &typeName,
1700 bool custom,
1701 SdfVariability variability = SdfVariabilityVarying) const;
1705 USD_API
1707 const std::vector<std::string> &nameElts,
1708 const SdfValueTypeName &typeName,
1709 SdfVariability variability = SdfVariabilityVarying) const;
1710
1712 USD_API
1713 std::vector<UsdAttribute> GetAttributes() const;
1714
1717 USD_API
1718 std::vector<UsdAttribute> GetAuthoredAttributes() const;
1719
1732 USD_API
1733 UsdAttribute GetAttribute(const TfToken& attrName) const;
1734
1737 USD_API
1738 bool HasAttribute(const TfToken& attrName) const;
1739
1746 USD_API
1747 SdfPathVector
1749 Usd_PrimFlagsPredicate const &traversalPredicate,
1750 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1751 bool recurseOnSources = false) const;
1752
1756 USD_API
1757 SdfPathVector
1759 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1760 bool recurseOnSources = false) const;
1761
1762 // --------------------------------------------------------------------- //
1764 // --------------------------------------------------------------------- //
1765
1802 USD_API
1804 bool custom=true) const;
1805
1810 USD_API
1811 UsdRelationship CreateRelationship(const std::vector<std::string> &nameElts,
1812 bool custom=true)
1813 const;
1814
1816 USD_API
1817 std::vector<UsdRelationship> GetRelationships() const;
1818
1821 USD_API
1822 std::vector<UsdRelationship> GetAuthoredRelationships() const;
1823
1836 USD_API
1838
1841 USD_API
1842 bool HasRelationship(const TfToken& relName) const;
1843
1850 USD_API
1851 SdfPathVector
1853 Usd_PrimFlagsPredicate const &traversalPredicate,
1854 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1855 bool recurseOnTargets = false) const;
1856
1860 USD_API
1861 SdfPathVector
1863 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1864 bool recurseOnTargets = false) const;
1865
1866 // --------------------------------------------------------------------- //
1873 // --------------------------------------------------------------------- //
1874
1878 USD_API
1879 bool ClearPayload() const;
1880
1885 USD_API
1886 bool HasPayload() const;
1887
1893 USD_API
1894 bool SetPayload(const SdfPayload& payload) const;
1895
1898 USD_API
1900 const std::string& assetPath, const SdfPath& primPath) const;
1901
1905 USD_API
1906 bool SetPayload(const SdfLayerHandle& layer, const SdfPath& primPath) const;
1907
1909
1910 // --------------------------------------------------------------------- //
1912 // --------------------------------------------------------------------- //
1913
1921 USD_API
1923
1925 USD_API
1927
1933 USD_API
1935
1939 USD_API
1940 void Unload() const;
1941
1942 // --------------------------------------------------------------------- //
1944 // --------------------------------------------------------------------- //
1945
1955 USD_API
1957
1959 USD_API
1961
1962 // --------------------------------------------------------------------- //
1964 // --------------------------------------------------------------------- //
1965
1975 USD_API
1977
1979 USD_API
1981
1982 // --------------------------------------------------------------------- //
1984 // --------------------------------------------------------------------- //
1985
1993 USD_API
1995
1997 USD_API
1999
2000 // --------------------------------------------------------------------- //
2004 // --------------------------------------------------------------------- //
2005
2012 bool IsInstanceable() const {
2013 bool instanceable = false;
2014 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
2015 instanceable;
2016 }
2017
2020 bool SetInstanceable(bool instanceable) const {
2021 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2022 }
2023
2026 bool ClearInstanceable() const {
2027 return ClearMetadata(SdfFieldKeys->Instanceable);
2028 }
2029
2033 return HasAuthoredMetadata(SdfFieldKeys->Instanceable);
2034 }
2035
2041 bool IsInstance() const { return _Prim()->IsInstance(); }
2042
2046 bool IsInstanceProxy() const {
2047 return Usd_IsInstanceProxy(_Prim(), _ProxyPrimPath());
2048 }
2049
2057 USD_API
2058 static bool IsPrototypePath(const SdfPath& path);
2059
2064 USD_API
2065 static bool IsPathInPrototype(const SdfPath& path);
2066
2071 bool IsPrototype() const { return _Prim()->IsPrototype(); }
2072
2077 bool IsInPrototype() const {
2078 return (IsInstanceProxy() ?
2080 }
2081
2084 USD_API
2086
2091 if (IsInstanceProxy()) {
2092 return UsdPrim(_Prim(), SdfPath());
2093 }
2094 return UsdPrim();
2095 }
2096
2102 USD_API
2103 std::vector<UsdPrim> GetInstances() const;
2105
2106 // --------------------------------------------------------------------- //
2109 // --------------------------------------------------------------------- //
2110
2133 const PcpPrimIndex &GetPrimIndex() const { return _Prim()->GetPrimIndex(); }
2134
2155 USD_API
2157
2165 USD_API
2167 const UsdEditTarget &editTarget) const;
2168
2176 USD_API
2178 const UsdEditTarget &editTarget) const;
2179
2181
2182private:
2183 class _ProtoToInstancePathMap {
2184 friend class UsdPrim;
2185 public:
2186 using _Map = std::vector<std::pair<SdfPath, SdfPath>>;
2187 SdfPath MapProtoToInstance(SdfPath const &protoPath) const;
2188 private:
2189 _Map _map;
2190 };
2191
2192 friend class UsdObject;
2193 friend class UsdPrimSiblingIterator;
2194 friend class UsdPrimSubtreeIterator;
2195 friend class UsdProperty;
2196 friend class UsdSchemaBase;
2197 friend class UsdAPISchemaBase;
2198 friend class UsdStage;
2199 friend class UsdPrimRange;
2200 friend class Usd_PrimData;
2201 friend class Usd_PrimFlagsPredicate;
2202 friend struct Usd_StageImplAccess;
2203 friend struct UsdPrim_RelTargetFinder;
2204 friend struct UsdPrim_AttrConnectionFinder;
2205
2206 // Prim constructor.
2207 UsdPrim(const Usd_PrimDataHandle &primData,
2208 const SdfPath &proxyPrimPath)
2209 : UsdObject(primData, proxyPrimPath) { }
2210
2211 // General constructor.
2212 UsdPrim(UsdObjType objType,
2213 const Usd_PrimDataHandle &prim,
2214 const SdfPath &proxyPrimPath,
2215 const TfToken &propName)
2216 : UsdObject(objType, prim, proxyPrimPath, propName) {}
2217
2218 // Helper to make a sibling range.
2219 inline SiblingRange
2220 _MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const;
2221
2222 // Helper to make a range of descendants.
2223 inline SubtreeRange
2224 _MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const;
2225
2226 // Helper to make a vector of properties from names.
2227 std::vector<UsdProperty>
2228 _MakeProperties(const TfTokenVector &names) const;
2229
2230 // Helper for Get{Authored}{PropertyNames,Properties}
2231 TfTokenVector _GetPropertyNames(
2232 bool onlyAuthored,
2233 bool applyOrder=true,
2234 const PropertyPredicateFunc &predicate={}) const;
2235
2236 // Helper for Get(Authored)PropertiesInNamespace.
2237 std::vector<UsdProperty>
2238 _GetPropertiesInNamespace(const std::string &namespaces,
2239 bool onlyAuthored) const;
2240
2241 // Helper for Get(Authored)Attributes.
2242 std::vector<UsdAttribute>
2243 _GetAttributes(bool onlyAuthored, bool applyOrder=false) const;
2244
2245 // Helper for Get(Authored)Relationships.
2246 std::vector<UsdRelationship>
2247 _GetRelationships(bool onlyAuthored, bool applyOrder=false) const;
2248
2249 friend const PcpPrimIndex &Usd_PrimGetSourcePrimIndex(const UsdPrim&);
2250 // Return a const reference to the source PcpPrimIndex for this prim.
2251 //
2252 // For all prims in prototypes (which includes the prototype prim itself),
2253 // this is the prim index for the instance that was chosen to serve
2254 // as the prototype for all other instances. This prim index will not
2255 // have the same path as the prim's path.
2256 //
2257 // This is a private helper but is also wrapped out to Python
2258 // for testing and debugging purposes.
2259 const PcpPrimIndex &_GetSourcePrimIndex() const
2260 { return _Prim()->GetSourcePrimIndex(); }
2261
2262 // Helper function for MakeResolveTargetUpToEditTarget and
2263 // MakeResolveTargetStrongerThanEditTarget.
2265 _MakeResolveTargetFromEditTarget(
2266 const UsdEditTarget &editTarget,
2267 bool makeAsStrongerThan) const;
2268
2269 _ProtoToInstancePathMap _GetProtoToInstancePathMap() const;
2270};
2271
2276 using _UnderlyingIterator = const Usd_PrimData*;
2277 class _PtrProxy {
2278 public:
2279 UsdPrim* operator->() { return &_prim; }
2280 private:
2281 friend class UsdPrimSiblingIterator;
2282 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2283 UsdPrim _prim;
2284 };
2285public:
2286 using iterator_category = std::forward_iterator_tag;
2287 using value_type = UsdPrim;
2288 using reference = UsdPrim;
2289 using pointer = _PtrProxy;
2290 using difference_type = std::ptrdiff_t;
2291
2292 // Default ctor.
2293 UsdPrimSiblingIterator() = default;
2294
2296 reference operator*() const { return dereference(); }
2297
2299 pointer operator->() const { return pointer(dereference()); }
2300
2303 increment();
2304 return *this;
2305 }
2306
2309 UsdPrimSiblingIterator result = *this;
2310 increment();
2311 return result;
2312 }
2313
2314 bool operator==(const UsdPrimSiblingIterator& other) const {
2315 return equal(other);
2316 }
2317
2318 bool operator!=(const UsdPrimSiblingIterator& other) const {
2319 return !equal(other);
2320 }
2321
2322private:
2323 friend class UsdPrim;
2324
2325 // Constructor used by Prim.
2326 UsdPrimSiblingIterator(const _UnderlyingIterator &i,
2327 const SdfPath& proxyPrimPath,
2328 const Usd_PrimFlagsPredicate &predicate)
2329 : _underlyingIterator(i)
2330 , _proxyPrimPath(proxyPrimPath)
2331 , _predicate(predicate) {
2332 // Need to advance iterator to first matching element.
2333 if (_underlyingIterator &&
2334 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2335 _proxyPrimPath))
2336 increment();
2337 }
2338
2339 bool equal(const UsdPrimSiblingIterator &other) const {
2340 return _underlyingIterator == other._underlyingIterator &&
2341 _proxyPrimPath == other._proxyPrimPath &&
2342 _predicate == other._predicate;
2343 }
2344
2345 void increment() {
2346 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator, _proxyPrimPath,
2347 _predicate)) {
2348 _underlyingIterator = nullptr;
2349 _proxyPrimPath = SdfPath();
2350 }
2351 }
2352
2353 reference dereference() const {
2354 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2355 }
2356
2357 _UnderlyingIterator _underlyingIterator = nullptr;
2358 SdfPath _proxyPrimPath;
2359 Usd_PrimFlagsPredicate _predicate;
2360};
2361
2367public:
2373 typedef std::ptrdiff_t difference_type;
2378
2379 UsdPrimSiblingRange() = default;
2380
2383 UsdPrimSiblingIterator end) : _begin(begin),
2384 _end(end) {}
2385
2387 iterator begin() const { return _begin; }
2388
2390 const_iterator cbegin() const { return _begin; }
2391
2393 iterator end() const { return _end; }
2394
2396 const_iterator cend() const { return _end; }
2397
2399 explicit operator bool() const { return !empty(); }
2400
2402 bool equal(const UsdPrimSiblingRange& other) const {
2403 return _begin == other._begin && _end == other._end;
2404 }
2405
2408 TF_DEV_AXIOM(!empty());
2409 return *begin();
2410 }
2411
2414 std::advance(_begin, n);
2415 return *this;
2416 }
2417
2420 std::advance(_end, n);
2421 return *this;
2422 }
2423
2425 bool empty() const { return begin() == end(); }
2426
2427private:
2429 friend bool operator==(const UsdPrimSiblingRange &lhs,
2430 const UsdPrimSiblingRange &rhs) {
2431 return lhs.equal(rhs);
2432 }
2433
2435 template <class ForwardRange>
2436 friend bool operator==(const UsdPrimSiblingRange& lhs,
2437 const ForwardRange& rhs) {
2438 static_assert(
2439 std::is_same<typename decltype(std::cbegin(rhs))::iterator_category,
2440 std::forward_iterator_tag>::value,
2441 "rhs must be a forward iterator."
2442 );
2443 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2444 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2445 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2446 }
2447
2449 template <class ForwardRange>
2450 friend bool operator==(const ForwardRange& lhs,
2451 const UsdPrimSiblingRange& rhs) {
2452 return rhs == lhs;
2453 }
2454
2456 friend bool operator!=(const UsdPrimSiblingRange &lhs,
2457 const UsdPrimSiblingRange &rhs) {
2458 return !lhs.equal(rhs);
2459 }
2460
2462 template <class ForwardRange>
2463 friend bool operator!=(const ForwardRange& lhs,
2464 const UsdPrimSiblingRange& rhs) {
2465 return !(lhs == rhs);
2466 }
2467
2469 template <class ForwardRange>
2470 friend bool operator!=(const UsdPrimSiblingRange& lhs,
2471 const ForwardRange& rhs) {
2472 return !(lhs == rhs);
2473 }
2474
2475 iterator _begin;
2476 iterator _end;
2477};
2478
2479// Inform TfIterator it should feel free to make copies of the range type.
2480template <>
2481struct Tf_ShouldIterateOverCopy<
2482 UsdPrimSiblingRange> : std::true_type {};
2483template <>
2484struct Tf_ShouldIterateOverCopy<
2485 const UsdPrimSiblingRange> : std::true_type {};
2486
2488UsdPrim::GetFilteredChildren(const Usd_PrimFlagsPredicate &pred) const
2489{
2490 return _MakeSiblingRange(
2491 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2492}
2493
2496{
2498}
2499
2502{
2504}
2505
2506// Helper to make a sibling range.
2508UsdPrim::_MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const {
2509 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2510 SdfPath firstChildPath = _ProxyPrimPath();
2511 if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2512 firstChild = nullptr;
2513 firstChildPath = SdfPath();
2514 }
2515
2516 return SiblingRange(
2517 SiblingIterator(firstChild, firstChildPath, pred),
2518 SiblingIterator(nullptr, SdfPath(), pred));
2519}
2520
2525 using _UnderlyingIterator = Usd_PrimDataConstPtr;
2526 class _PtrProxy {
2527 public:
2528 UsdPrim* operator->() { return &_prim; }
2529 private:
2530 friend class UsdPrimSubtreeIterator;
2531 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2532 UsdPrim _prim;
2533 };
2534public:
2535 using iterator_category = std::forward_iterator_tag;
2536 using value_type = UsdPrim;
2537 using reference = UsdPrim;
2538 using pointer = _PtrProxy;
2539 using difference_type = std::ptrdiff_t;
2540
2541 // Default ctor.
2542 UsdPrimSubtreeIterator() = default;
2543
2545 reference operator*() const { return dereference(); }
2547 pointer operator->() const { return pointer(dereference()); }
2548
2551 increment();
2552 return *this;
2553 }
2554
2558 increment();
2559 return result;
2560 }
2561
2563 bool operator==(const UsdPrimSubtreeIterator &other) const {
2564 return equal(other);
2565 }
2566
2568 bool operator!=(const UsdPrimSubtreeIterator &other) const {
2569 return !equal(other);
2570 }
2571
2572
2573private:
2574 friend class UsdPrim;
2575
2576 // Constructor used by Prim.
2577 UsdPrimSubtreeIterator(const _UnderlyingIterator &i,
2578 const SdfPath &proxyPrimPath,
2579 const Usd_PrimFlagsPredicate &predicate)
2580 : _underlyingIterator(i)
2581 , _proxyPrimPath(proxyPrimPath)
2582 , _predicate(predicate) {
2583 // Need to advance iterator to first matching element.
2584 if (_underlyingIterator &&
2585 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2586 _proxyPrimPath)) {
2587 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2588 _proxyPrimPath, _predicate)) {
2589 _underlyingIterator = nullptr;
2590 _proxyPrimPath = SdfPath();
2591 }
2592 }
2593 }
2594
2595 bool equal(const UsdPrimSubtreeIterator &other) const {
2596 return _underlyingIterator == other._underlyingIterator &&
2597 _proxyPrimPath == other._proxyPrimPath &&
2598 _predicate == other._predicate;
2599 }
2600
2601 void increment() {
2602 if (!Usd_MoveToChild(_underlyingIterator, _proxyPrimPath,
2603 _predicate)) {
2604 while (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2605 _proxyPrimPath,
2606 _predicate)) {}
2607 }
2608 }
2609
2610 reference dereference() const {
2611 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2612 }
2613
2614 _UnderlyingIterator _underlyingIterator = nullptr;
2615 SdfPath _proxyPrimPath;
2616 Usd_PrimFlagsPredicate _predicate;
2617};
2618
2624public:
2630 typedef std::ptrdiff_t difference_type;
2635
2636 UsdPrimSubtreeRange() = default;
2637
2640 UsdPrimSubtreeIterator end) : _begin(begin),
2641 _end(end) {}
2642
2644 iterator begin() const { return _begin; }
2645
2647 const_iterator cbegin() const { return _begin; }
2648
2650 iterator end() const { return _end; }
2651
2653 const_iterator cend() const { return _end; }
2654
2656 explicit operator bool() const {
2657 return !empty();
2658 }
2659
2661 bool equal(const UsdPrimSubtreeRange& other) const {
2662 return _begin == other._begin && _end == other._end;
2663 }
2664
2667 TF_DEV_AXIOM(!empty());
2668 return *begin();
2669 }
2670
2673 std::advance(_begin, n);
2674 return *this;
2675 }
2676
2679 std::advance(_end, n);
2680 return *this;
2681 }
2682
2684 bool empty() const { return begin() == end(); }
2685
2686private:
2688 friend bool operator==(const UsdPrimSubtreeRange &lhs,
2689 const UsdPrimSubtreeRange &rhs) {
2690 return lhs.equal(rhs);
2691 }
2692
2694 template <class ForwardRange>
2695 friend bool operator==(const UsdPrimSubtreeRange& lhs,
2696 const ForwardRange& rhs) {
2697 static_assert(
2698 std::is_convertible<
2699 typename decltype(std::cbegin(rhs))::iterator_category,
2700 std::forward_iterator_tag>::value,
2701 "rhs must be a forward iterator."
2702 );
2703 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2704 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2705 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2706 }
2707
2709 template <class ForwardRange>
2710 friend bool operator==(const ForwardRange& lhs,
2711 const UsdPrimSubtreeRange& rhs) {
2712 return rhs == lhs;
2713 }
2714
2716 friend bool operator!=(const UsdPrimSubtreeRange &lhs,
2717 const UsdPrimSubtreeRange &rhs) {
2718 return !lhs.equal(rhs);
2719 }
2720
2722 template <class ForwardRange>
2723 friend bool operator!=(const ForwardRange& lhs,
2724 const UsdPrimSubtreeRange& rhs) {
2725 return !(lhs == rhs);
2726 }
2727
2729 template <class ForwardRange>
2730 friend bool operator!=(const UsdPrimSubtreeRange& lhs,
2731 const ForwardRange& rhs) {
2732 return !(lhs == rhs);
2733 }
2734
2735 iterator _begin;
2736 iterator _end;
2737};
2738
2739// Inform TfIterator it should feel free to make copies of the range type.
2740template <>
2741struct Tf_ShouldIterateOverCopy<
2742 UsdPrimSubtreeRange> : std::true_type {};
2743template <>
2744struct Tf_ShouldIterateOverCopy<
2745 const UsdPrimSubtreeRange> : std::true_type {};
2746
2748UsdPrim::GetFilteredDescendants(const Usd_PrimFlagsPredicate &pred) const
2749{
2750 return _MakeDescendantsRange(
2751 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2752}
2753
2756{
2758}
2759
2762{
2764}
2765
2766// Helper to make a sibling range.
2768UsdPrim::_MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const {
2769 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2770 SdfPath firstChildPath = _ProxyPrimPath();
2771 Usd_PrimDataConstPtr endChild = firstChild;
2772 SdfPath endChildPath = firstChildPath;
2773 if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2774 while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
2775 }
2776
2777 return SubtreeRange(
2778 SubtreeIterator(firstChild, firstChildPath, pred),
2779 SubtreeIterator(endChild, endChildPath, pred));
2780}
2781
2782
2784// UsdObject methods that require UsdPrim be a complete type.
2785
2786inline UsdPrim
2788{
2789 return UsdPrim(_prim, _proxyPrimPath);
2790}
2791
2792PXR_NAMESPACE_CLOSE_SCOPE
2793
2794#endif // PXR_USD_USD_PRIM_H
2795
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:62
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Represents a payload and all its meta data.
Definition: payload.h:41
Represents a value type name, i.e.
Definition: valueTypeName.h:71
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
The base class for all API schemas.
Definition: apiSchemaBase.h:99
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:160
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:64
A proxy class for applying listOp edits to the inherit paths list for a prim.
Definition: inherits.h:34
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:115
bool SetMetadata(const TfToken &key, const T &value) const
Set metadatum key's value to value.
Definition: object.h:747
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...
UsdPrim GetPrim() const
Return this object if it is a prim, otherwise return this object's nearest owning prim.
Definition: prim.h:2787
const SdfPath & GetPrimPath() const
Return this object's path if this object is a prim, otherwise this object's nearest owning prim's pat...
Definition: object.h:201
bool GetMetadata(const TfToken &key, T *value) const
Resolve the requested metadatum named key into value, returning true on success.
Definition: object.h:739
USD_API bool ClearMetadata(const TfToken &key) const
Clears the authored key's value at the current EditTarget, returning false on error.
UsdPayloads provides an interface to authoring and introspecting payloads.
Definition: payloads.h:26
Class representing the builtin definition of a prim given the schemas registered in the schema regist...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
Definition: prim.h:2495
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 ...
const UsdPrimDefinition & GetPrimDefinition() const
Return this prim's definition based on the prim's type if the type is a registered prim type.
Definition: prim.h:147
USD_API bool HasPayload() const
const PcpPrimIndex & GetPrimIndex() const
Return the cached prim index containing all sites that can contribute opinions to this prim.
Definition: prim.h:2133
USD_API bool ApplyAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, const TfToken &instanceName) const
This is an overload of ApplyAPI with instanceName that takes a schemaFamily and schemaVersion to dete...
USD_API bool IsA(const TfType &schemaType) const
This is an overload of IsA that takes a TfType schemaType .
UsdPrim GetPrimInPrototype() const
If this prim is an instance proxy, return the UsdPrim for the corresponding prim in the instance's pr...
Definition: prim.h:2090
USD_API bool HasAPIInFamily(const TfType &schemaType, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of HasAPIInFamily that finds a registered schema for the given schemaType an...
USD_API bool CanApplyAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, const TfToken &instanceName, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI with instanceName that takes a schemaFamily and schemaVersion to d...
bool IsInstanceProxy() const
Return true if this prim is an instance proxy, false otherwise.
Definition: prim.h:2046
USD_API bool RemoveAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion) const
This is an overload of RemoveAPI that takes a schemaFamily and schemaVersion to determine the schema ...
UsdPrim GetParent() const
Return this prim's parent prim.
Definition: prim.h:1529
USD_API bool SetKind(const TfToken &kind) const
Author a kind for this prim, at the current UsdEditTarget.
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 SetPayload(const SdfPayload &payload) const
UsdPrim()
Construct an invalid prim.
Definition: prim.h:128
bool IsInstanceable() const
Return true if this prim has been marked as instanceable.
Definition: prim.h:2012
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 UsdSpecializes GetSpecializes() const
Return a UsdSpecializes object that allows one to add, remove, or mutate specializes at the currently...
SiblingRange GetChildren() const
Return this prim's active, loaded, defined, non-abstract children as an iterable range.
Definition: prim.h:2501
USD_API bool HasAuthoredSpecializes() const
Returns true if this prim has any authored specializes.
USD_API bool ClearPayload() const
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...
Definition: prim.h:1027
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 ...
SubtreeRange GetDescendants() const
Return this prim's active, loaded, defined, non-abstract descendants as an iterable range.
Definition: prim.h:2761
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...
Definition: prim.h:993
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 std::vector< UsdProperty > GetAuthoredPropertiesInNamespace(const std::string &namespaces) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool SetTypeName(const TfToken &typeName) const
Author this Prim's typeName at the current EditTarget.
Definition: prim.h:202
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
Return a UsdAttribute with the name attrName.
USD_API bool HasAuthoredInherits() const
Return true if this prim has any authored inherits.
bool HasAuthoredInstanceable() const
Return true if this prim has an authored opinion for 'instanceable', false otherwise.
Definition: prim.h:2032
USD_API bool RemoveAPI(const TfToken &schemaIdentifier, const TfToken &instanceName) const
This is an overload of RemoveAPI with instanceName that takes a schemaIdentifier to determine the sch...
SubtreeRange GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const
Return a subset of all of this prim's descendants filtered by predicate as an iterable range.
Definition: prim.h:2748
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
Definition: prim.h:152
const UsdPrimTypeInfo & GetPrimTypeInfo() const
Return the prim's full type info composed from its type name, applied API schemas,...
Definition: prim.h:140
USD_API bool GetKind(TfToken *kind) const
Retrieve the authored kind for this prim.
bool ClearActive() const
Remove the authored 'active' opinion at the current EditTarget.
Definition: prim.h:236
USD_API bool ApplyAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion) const
This is an overload of ApplyAPI that takes a schemaFamily and schemaVersion to determine the schema t...
USD_API std::vector< UsdProperty > GetPropertiesInNamespace(const std::string &namespaces) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
SubtreeRange GetAllDescendants() const
Return all this prim's descendants as an iterable range.
Definition: prim.h:2755
SiblingRange GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const
Return a subset of all of this prim's children filtered by predicate as an iterable range.
Definition: prim.h:2488
USD_API TfTokenVector GetAppliedSchemas() const
Return a vector containing the names of API schemas which have been applied to this prim.
USD_API bool IsInFamily(const TfToken &schemaIdentifier, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of IsInFamily that parses the schema family and version to use from the give...
USD_API UsdInherits GetInherits() const
Return a UsdInherits object that allows one to add, remove, or mutate inherits at the currently set U...
USD_API bool HasAPIInFamily(const TfToken &schemaFamily, const TfToken &instanceName) const
Return true if the prim has a specific instance instanceName of an applied multiple-apply API schema ...
void ClearChildrenReorder() const
Remove the opinion for the metadata used to reorder children of this prim at the current EditTarget.
Definition: prim.h:1518
USD_API bool IsSubComponent() const
Return true if this prim is a subcomponent based on its kind metadata, false otherwise.
Definition: prim.h:277
USD_API UsdPrim GetPrototype() const
If this prim is an instance, return the UsdPrim for the corresponding prototype.
USD_API bool GetVersionIfHasAPIInFamily(const TfToken &schemaFamily, const TfToken &instanceName, UsdSchemaVersion *schemaVersion) const
Return true if the prim has a specific instance instanceName of an applied multiple-apply API schema ...
USD_API void Unload() const
Unloads this prim and all its descendants.
bool HasAPI() const
Return true if the UsdPrim has had an applied API schema represented by the C++ class type SchemaType...
Definition: prim.h:724
USD_API TfTokenVector GetAllChildrenNames() const
Return the names of the child prims in the order they appear when iterating over GetAllChildren.
void SetChildrenReorder(const TfTokenVector &order) const
Author an opinion for the metadata used to reorder children of this prim at the current EditTarget.
Definition: prim.h:1512
USD_API std::vector< UsdPrim > GetInstances() const
If this prim is a prototype prim, returns all prims that are instances of this prototype.
USD_API bool IsInFamily(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Return true if the prim's schema type, is or inherits from the schema type of any schema in the given...
USD_API UsdPayloads GetPayloads() const
Return a UsdPayloads object that allows one to add, remove, or mutate payloads at the currently set U...
USD_API UsdProperty GetPropertyAtPath(const SdfPath &path) const
Returns the property at path on the same stage as this prim.
void ClearPropertyOrder() const
Remove the opinion for propertyOrder metadata on this prim at the current EditTarget.
Definition: prim.h:456
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 UsdVariantSet GetVariantSet(const std::string &variantSetName) const
Retrieve a specifically named VariantSet for editing or constructing a UsdEditTarget.
USD_API bool HasAttribute(const TfToken &attrName) const
Return true if this prim has an attribute named attrName, false otherwise.
USD_API bool HasAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion) const
This is an overload of HasAPI that takes a schemaFamily and schemaVersion to determine the schema typ...
USD_API UsdAttribute GetAttributeAtPath(const SdfPath &path) const
Returns the attribute at path on the same stage as this prim.
USD_API bool HasAPIInFamily(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Return true if the prim has an applied API schema that is a schema in the given schemaFamily that m...
bool HasAPI(const TfToken &instanceName) const
Return true if the UsdPrim has the specific instance, instanceName, of the multiple-apply API schema ...
Definition: prim.h:744
bool IsPrototype() const
Return true if this prim is an instancing prototype prim, false otherwise.
Definition: prim.h:2071
bool IsLoaded() const
Return true if this prim is active, and either it is loadable and it is loaded, or its nearest loadab...
Definition: prim.h:251
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 bool AddAppliedSchema(const TfToken &appliedSchemaName) const
Adds the applied API schema name token appliedSchemaName to the apiSchemas metadata for this prim at ...
USD_API bool CanApplyAPI(const TfType &schemaType, const TfToken &instanceName, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI with instanceName that takes a TfType schemaType .
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 ...
bool IsA() const
Return true if the prim's schema type, is or inherits from the TfType of the schema class type Schema...
Definition: prim.h:574
USD_API UsdPrim GetPrimAtPath(const SdfPath &path) const
Returns the prim at path on the same stage as this prim.
UsdPrimSubtreeIterator SubtreeIterator
Convenience typedefs.
Definition: prim.h:124
USD_API SdfPathVector FindAllAttributeConnectionPaths(Usd_PrimFlagsPredicate const &traversalPredicate, std::function< bool(UsdAttribute const &)> const &pred=nullptr, bool recurseOnSources=false) const
Search the prim subtree rooted at this prim according to traversalPredicate for attributes for which ...
bool IsInPrototype() const
Return true if this prim is a prototype prim or a descendant of a prototype prim, false otherwise.
Definition: prim.h:2077
USD_API bool SetPayload(const SdfLayerHandle &layer, const SdfPath &primPath) const
void SetPropertyOrder(const TfTokenVector &order) const
Author an opinion for propertyOrder metadata on this prim at the current EditTarget.
Definition: prim.h:450
static USD_API bool IsPrototypePath(const SdfPath &path)
Return true if the given path identifies a prototype prim, false otherwise.
USD_API bool HasAPIInFamily(const TfToken &schemaIdentifier, UsdSchemaRegistry::VersionPolicy versionPolicy, const TfToken &instanceName) const
Overload for convenience of HasAPIInFamily that parses the schema family and version to use from the ...
USD_API bool HasAPI(const TfType &schemaType) const
This is an overload of HasAPI that takes a TfType schemaType .
USD_API bool CanApplyAPI(const TfType &schemaType, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI that takes a TfType schemaType .
USD_API bool IsPseudoRoot() const
Returns true if the prim is the pseudo root.
USD_API bool HasProperty(const TfToken &propName) const
Return true if this prim has an property named propName, false otherwise.
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 IsInstance() const
Return true if this prim is an instance of a prototype, false otherwise.
Definition: prim.h:2041
USD_API UsdAttribute CreateAttribute(const TfToken &name, const SdfValueTypeName &typeName, SdfVariability variability=SdfVariabilityVarying) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API SdfPrimSpecHandleVector GetPrimStack() const
Return all the authored SdfPrimSpecs that may contain opinions for this prim in order from strong to ...
USD_API SdfPathVector FindAllRelationshipTargetPaths(std::function< bool(UsdRelationship const &)> const &pred=nullptr, bool recurseOnTargets=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool HasAuthoredActive() const
Return true if this prim has an authored opinion for 'active', false otherwise.
Definition: prim.h:244
USD_API bool HasVariantSets() const
Return true if this prim has any authored VariantSets.
bool IsDefined() const
Return true if this prim and all its ancestors have defining specifiers, false otherwise.
Definition: prim.h:284
USD_API bool IsA(const TfToken &schemaIdentifier) const
This is an overload of IsA that takes a schemaIdentifier to determine the schema type.
USD_API bool RemoveAPI(const TfToken &schemaIdentifier) const
This is an overload of RemoveAPI that takes a schemaIdentifier to determine the schema type.
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.
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...
Definition: prim.h:872
USD_API UsdPrim GetNextSibling() const
Return this prim's next active, loaded, defined, non-abstract sibling if it has one,...
USD_API bool CanApplyAPI(const TfToken &schemaIdentifier, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI that takes a schemaIdentifier to determine the schema type.
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...
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...
USD_API bool RemoveAPI(const TfType &schemaType) const
This is an overload of RemoveAPI that takes a TfType schemaType .
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...
USD_API bool IsInFamily(const TfType &schemaType, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of IsInFamily that finds a registered schema for the given schemaType and us...
USD_API bool HasAuthoredPayloads() const
Return true if this prim has any authored payloads.
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...
USD_API UsdVariantSets GetVariantSets() const
Return a UsdVariantSets object representing all the VariantSets present on this prim.
USD_API UsdObject GetObjectAtPath(const SdfPath &path) const
Returns the object at path on the same stage as this prim.
USD_API bool RemoveAPI(const TfType &schemaType, const TfToken &instanceName) const
This is an overload of RemoveAPI with instanceName that takes a TfType schemaType .
USD_API bool HasAuthoredReferences() const
Return true if this prim has any authored references.
USD_API std::vector< UsdRelationship > GetAuthoredRelationships() const
Like GetRelationships(), but exclude relationships without authored scene description from the result...
const TfToken & GetTypeName() const
Return this prim's composed type name.
Definition: prim.h:199
std::function< bool(const TfToken &propertyName)> PropertyPredicateFunc
Alias for the "predicate" function parameter passed into the various Get{Authored}{PropertyNames,...
Definition: prim.h:304
USD_API UsdRelationship CreateRelationship(const std::vector< std::string > &nameElts, bool custom=true) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API std::vector< UsdProperty > GetProperties(const PropertyPredicateFunc &predicate={}) const
Return all of this prim's properties (attributes and relationships), including all builtin properties...
USD_API bool ApplyAPI(const TfType &schemaType, const TfToken &instanceName) const
This is an overload of ApplyAPI with instanceName that takes a TfType schemaType .
bool RemoveAPI(const TfToken &instanceName) const
Removes a multiple-apply API schema with the given C++ type 'SchemaType' and instance name instanceNa...
Definition: prim.h:1278
USD_API UsdAttribute CreateAttribute(const std::vector< std::string > &nameElts, const SdfValueTypeName &typeName, SdfVariability variability=SdfVariabilityVarying) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool HasAPIInFamily(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, UsdSchemaRegistry::VersionPolicy versionPolicy, const TfToken &instanceName) const
Return true if the prim has a specific instance instanceName of an applied multiple-apply API schema ...
USD_API bool CanApplyAPI(const TfToken &schemaIdentifier, const TfToken &instanceName, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI with instanceName that takes a schemaIdentifier to determine the s...
USD_API TfTokenVector GetPropertyOrder() const
Return the strongest propertyOrder metadata value authored on this prim.
bool RemoveAPI() const
Removes a single-apply API schema with the given C++ type SchemaType from this prim in the current ed...
Definition: prim.h:1236
USD_API bool HasAPI(const TfToken &schemaIdentifier, const TfToken &instanceName) const
This is an overload of HasAPI with instanceName that takes a schemaIdentifier to determine the schema...
USD_API UsdProperty GetProperty(const TfToken &propName) const
Return a UsdProperty with the name propName.
USD_API bool HasAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, const TfToken &instanceName) const
This is an overload of HasAPI with instanceName that takes a schemaFamily and schemaVersion to determ...
bool SetSpecifier(SdfSpecifier specifier) const
Author an opinion for this Prim's specifier at the current edit target.
Definition: prim.h:188
USD_API bool SetPayload(const std::string &assetPath, const SdfPath &primPath) const
bool IsComponent() const
Return true if this prim is a component model based on its kind metadata, false otherwise.
Definition: prim.h:268
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
Definition: prim.h:120
bool IsActive() const
Return true if this prim is active, meaning neither it nor any of its ancestors have active=false.
Definition: prim.h:221
USD_API UsdAttribute CreateAttribute(const std::vector< std::string > &nameElts, const SdfValueTypeName &typeName, bool custom, SdfVariability variability=SdfVariabilityVarying) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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...
bool SetActive(bool active) const
Author 'active' metadata for this prim at the current EditTarget.
Definition: prim.h:227
bool HasDefiningSpecifier() const
Return true if this prim has a specifier of type SdfSpecifierDef or SdfSpecifierClass.
Definition: prim.h:288
USD_API std::vector< UsdAttribute > GetAttributes() const
Like GetProperties(), but exclude all relationships from the result.
USD_API TfTokenVector GetChildrenNames() const
Return the names of the child prims in the order they appear when iterating over GetChildren.
USD_API TfTokenVector GetChildrenReorder() const
Return the strongest opinion for the metadata used to reorder children of this prim.
USD_API SdfPathVector FindAllRelationshipTargetPaths(Usd_PrimFlagsPredicate const &traversalPredicate, std::function< bool(UsdRelationship const &)> const &pred=nullptr, bool recurseOnTargets=false) const
Search the prim subtree rooted at this prim according to traversalPredicate for relationships for whi...
USD_API UsdReferences GetReferences() const
Return a UsdReferences object that allows one to add, remove, or mutate references at the currently s...
USD_API void Load(UsdLoadPolicy policy=UsdLoadWithDescendants) const
Load this prim, all its ancestors, and by default all its descendants.
USD_API bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const
Removes the applied API schema name token appliedSchemaName from the apiSchemas metadata for this pri...
USD_API SdfPathVector FindAllAttributeConnectionPaths(std::function< bool(UsdAttribute const &)> const &pred=nullptr, bool recurseOnSources=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool ApplyAPI(const TfType &schemaType) const
This is an overload of ApplyAPI that takes a TfType schemaType .
USD_API bool RemoveProperty(const TfToken &propName)
Remove all scene description for the property with the given propName in the current UsdEditTarget.
bool ApplyAPI() const
Applies a single-apply API schema with the given C++ type SchemaType to this prim in the current edit...
Definition: prim.h:1116
bool IsGroup() const
Return true if this prim is a model group based on its kind metadata, false otherwise.
Definition: prim.h:263
USD_API std::vector< UsdRelationship > GetRelationships() const
Like GetProperties(), but exclude all attributes from the result.
USD_API PcpPrimIndex ComputeExpandedPrimIndex() const
Compute the prim index containing all sites that could contribute opinions to this prim.
bool SetInstanceable(bool instanceable) const
Author 'instanceable' metadata for this prim at the current EditTarget.
Definition: prim.h:2020
bool IsModel() const
Return true if this prim is a model based on its kind metadata, false otherwise.
Definition: prim.h:255
bool ClearInstanceable() const
Remove the authored 'instanceable' opinion at the current EditTarget.
Definition: prim.h:2026
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
Return a UsdRelationship with the name relName.
bool ApplyAPI(const TfToken &instanceName) const
Applies a multiple-apply API schema with the given C++ type SchemaType and instance name instanceName...
Definition: prim.h:1157
USD_API bool RemoveAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, const TfToken &instanceName) const
This is an overload of RemoveAPI with instanceName that takes a schemaFamily and schemaVersion to det...
USD_API bool HasAPIInFamily(const TfToken &schemaIdentifier, UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of HasAPIInFamily that parses the schema family and version to use from the ...
USD_API bool IsA(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion) const
This is an overload of IsA that takes a schemaFamily and schemaVersion to determine the schema type.
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 bool CanApplyAPI(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion, std::string *whyNot=nullptr) const
This is an overload of CanApplyAPI that takes a schemaFamily and schemaVersion to determine the schem...
USD_API bool ApplyAPI(const TfToken &schemaIdentifier, const TfToken &instanceName) const
This is an overload of ApplyAPI with instanceName that takes a schemaIdentifier to determine the sche...
USD_API bool HasAPI(const TfToken &schemaIdentifier) const
This is an overload of HasAPI that takes a schemaIdentifier to determine the schema type.
USD_API bool HasAPI(const TfType &schemaType, const TfToken &instanceName) const
This is an overload of HasAPI with instanceName that takes a TfType schemaType .
USD_API bool HasRelationship(const TfToken &relName) const
Return true if this prim has a relationship named relName, false otherwise.
bool HasAuthoredTypeName() const
Return true if a typeName has been authored.
Definition: prim.h:213
USD_API UsdRelationship GetRelationshipAtPath(const SdfPath &path) const
Returns the relationship at path on the same stage as this prim.
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...
USD_API std::vector< UsdProperty > GetAuthoredProperties(const PropertyPredicateFunc &predicate={}) const
Return this prim's properties (attributes and relationships) that have authored scene description,...
USD_API bool ApplyAPI(const TfToken &schemaIdentifier) const
This is an overload of ApplyAPI that takes a schemaIdentifier to determine the schema type.
bool IsAbstract() const
Return true if this prim or any of its ancestors is a class.
Definition: prim.h:280
bool HasAPIInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of HasAPIInFamily that finds a registered schema for the C++ schema class Sc...
Definition: prim.h:850
USD_API std::vector< UsdAttribute > GetAuthoredAttributes() const
Like GetAttributes(), but exclude attributes without authored scene description from the result.
USD_API bool HasAPIInFamily(const TfType &schemaType, UsdSchemaRegistry::VersionPolicy versionPolicy, const TfToken &instanceName) const
Overload for convenience of HasAPIInFamily that finds a registered schema for the given schemaType an...
bool IsInFamily(UsdSchemaRegistry::VersionPolicy versionPolicy) const
Overload for convenience of IsInFamily that finds a registered schema for the C++ schema class Schema...
Definition: prim.h:620
bool ClearTypeName() const
Clear the opinion for this Prim's typeName at the current edit target.
Definition: prim.h:208
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Definition: primRange.h:102
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2275
UsdPrimSiblingIterator & operator++()
Preincrement.
Definition: prim.h:2302
reference operator*() const
Dereference.
Definition: prim.h:2296
UsdPrimSiblingIterator operator++(int)
Postincrement.
Definition: prim.h:2308
pointer operator->() const
Indirection.
Definition: prim.h:2299
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2366
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2407
iterator begin() const
First iterator.
Definition: prim.h:2387
UsdPrimSiblingIterator iterator
Iterator type.
Definition: prim.h:2369
const_iterator cbegin() const
First iterator.
Definition: prim.h:2390
UsdPrimSiblingRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2419
UsdPrimSiblingRange(UsdPrimSiblingIterator begin, UsdPrimSiblingIterator end)
Construct with a pair of iterators.
Definition: prim.h:2382
bool empty() const
Return begin() == end().
Definition: prim.h:2425
iterator end() const
Past-the-end iterator.
Definition: prim.h:2393
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2377
friend bool operator!=(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2470
friend bool operator==(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2436
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2396
friend bool operator==(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2450
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2463
bool equal(const UsdPrimSiblingRange &other) const
Equality compare.
Definition: prim.h:2402
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2375
UsdPrimSiblingRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2413
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2373
friend bool operator!=(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2456
friend bool operator==(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2429
UsdPrimSiblingIterator const_iterator
Const iterator type.
Definition: prim.h:2371
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2524
bool operator==(const UsdPrimSubtreeIterator &other) const
Equality.
Definition: prim.h:2563
UsdPrimSubtreeIterator & operator++()
Preincrement.
Definition: prim.h:2550
reference operator*() const
Dereference.
Definition: prim.h:2545
UsdPrimSubtreeIterator operator++(int)
Postincrement.
Definition: prim.h:2556
bool operator!=(const UsdPrimSubtreeIterator &other) const
Inequality.
Definition: prim.h:2568
pointer operator->() const
Indirection.
Definition: prim.h:2547
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2623
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2666
iterator begin() const
First iterator.
Definition: prim.h:2644
UsdPrimSubtreeIterator const_iterator
Const iterator type.
Definition: prim.h:2628
const_iterator cbegin() const
First iterator.
Definition: prim.h:2647
UsdPrimSubtreeIterator iterator
Iterator type.
Definition: prim.h:2626
friend bool operator==(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2710
bool empty() const
Return begin() == end().
Definition: prim.h:2684
iterator end() const
Past-the-end iterator.
Definition: prim.h:2650
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2634
friend bool operator==(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2688
UsdPrimSubtreeRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2678
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2653
bool equal(const UsdPrimSubtreeRange &other) const
Equality compare.
Definition: prim.h:2661
UsdPrimSubtreeRange(UsdPrimSubtreeIterator begin, UsdPrimSubtreeIterator end)
Construct with a pair of iterators.
Definition: prim.h:2639
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2716
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2632
UsdPrimSubtreeRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2672
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2630
friend bool operator==(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2695
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2730
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2723
Class that holds the full type information for a prim.
Definition: primTypeInfo.h:31
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:38
UsdReferences provides an interface to authoring and introspecting references in Usd.
Definition: references.h:197
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:111
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:56
The base class for all schema types in Usd.
Definition: schemaBase.h:39
UsdSchemaVersion version
The version number of the schema within its schema family.
TfToken family
The name of the family of schema's which the schema is a version of.
VersionPolicy
A policy for filtering by schema version when querying for schemas in a particular schema family.
Structure that holds the information about a schema that is registered with the schema registry.
A proxy class for applying listOp edits to the specializes list for a prim.
Definition: specializes.h:34
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
Definition: stage.h:136
A UsdVariantSet represents a single VariantSet in USD (e.g.
Definition: variantSets.h:39
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
Definition: variantSets.h:205
UsdLoadPolicy
Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or not descendant prims are ...
Definition: common.h:99
@ UsdLoadWithDescendants
Load a prim plus all its descendants.
Definition: common.h:101
Standard pointer typedefs.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
Definition: diagnostic.h:205
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
Definition: diagnostic.h:68
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:35
unspecified UsdPrimDefaultPredicate
The default predicate used for prim traversals in methods like UsdPrim::GetChildren,...
unspecified UsdPrimAllPrimsPredicate
Predicate that includes all prims.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
Definition: types.h:100
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:156