Loading...
Searching...
No Matches
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
301 USD_API
303
307 std::function<bool (const TfToken &propertyName)>;
308
320 USD_API
322 const PropertyPredicateFunc &predicate={}) const;
323
337 USD_API
339 const PropertyPredicateFunc &predicate={}) const;
340
384 USD_API
385 std::vector<UsdProperty> GetProperties(
386 const PropertyPredicateFunc &predicate={}) const;
387
401 USD_API
402 std::vector<UsdProperty> GetAuthoredProperties(
403 const PropertyPredicateFunc &predicate={}) const;
404
416 USD_API
417 std::vector<UsdProperty>
418 GetPropertiesInNamespace(const std::vector<std::string> &namespaces) const;
419
424 USD_API
425 std::vector<UsdProperty>
426 GetPropertiesInNamespace(const std::string &namespaces) const;
427
433 USD_API
434 std::vector<UsdProperty>
436 const std::vector<std::string> &namespaces) const;
437
443 USD_API
444 std::vector<UsdProperty>
445 GetAuthoredPropertiesInNamespace(const std::string &namespaces) const;
446
448 USD_API
450
453 void SetPropertyOrder(const TfTokenVector &order) const {
454 SetMetadata(SdfFieldKeys->PropertyOrder, order);
455 }
456
459 void ClearPropertyOrder() const {
460 ClearMetadata(SdfFieldKeys->PropertyOrder);
461 }
462
474 USD_API
475 bool RemoveProperty(const TfToken &propName);
476
489 USD_API
490 UsdProperty GetProperty(const TfToken &propName) const;
491
494 USD_API
495 bool HasProperty(const TfToken &propName) const;
496
515 USD_API
516 bool GetKind(TfToken *kind) const;
517
520 USD_API
521 bool SetKind(const TfToken &kind) const;
522
523private:
524 // Helper functions for the public schema query and API schema
525 // authoring functions. The public functions have overloads that take
526 // a type, an identifier, or a family which all are used to find the
527 // SchemaInfo from the schema registry.
528 USD_API
529 bool _IsA(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
530
531 USD_API
532 bool _HasAPI(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
533
534 USD_API
535 bool _HasAPIInstance(
536 const UsdSchemaRegistry::SchemaInfo *schemaInfo,
537 const TfToken &instanceName) const;
538
539 USD_API
540 bool _CanApplySingleApplyAPI(
541 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
542 std::string *whyNot) const;
543
544 USD_API
545 bool _CanApplyMultipleApplyAPI(
546 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
547 const TfToken& instanceName,
548 std::string *whyNot) const;
549
550 USD_API
551 bool _ApplySingleApplyAPI(
552 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
553
554 USD_API
555 bool _ApplyMultipleApplyAPI(
556 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
557 const TfToken &instanceName) const;
558
559 USD_API
560 bool _RemoveSingleApplyAPI(
561 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
562
563 USD_API
564 bool _RemoveMultipleApplyAPI(
565 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
566 const TfToken &instanceName) const;
567
568public:
572
579 template <typename SchemaType>
580 bool IsA() const {
581 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
582 "Provided type must derive UsdSchemaBase.");
583 return _IsA(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
584 };
585
587 USD_API
588 bool IsA(const TfType& schemaType) const;
589
592 USD_API
593 bool IsA(const TfToken& schemaIdentifier) const;
594
597 USD_API
598 bool IsA(const TfToken& schemaFamily,
599 UsdSchemaVersion schemaVersion) const;
600
602
606
609 USD_API
610 bool IsInFamily(const TfToken &schemaFamily) const;
611
615 USD_API
617 const TfToken &schemaFamily,
618 UsdSchemaVersion schemaVersion,
619 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
620
625 template <typename SchemaType>
627 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
628 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
629 "Provided type must derive UsdSchemaBase.");
630 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
631 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
632 if (!schemaInfo) {
633 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
634 "UsdSchemaRegistry as a schema type. The schema may need to be "
635 "regenerated.",
636 TfType::Find<SchemaType>().GetTypeName().c_str());
637 return false;
638 }
639 return IsInFamily(schemaInfo->family, schemaInfo->version,
640 versionPolicy);
641 };
642
647 USD_API
649 const TfType &schemaType,
650 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
651
660 USD_API
662 const TfToken &schemaIdentifier,
663 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
664
669 USD_API
671 const TfToken &schemaFamily,
672 UsdSchemaVersion *schemaVersion) const;
673
675
721
728 template <typename SchemaType>
729 bool
730 HasAPI() const {
731 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
732 "Provided type must derive UsdAPISchemaBase.");
733 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
734 "Provided type must not be UsdAPISchemaBase.");
735 static_assert(
736 SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI ||
737 SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
738 "Provided schema type must be an applied API schema.");
739
740 return _HasAPI(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
741 }
742
748 template <typename SchemaType>
749 bool
750 HasAPI(const TfToken &instanceName) const {
751 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
752 "Provided type must derive UsdAPISchemaBase.");
753 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
754 "Provided type must not be UsdAPISchemaBase.");
755 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
756 "Provided schema type must be a multi apply API schema.");
757
758 return _HasAPIInstance(
759 UsdSchemaRegistry::FindSchemaInfo<SchemaType>(), instanceName);
760 }
761
763 USD_API
764 bool HasAPI(const TfType& schemaType) const;
765
768 USD_API
769 bool HasAPI(const TfType& schemaType,
770 const TfToken& instanceName) const;
771
774 USD_API
775 bool HasAPI(const TfToken& schemaIdentifier) const;
776
780 USD_API
781 bool HasAPI(const TfToken& schemaIdentifier,
782 const TfToken& instanceName) const;
783
786 USD_API
787 bool HasAPI(const TfToken& schemaFamily,
788 UsdSchemaVersion schemaVersion) const;
789
793 USD_API
794 bool HasAPI(const TfToken& schemaFamily,
795 UsdSchemaVersion schemaVersion,
796 const TfToken& instanceName) const;
797
799
803
810 USD_API
812 const TfToken &schemaFamily) const;
813
819 USD_API
821 const TfToken &schemaFamily,
822 const TfToken &instanceName) const;
823
832 USD_API
834 const TfToken &schemaFamily,
835 UsdSchemaVersion schemaVersion,
836 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
837
844 USD_API
846 const TfToken &schemaFamily,
847 UsdSchemaVersion schemaVersion,
849 const TfToken &instanceName) const;
850
855 template <typename SchemaType>
857 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
858 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
859 "Provided type must derive UsdSchemaBase.");
860 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
861 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
862 if (!schemaInfo) {
863 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
864 "UsdSchemaRegistry as a schema type. The schema may need to be "
865 "regenerated.",
866 TfType::Find<SchemaType>().GetTypeName().c_str());
867 return false;
868 }
869 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
870 versionPolicy);
871 };
872
877 template <typename SchemaType>
880 const TfToken &instanceName) const {
881 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
882 "Provided type must derive UsdSchemaBase.");
883 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
884 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
885 if (!schemaInfo) {
886 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
887 "UsdSchemaRegistry as a schema type. The schema may need to be "
888 "regenerated.",
889 TfType::Find<SchemaType>().GetTypeName().c_str());
890 return false;
891 }
892 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
893 versionPolicy, instanceName);
894 };
895
900 USD_API
902 const TfType &schemaType,
903 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
904
909 USD_API
911 const TfType &schemaType,
913 const TfToken &instanceName) const;
914
923 USD_API
925 const TfToken &schemaIdentifier,
926 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
927
936 USD_API
938 const TfToken &schemaIdentifier,
940 const TfToken &instanceName) const;
941
955 USD_API
956 bool
958 const TfToken &schemaFamily,
959 UsdSchemaVersion *schemaVersion) const;
960
973 USD_API
974 bool
976 const TfToken &schemaFamily,
977 const TfToken &instanceName,
978 UsdSchemaVersion *schemaVersion) const;
979
981
985
998 template <typename SchemaType>
999 bool CanApplyAPI(std::string *whyNot = nullptr) const {
1000 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1001 "Provided type must derive UsdAPISchemaBase.");
1002 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1003 "Provided type must not be UsdAPISchemaBase.");
1004 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1005 "Provided schema type must be a single apply API schema.");
1006
1007 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1008 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1009 if (!schemaInfo) {
1010 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1011 "UsdSchemaRegistry as a schema type. The schema may need to be "
1012 "regenerated.",
1013 TfType::Find<SchemaType>().GetTypeName().c_str());
1014 return false;
1015 }
1016 return _CanApplySingleApplyAPI(*schemaInfo, whyNot);
1017 }
1018
1032 template <typename SchemaType>
1033 bool CanApplyAPI(const TfToken &instanceName,
1034 std::string *whyNot = nullptr) const {
1035 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1036 "Provided type must derive UsdAPISchemaBase.");
1037 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1038 "Provided type must not be UsdAPISchemaBase.");
1039 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1040 "Provided schema type must be a multiple apply API schema.");
1041
1042 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1043 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1044 if (!schemaInfo) {
1045 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1046 "UsdSchemaRegistry as a schema type. The schema may need to be "
1047 "regenerated.",
1048 TfType::Find<SchemaType>().GetTypeName().c_str());
1049 return false;
1050 }
1051 return _CanApplyMultipleApplyAPI(*schemaInfo, instanceName, whyNot);
1052 }
1053
1056 USD_API
1057 bool CanApplyAPI(const TfType& schemaType,
1058 std::string *whyNot = nullptr) const;
1059
1063 USD_API
1064 bool CanApplyAPI(const TfType& schemaType,
1065 const TfToken& instanceName,
1066 std::string *whyNot = nullptr) const;
1067
1070 USD_API
1071 bool CanApplyAPI(const TfToken& schemaIdentifier,
1072 std::string *whyNot = nullptr) const;
1073
1078 USD_API
1079 bool CanApplyAPI(const TfToken& schemaIdentifier,
1080 const TfToken& instanceName,
1081 std::string *whyNot = nullptr) const;
1082
1085 USD_API
1086 bool CanApplyAPI(const TfToken& schemaFamily,
1087 UsdSchemaVersion schemaVersion,
1088 std::string *whyNot = nullptr) const;
1089
1094 USD_API
1095 bool CanApplyAPI(const TfToken& schemaFamily,
1096 UsdSchemaVersion schemaVersion,
1097 const TfToken& instanceName,
1098 std::string *whyNot = nullptr) const;
1099
1101
1105
1121 template <typename SchemaType>
1122 bool ApplyAPI() const {
1123 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1124 "Provided type must derive UsdAPISchemaBase.");
1125 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1126 "Provided type must not be UsdAPISchemaBase.");
1127 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1128 "Provided schema type must be a single apply API schema.");
1129
1130 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1131 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1132 if (!schemaInfo) {
1133 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1134 "UsdSchemaRegistry as a schema type. The schema may need to be "
1135 "regenerated.",
1136 TfType::Find<SchemaType>().GetTypeName().c_str());
1137 return false;
1138 }
1139 return _ApplySingleApplyAPI(*schemaInfo);
1140 }
1141
1162 template <typename SchemaType>
1163 bool ApplyAPI(const TfToken &instanceName) const {
1164 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1165 "Provided type must derive UsdAPISchemaBase.");
1166 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1167 "Provided type must not be UsdAPISchemaBase.");
1168 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1169 "Provided schema type must be a multiple apply API schema.");
1170
1171 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1172 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1173 if (!schemaInfo) {
1174 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1175 "UsdSchemaRegistry as a schema type. The schema may need to be "
1176 "regenerated.",
1177 TfType::Find<SchemaType>().GetTypeName().c_str());
1178 return false;
1179 }
1180 return _ApplyMultipleApplyAPI(*schemaInfo, instanceName);
1181 }
1182
1184 USD_API
1185 bool ApplyAPI(const TfType& schemaType) const;
1186
1189 USD_API
1190 bool ApplyAPI(const TfType& schemaType,
1191 const TfToken& instanceName) const;
1192
1195 USD_API
1196 bool ApplyAPI(const TfToken& schemaIdentifier) const;
1197
1201 USD_API
1202 bool ApplyAPI(const TfToken& schemaIdentifier,
1203 const TfToken& instanceName) const;
1204
1207 USD_API
1208 bool ApplyAPI(const TfToken& schemaFamily,
1209 UsdSchemaVersion schemaVersion) const;
1210
1214 USD_API
1215 bool ApplyAPI(const TfToken& schemaFamily,
1216 UsdSchemaVersion schemaVersion,
1217 const TfToken& instanceName) const;
1218
1220
1224
1241 template <typename SchemaType>
1242 bool RemoveAPI() const {
1243 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1244 "Provided type must derive UsdAPISchemaBase.");
1245 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1246 "Provided type must not be UsdAPISchemaBase.");
1247 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1248 "Provided schema type must be a single apply API schema.");
1249
1250 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1251 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1252 if (!schemaInfo) {
1253 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1254 "UsdSchemaRegistry as a schema type. The schema may need to be "
1255 "regenerated.",
1256 TfType::Find<SchemaType>().GetTypeName().c_str());
1257 return false;
1258 }
1259 return _RemoveSingleApplyAPI(*schemaInfo);
1260 }
1261
1283 template <typename SchemaType>
1284 bool RemoveAPI(const TfToken &instanceName) const {
1285 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1286 "Provided type must derive UsdAPISchemaBase.");
1287 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1288 "Provided type must not be UsdAPISchemaBase.");
1289 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1290 "Provided schema type must be a multiple apply API schema.");
1291
1292 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1293 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1294 if (!schemaInfo) {
1295 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1296 "UsdSchemaRegistry as a schema type. The schema may need to be "
1297 "regenerated.",
1298 TfType::Find<SchemaType>().GetTypeName().c_str());
1299 return false;
1300 }
1301 return _RemoveMultipleApplyAPI(*schemaInfo, instanceName);
1302 }
1303
1305 USD_API
1306 bool RemoveAPI(const TfType& schemaType) const;
1307
1310 USD_API
1311 bool RemoveAPI(const TfType& schemaType,
1312 const TfToken& instanceName) const;
1313
1316 USD_API
1317 bool RemoveAPI(const TfToken& schemaIdentifier) const;
1318
1322 USD_API
1323 bool RemoveAPI(const TfToken& schemaIdentifier,
1324 const TfToken& instanceName) const;
1325
1328 USD_API
1329 bool RemoveAPI(const TfToken& schemaFamily,
1330 UsdSchemaVersion schemaVersion) const;
1331
1335 USD_API
1336 bool RemoveAPI(const TfToken& schemaFamily,
1337 UsdSchemaVersion schemaVersion,
1338 const TfToken& instanceName) const;
1339
1341
1365 USD_API
1366 bool AddAppliedSchema(const TfToken &appliedSchemaName) const;
1367
1392 USD_API
1393 bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const;
1394
1395 // --------------------------------------------------------------------- //
1397 // --------------------------------------------------------------------- //
1398
1404 USD_API
1405 UsdPrim GetChild(const TfToken &name) const;
1406
1415 inline SiblingRange GetChildren() const;
1416
1418 inline SiblingRange GetAllChildren() const;
1419
1439 inline SiblingRange
1440 GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const;
1441
1444 USD_API
1446
1449 USD_API
1451
1454 USD_API
1456 const Usd_PrimFlagsPredicate &predicate) const;
1457
1470 inline SubtreeRange GetDescendants() const;
1471
1480 inline SubtreeRange GetAllDescendants() const;
1481
1505 inline SubtreeRange
1506 GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const;
1507
1513 USD_API
1515
1518 void SetChildrenReorder(const TfTokenVector &order) const {
1519 SetMetadata(SdfFieldKeys->PrimOrder, order);
1520 }
1521
1525 ClearMetadata(SdfFieldKeys->PrimOrder);
1526 }
1527
1528public:
1529 // --------------------------------------------------------------------- //
1531 // --------------------------------------------------------------------- //
1532
1536 Usd_PrimDataConstPtr prim = get_pointer(_Prim());
1537 SdfPath proxyPrimPath = _ProxyPrimPath();
1538 Usd_MoveToParent(prim, proxyPrimPath);
1539 return UsdPrim(prim, proxyPrimPath);
1540 }
1541
1550 USD_API
1552
1558 USD_API
1560 const Usd_PrimFlagsPredicate &predicate) const;
1561
1568 USD_API
1569 bool IsPseudoRoot() const;
1570
1574 USD_API UsdPrim GetPrimAtPath(const SdfPath& path) const;
1575
1579 USD_API UsdObject GetObjectAtPath(const SdfPath& path) const;
1580
1589 USD_API UsdProperty GetPropertyAtPath(const SdfPath& path) const;
1590
1599 USD_API UsdAttribute GetAttributeAtPath(const SdfPath& path) const;
1600
1610
1611 // --------------------------------------------------------------------- //
1613 // --------------------------------------------------------------------- //
1614
1620 USD_API
1622
1630 USD_API
1631 UsdVariantSet GetVariantSet(const std::string& variantSetName) const;
1632
1638 USD_API
1639 bool HasVariantSets() const;
1640
1641 // --------------------------------------------------------------------- //
1643 // --------------------------------------------------------------------- //
1644
1684 USD_API
1687 const SdfValueTypeName &typeName,
1688 bool custom,
1689 SdfVariability variability = SdfVariabilityVarying) const;
1692 USD_API
1695 const SdfValueTypeName &typeName,
1696 SdfVariability variability = SdfVariabilityVarying) const;
1697
1702 USD_API
1704 const std::vector<std::string> &nameElts,
1705 const SdfValueTypeName &typeName,
1706 bool custom,
1707 SdfVariability variability = SdfVariabilityVarying) const;
1711 USD_API
1713 const std::vector<std::string> &nameElts,
1714 const SdfValueTypeName &typeName,
1715 SdfVariability variability = SdfVariabilityVarying) const;
1716
1718 USD_API
1719 std::vector<UsdAttribute> GetAttributes() const;
1720
1723 USD_API
1724 std::vector<UsdAttribute> GetAuthoredAttributes() const;
1725
1738 USD_API
1739 UsdAttribute GetAttribute(const TfToken& attrName) const;
1740
1743 USD_API
1744 bool HasAttribute(const TfToken& attrName) const;
1745
1752 USD_API
1753 SdfPathVector
1755 Usd_PrimFlagsPredicate const &traversalPredicate,
1756 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1757 bool recurseOnSources = false) const;
1758
1762 USD_API
1763 SdfPathVector
1765 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1766 bool recurseOnSources = false) const;
1767
1768 // --------------------------------------------------------------------- //
1770 // --------------------------------------------------------------------- //
1771
1808 USD_API
1810 bool custom=true) const;
1811
1816 USD_API
1817 UsdRelationship CreateRelationship(const std::vector<std::string> &nameElts,
1818 bool custom=true)
1819 const;
1820
1822 USD_API
1823 std::vector<UsdRelationship> GetRelationships() const;
1824
1827 USD_API
1828 std::vector<UsdRelationship> GetAuthoredRelationships() const;
1829
1842 USD_API
1844
1847 USD_API
1848 bool HasRelationship(const TfToken& relName) const;
1849
1856 USD_API
1857 SdfPathVector
1859 Usd_PrimFlagsPredicate const &traversalPredicate,
1860 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1861 bool recurseOnTargets = false) const;
1862
1866 USD_API
1867 SdfPathVector
1869 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1870 bool recurseOnTargets = false) const;
1871
1872 // --------------------------------------------------------------------- //
1879 // --------------------------------------------------------------------- //
1880
1884 USD_API
1885 bool ClearPayload() const;
1886
1891 USD_API
1892 bool HasPayload() const;
1893
1899 USD_API
1900 bool SetPayload(const SdfPayload& payload) const;
1901
1904 USD_API
1906 const std::string& assetPath, const SdfPath& primPath) const;
1907
1911 USD_API
1912 bool SetPayload(const SdfLayerHandle& layer, const SdfPath& primPath) const;
1913
1915
1916 // --------------------------------------------------------------------- //
1918 // --------------------------------------------------------------------- //
1919
1927 USD_API
1929
1931 USD_API
1933
1939 USD_API
1941
1945 USD_API
1946 void Unload() const;
1947
1948 // --------------------------------------------------------------------- //
1950 // --------------------------------------------------------------------- //
1951
1961 USD_API
1963
1965 USD_API
1967
1968 // --------------------------------------------------------------------- //
1970 // --------------------------------------------------------------------- //
1971
1981 USD_API
1983
1985 USD_API
1987
1988 // --------------------------------------------------------------------- //
1990 // --------------------------------------------------------------------- //
1991
1999 USD_API
2001
2003 USD_API
2005
2006 // --------------------------------------------------------------------- //
2010 // --------------------------------------------------------------------- //
2011
2018 bool IsInstanceable() const {
2019 bool instanceable = false;
2020 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
2021 instanceable;
2022 }
2023
2026 bool SetInstanceable(bool instanceable) const {
2027 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2028 }
2029
2032 bool ClearInstanceable() const {
2033 return ClearMetadata(SdfFieldKeys->Instanceable);
2034 }
2035
2039 return HasAuthoredMetadata(SdfFieldKeys->Instanceable);
2040 }
2041
2047 bool IsInstance() const { return _Prim()->IsInstance(); }
2048
2052 bool IsInstanceProxy() const {
2053 return Usd_IsInstanceProxy(_Prim(), _ProxyPrimPath());
2054 }
2055
2063 USD_API
2064 static bool IsPrototypePath(const SdfPath& path);
2065
2070 USD_API
2071 static bool IsPathInPrototype(const SdfPath& path);
2072
2077 bool IsPrototype() const { return _Prim()->IsPrototype(); }
2078
2083 bool IsInPrototype() const {
2084 return (IsInstanceProxy() ?
2086 }
2087
2090 USD_API
2092
2097 if (IsInstanceProxy()) {
2098 return UsdPrim(_Prim(), SdfPath());
2099 }
2100 return UsdPrim();
2101 }
2102
2108 USD_API
2109 std::vector<UsdPrim> GetInstances() const;
2111
2112 // --------------------------------------------------------------------- //
2115 // --------------------------------------------------------------------- //
2116
2139 const PcpPrimIndex &GetPrimIndex() const { return _Prim()->GetPrimIndex(); }
2140
2161 USD_API
2163
2171 USD_API
2173 const UsdEditTarget &editTarget) const;
2174
2182 USD_API
2184 const UsdEditTarget &editTarget) const;
2185
2187
2188private:
2189 class _ProtoToInstancePathMap {
2190 friend class UsdPrim;
2191 public:
2192 using _Map = std::vector<std::pair<SdfPath, SdfPath>>;
2193 SdfPath MapProtoToInstance(SdfPath const &protoPath) const;
2194 private:
2195 _Map _map;
2196 };
2197
2198 friend class UsdObject;
2199 friend class UsdPrimSiblingIterator;
2200 friend class UsdPrimSubtreeIterator;
2201 friend class UsdProperty;
2202 friend class UsdSchemaBase;
2203 friend class UsdAPISchemaBase;
2204 friend class UsdStage;
2205 friend class UsdPrimRange;
2206 friend class Usd_PrimData;
2207 friend class Usd_PrimFlagsPredicate;
2208 friend struct Usd_StageImplAccess;
2209 friend struct UsdPrim_RelTargetFinder;
2210 friend struct UsdPrim_AttrConnectionFinder;
2211
2212 // Prim constructor.
2213 UsdPrim(const Usd_PrimDataHandle &primData,
2214 const SdfPath &proxyPrimPath)
2215 : UsdObject(primData, proxyPrimPath) { }
2216
2217 // General constructor.
2218 UsdPrim(UsdObjType objType,
2219 const Usd_PrimDataHandle &prim,
2220 const SdfPath &proxyPrimPath,
2221 const TfToken &propName)
2222 : UsdObject(objType, prim, proxyPrimPath, propName) {}
2223
2224 // Helper to make a sibling range.
2225 inline SiblingRange
2226 _MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const;
2227
2228 // Helper to make a range of descendants.
2229 inline SubtreeRange
2230 _MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const;
2231
2232 // Helper to make a vector of properties from names.
2233 std::vector<UsdProperty>
2234 _MakeProperties(const TfTokenVector &names) const;
2235
2236 // Helper for Get{Authored}{PropertyNames,Properties}
2237 TfTokenVector _GetPropertyNames(
2238 bool onlyAuthored,
2239 bool applyOrder=true,
2240 const PropertyPredicateFunc &predicate={}) const;
2241
2242 // Helper for Get(Authored)PropertiesInNamespace.
2243 std::vector<UsdProperty>
2244 _GetPropertiesInNamespace(const std::string &namespaces,
2245 bool onlyAuthored) const;
2246
2247 // Helper for Get(Authored)Attributes.
2248 std::vector<UsdAttribute>
2249 _GetAttributes(bool onlyAuthored, bool applyOrder=false) const;
2250
2251 // Helper for Get(Authored)Relationships.
2252 std::vector<UsdRelationship>
2253 _GetRelationships(bool onlyAuthored, bool applyOrder=false) const;
2254
2255 friend const PcpPrimIndex &Usd_PrimGetSourcePrimIndex(const UsdPrim&);
2256 // Return a const reference to the source PcpPrimIndex for this prim.
2257 //
2258 // For all prims in prototypes (which includes the prototype prim itself),
2259 // this is the prim index for the instance that was chosen to serve
2260 // as the prototype for all other instances. This prim index will not
2261 // have the same path as the prim's path.
2262 //
2263 // This is a private helper but is also wrapped out to Python
2264 // for testing and debugging purposes.
2265 const PcpPrimIndex &_GetSourcePrimIndex() const
2266 { return _Prim()->GetSourcePrimIndex(); }
2267
2268 // Helper function for MakeResolveTargetUpToEditTarget and
2269 // MakeResolveTargetStrongerThanEditTarget.
2271 _MakeResolveTargetFromEditTarget(
2272 const UsdEditTarget &editTarget,
2273 bool makeAsStrongerThan) const;
2274
2275 _ProtoToInstancePathMap _GetProtoToInstancePathMap() const;
2276};
2277
2282 using _UnderlyingIterator = const Usd_PrimData*;
2283 class _PtrProxy {
2284 public:
2285 UsdPrim* operator->() { return &_prim; }
2286 private:
2287 friend class UsdPrimSiblingIterator;
2288 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2289 UsdPrim _prim;
2290 };
2291public:
2292 using iterator_category = std::forward_iterator_tag;
2293 using value_type = UsdPrim;
2294 using reference = UsdPrim;
2295 using pointer = _PtrProxy;
2296 using difference_type = std::ptrdiff_t;
2297
2298 // Default ctor.
2299 UsdPrimSiblingIterator() = default;
2300
2302 reference operator*() const { return dereference(); }
2303
2305 pointer operator->() const { return pointer(dereference()); }
2306
2309 increment();
2310 return *this;
2311 }
2312
2315 UsdPrimSiblingIterator result = *this;
2316 increment();
2317 return result;
2318 }
2319
2320 bool operator==(const UsdPrimSiblingIterator& other) const {
2321 return equal(other);
2322 }
2323
2324 bool operator!=(const UsdPrimSiblingIterator& other) const {
2325 return !equal(other);
2326 }
2327
2328private:
2329 friend class UsdPrim;
2330
2331 // Constructor used by Prim.
2332 UsdPrimSiblingIterator(const _UnderlyingIterator &i,
2333 const SdfPath& proxyPrimPath,
2334 const Usd_PrimFlagsPredicate &predicate)
2335 : _underlyingIterator(i)
2336 , _proxyPrimPath(proxyPrimPath)
2337 , _predicate(predicate) {
2338 // Need to advance iterator to first matching element.
2339 if (_underlyingIterator &&
2340 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2341 _proxyPrimPath))
2342 increment();
2343 }
2344
2345 bool equal(const UsdPrimSiblingIterator &other) const {
2346 return _underlyingIterator == other._underlyingIterator &&
2347 _proxyPrimPath == other._proxyPrimPath &&
2348 _predicate == other._predicate;
2349 }
2350
2351 void increment() {
2352 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator, _proxyPrimPath,
2353 _predicate)) {
2354 _underlyingIterator = nullptr;
2355 _proxyPrimPath = SdfPath();
2356 }
2357 }
2358
2359 reference dereference() const {
2360 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2361 }
2362
2363 _UnderlyingIterator _underlyingIterator = nullptr;
2364 SdfPath _proxyPrimPath;
2365 Usd_PrimFlagsPredicate _predicate;
2366};
2367
2373public:
2379 typedef std::ptrdiff_t difference_type;
2384
2385 UsdPrimSiblingRange() = default;
2386
2389 UsdPrimSiblingIterator end) : _begin(begin),
2390 _end(end) {}
2391
2393 iterator begin() const { return _begin; }
2394
2396 const_iterator cbegin() const { return _begin; }
2397
2399 iterator end() const { return _end; }
2400
2402 const_iterator cend() const { return _end; }
2403
2405 explicit operator bool() const { return !empty(); }
2406
2408 bool equal(const UsdPrimSiblingRange& other) const {
2409 return _begin == other._begin && _end == other._end;
2410 }
2411
2414 TF_DEV_AXIOM(!empty());
2415 return *begin();
2416 }
2417
2420 std::advance(_begin, n);
2421 return *this;
2422 }
2423
2426 std::advance(_end, n);
2427 return *this;
2428 }
2429
2431 bool empty() const { return begin() == end(); }
2432
2433private:
2435 friend bool operator==(const UsdPrimSiblingRange &lhs,
2436 const UsdPrimSiblingRange &rhs) {
2437 return lhs.equal(rhs);
2438 }
2439
2441 template <class ForwardRange>
2442 friend bool operator==(const UsdPrimSiblingRange& lhs,
2443 const ForwardRange& rhs) {
2444 static_assert(
2445 std::is_same<typename decltype(std::cbegin(rhs))::iterator_category,
2446 std::forward_iterator_tag>::value,
2447 "rhs must be a forward iterator."
2448 );
2449 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2450 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2451 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2452 }
2453
2455 template <class ForwardRange>
2456 friend bool operator==(const ForwardRange& lhs,
2457 const UsdPrimSiblingRange& rhs) {
2458 return rhs == lhs;
2459 }
2460
2462 friend bool operator!=(const UsdPrimSiblingRange &lhs,
2463 const UsdPrimSiblingRange &rhs) {
2464 return !lhs.equal(rhs);
2465 }
2466
2468 template <class ForwardRange>
2469 friend bool operator!=(const ForwardRange& lhs,
2470 const UsdPrimSiblingRange& rhs) {
2471 return !(lhs == rhs);
2472 }
2473
2475 template <class ForwardRange>
2476 friend bool operator!=(const UsdPrimSiblingRange& lhs,
2477 const ForwardRange& rhs) {
2478 return !(lhs == rhs);
2479 }
2480
2481 iterator _begin;
2482 iterator _end;
2483};
2484
2485// Inform TfIterator it should feel free to make copies of the range type.
2486template <>
2487struct Tf_ShouldIterateOverCopy<
2488 UsdPrimSiblingRange> : std::true_type {};
2489template <>
2490struct Tf_ShouldIterateOverCopy<
2491 const UsdPrimSiblingRange> : std::true_type {};
2492
2494UsdPrim::GetFilteredChildren(const Usd_PrimFlagsPredicate &pred) const
2495{
2496 return _MakeSiblingRange(
2497 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2498}
2499
2502{
2504}
2505
2508{
2510}
2511
2512// Helper to make a sibling range.
2514UsdPrim::_MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const {
2515 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2516 SdfPath firstChildPath = _ProxyPrimPath();
2517 if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2518 firstChild = nullptr;
2519 firstChildPath = SdfPath();
2520 }
2521
2522 return SiblingRange(
2523 SiblingIterator(firstChild, firstChildPath, pred),
2524 SiblingIterator(nullptr, SdfPath(), pred));
2525}
2526
2531 using _UnderlyingIterator = Usd_PrimDataConstPtr;
2532 class _PtrProxy {
2533 public:
2534 UsdPrim* operator->() { return &_prim; }
2535 private:
2536 friend class UsdPrimSubtreeIterator;
2537 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2538 UsdPrim _prim;
2539 };
2540public:
2541 using iterator_category = std::forward_iterator_tag;
2542 using value_type = UsdPrim;
2543 using reference = UsdPrim;
2544 using pointer = _PtrProxy;
2545 using difference_type = std::ptrdiff_t;
2546
2547 // Default ctor.
2548 UsdPrimSubtreeIterator() = default;
2549
2551 reference operator*() const { return dereference(); }
2553 pointer operator->() const { return pointer(dereference()); }
2554
2557 increment();
2558 return *this;
2559 }
2560
2564 increment();
2565 return result;
2566 }
2567
2569 bool operator==(const UsdPrimSubtreeIterator &other) const {
2570 return equal(other);
2571 }
2572
2574 bool operator!=(const UsdPrimSubtreeIterator &other) const {
2575 return !equal(other);
2576 }
2577
2578
2579private:
2580 friend class UsdPrim;
2581
2582 // Constructor used by Prim.
2583 UsdPrimSubtreeIterator(const _UnderlyingIterator &i,
2584 const SdfPath &proxyPrimPath,
2585 const Usd_PrimFlagsPredicate &predicate)
2586 : _underlyingIterator(i)
2587 , _proxyPrimPath(proxyPrimPath)
2588 , _predicate(predicate) {
2589 // Need to advance iterator to first matching element.
2590 if (_underlyingIterator &&
2591 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2592 _proxyPrimPath)) {
2593 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2594 _proxyPrimPath, _predicate)) {
2595 _underlyingIterator = nullptr;
2596 _proxyPrimPath = SdfPath();
2597 }
2598 }
2599 }
2600
2601 bool equal(const UsdPrimSubtreeIterator &other) const {
2602 return _underlyingIterator == other._underlyingIterator &&
2603 _proxyPrimPath == other._proxyPrimPath &&
2604 _predicate == other._predicate;
2605 }
2606
2607 void increment() {
2608 if (!Usd_MoveToChild(_underlyingIterator, _proxyPrimPath,
2609 _predicate)) {
2610 while (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2611 _proxyPrimPath,
2612 _predicate)) {}
2613 }
2614 }
2615
2616 reference dereference() const {
2617 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2618 }
2619
2620 _UnderlyingIterator _underlyingIterator = nullptr;
2621 SdfPath _proxyPrimPath;
2622 Usd_PrimFlagsPredicate _predicate;
2623};
2624
2630public:
2636 typedef std::ptrdiff_t difference_type;
2641
2642 UsdPrimSubtreeRange() = default;
2643
2646 UsdPrimSubtreeIterator end) : _begin(begin),
2647 _end(end) {}
2648
2650 iterator begin() const { return _begin; }
2651
2653 const_iterator cbegin() const { return _begin; }
2654
2656 iterator end() const { return _end; }
2657
2659 const_iterator cend() const { return _end; }
2660
2662 explicit operator bool() const {
2663 return !empty();
2664 }
2665
2667 bool equal(const UsdPrimSubtreeRange& other) const {
2668 return _begin == other._begin && _end == other._end;
2669 }
2670
2673 TF_DEV_AXIOM(!empty());
2674 return *begin();
2675 }
2676
2679 std::advance(_begin, n);
2680 return *this;
2681 }
2682
2685 std::advance(_end, n);
2686 return *this;
2687 }
2688
2690 bool empty() const { return begin() == end(); }
2691
2692private:
2694 friend bool operator==(const UsdPrimSubtreeRange &lhs,
2695 const UsdPrimSubtreeRange &rhs) {
2696 return lhs.equal(rhs);
2697 }
2698
2700 template <class ForwardRange>
2701 friend bool operator==(const UsdPrimSubtreeRange& lhs,
2702 const ForwardRange& rhs) {
2703 static_assert(
2704 std::is_convertible<
2705 typename decltype(std::cbegin(rhs))::iterator_category,
2706 std::forward_iterator_tag>::value,
2707 "rhs must be a forward iterator."
2708 );
2709 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2710 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2711 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2712 }
2713
2715 template <class ForwardRange>
2716 friend bool operator==(const ForwardRange& lhs,
2717 const UsdPrimSubtreeRange& rhs) {
2718 return rhs == lhs;
2719 }
2720
2722 friend bool operator!=(const UsdPrimSubtreeRange &lhs,
2723 const UsdPrimSubtreeRange &rhs) {
2724 return !lhs.equal(rhs);
2725 }
2726
2728 template <class ForwardRange>
2729 friend bool operator!=(const ForwardRange& lhs,
2730 const UsdPrimSubtreeRange& rhs) {
2731 return !(lhs == rhs);
2732 }
2733
2735 template <class ForwardRange>
2736 friend bool operator!=(const UsdPrimSubtreeRange& lhs,
2737 const ForwardRange& rhs) {
2738 return !(lhs == rhs);
2739 }
2740
2741 iterator _begin;
2742 iterator _end;
2743};
2744
2745// Inform TfIterator it should feel free to make copies of the range type.
2746template <>
2747struct Tf_ShouldIterateOverCopy<
2748 UsdPrimSubtreeRange> : std::true_type {};
2749template <>
2750struct Tf_ShouldIterateOverCopy<
2751 const UsdPrimSubtreeRange> : std::true_type {};
2752
2754UsdPrim::GetFilteredDescendants(const Usd_PrimFlagsPredicate &pred) const
2755{
2756 return _MakeDescendantsRange(
2757 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2758}
2759
2762{
2764}
2765
2768{
2770}
2771
2772// Helper to make a sibling range.
2774UsdPrim::_MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const {
2775 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2776 SdfPath firstChildPath = _ProxyPrimPath();
2777 Usd_PrimDataConstPtr endChild = firstChild;
2778 SdfPath endChildPath = firstChildPath;
2779 if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2780 while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
2781 }
2782
2783 return SubtreeRange(
2784 SubtreeIterator(firstChild, firstChildPath, pred),
2785 SubtreeIterator(endChild, endChildPath, pred));
2786}
2787
2788
2790// UsdObject methods that require UsdPrim be a complete type.
2791
2792inline UsdPrim
2794{
2795 return UsdPrim(_prim, _proxyPrimPath);
2796}
2797
2798PXR_NAMESPACE_CLOSE_SCOPE
2799
2800#endif // PXR_USD_USD_PRIM_H
2801
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:72
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:183
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:759
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:2793
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:751
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:2501
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:2139
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:2096
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:2052
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:1535
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:2018
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:2507
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:1033
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:2767
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:999
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:2038
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:2754
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:2761
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:2494
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:1524
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:730
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:1518
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:459
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:750
bool IsPrototype() const
Return true if this prim is an instancing prototype prim, false otherwise.
Definition: prim.h:2077
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:580
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:2083
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:453
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:2047
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 const TfTokenVector & GetAppliedSchemas() const
Return a vector containing the names of API schemas which have been applied to this prim.
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:878
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:307
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:1284
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:1242
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:1122
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:2026
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:2032
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:1163
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:856
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:626
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:2281
UsdPrimSiblingIterator & operator++()
Preincrement.
Definition: prim.h:2308
reference operator*() const
Dereference.
Definition: prim.h:2302
UsdPrimSiblingIterator operator++(int)
Postincrement.
Definition: prim.h:2314
pointer operator->() const
Indirection.
Definition: prim.h:2305
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2372
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2413
iterator begin() const
First iterator.
Definition: prim.h:2393
UsdPrimSiblingIterator iterator
Iterator type.
Definition: prim.h:2375
const_iterator cbegin() const
First iterator.
Definition: prim.h:2396
UsdPrimSiblingRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2425
UsdPrimSiblingRange(UsdPrimSiblingIterator begin, UsdPrimSiblingIterator end)
Construct with a pair of iterators.
Definition: prim.h:2388
bool empty() const
Return begin() == end().
Definition: prim.h:2431
iterator end() const
Past-the-end iterator.
Definition: prim.h:2399
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2383
friend bool operator!=(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2476
friend bool operator==(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2442
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2402
friend bool operator==(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2456
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2469
bool equal(const UsdPrimSiblingRange &other) const
Equality compare.
Definition: prim.h:2408
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2381
UsdPrimSiblingRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2419
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2379
friend bool operator!=(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2462
friend bool operator==(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2435
UsdPrimSiblingIterator const_iterator
Const iterator type.
Definition: prim.h:2377
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2530
bool operator==(const UsdPrimSubtreeIterator &other) const
Equality.
Definition: prim.h:2569
UsdPrimSubtreeIterator & operator++()
Preincrement.
Definition: prim.h:2556
reference operator*() const
Dereference.
Definition: prim.h:2551
UsdPrimSubtreeIterator operator++(int)
Postincrement.
Definition: prim.h:2562
bool operator!=(const UsdPrimSubtreeIterator &other) const
Inequality.
Definition: prim.h:2574
pointer operator->() const
Indirection.
Definition: prim.h:2553
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2629
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2672
iterator begin() const
First iterator.
Definition: prim.h:2650
UsdPrimSubtreeIterator const_iterator
Const iterator type.
Definition: prim.h:2634
const_iterator cbegin() const
First iterator.
Definition: prim.h:2653
UsdPrimSubtreeIterator iterator
Iterator type.
Definition: prim.h:2632
friend bool operator==(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2716
bool empty() const
Return begin() == end().
Definition: prim.h:2690
iterator end() const
Past-the-end iterator.
Definition: prim.h:2656
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2640
friend bool operator==(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2694
UsdPrimSubtreeRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2684
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2659
bool equal(const UsdPrimSubtreeRange &other) const
Equality compare.
Definition: prim.h:2667
UsdPrimSubtreeRange(UsdPrimSubtreeIterator begin, UsdPrimSubtreeIterator end)
Construct with a pair of iterators.
Definition: prim.h:2645
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2722
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2638
UsdPrimSubtreeRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2678
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2636
friend bool operator==(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2701
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2736
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2729
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
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
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:35