Loading...
Searching...
No Matches
prim.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_USD_PRIM_H
25#define PXR_USD_USD_PRIM_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usd/api.h"
31#include "pxr/usd/usd/common.h"
32#include "pxr/usd/usd/object.h"
34#include "pxr/usd/usd/schemaRegistry.h"
35
36#include "pxr/usd/sdf/schema.h"
38
40#include "pxr/base/tf/refBase.h"
41#include "pxr/base/tf/token.h"
43
44#include "pxr/usd/sdf/path.h"
45
46#include <iterator>
47#include <string>
48#include <type_traits>
49#include <vector>
50
51PXR_NAMESPACE_OPEN_SCOPE
52
53class UsdPrim;
55class UsdPrimRange;
56class Usd_PrimData;
57
58class UsdAttribute;
59class UsdEditTarget;
60class UsdRelationship;
61class UsdPayloads;
62class UsdReferences;
64class UsdSchemaBase;
66class UsdInherits;
67class UsdSpecializes;
68class UsdVariantSets;
69class UsdVariantSet;
70
71class SdfPayload;
72
75
78
133class UsdPrim : public UsdObject
134{
135public:
139
143
145 UsdPrim() : UsdObject(_Null<UsdPrim>()) {}
146
158 return _Prim()->GetPrimTypeInfo();
159 }
160
165 return _Prim()->GetPrimDefinition();
166 }
167
169 SdfSpecifier GetSpecifier() const { return _Prim()->GetSpecifier(); };
170
184 USD_API
185 SdfPrimSpecHandleVector GetPrimStack() const;
186
199 USD_API
200 std::vector<std::pair<SdfPrimSpecHandle, SdfLayerOffset>>
202
205 bool SetSpecifier(SdfSpecifier specifier) const {
206 return SetMetadata(SdfFieldKeys->Specifier, specifier);
207 }
208
216 const TfToken &GetTypeName() const { return _Prim()->GetTypeName(); };
217
219 bool SetTypeName(const TfToken & typeName) const {
220 return SetMetadata(SdfFieldKeys->TypeName, typeName);
221 }
222
225 bool ClearTypeName() const {
226 return ClearMetadata(SdfFieldKeys->TypeName);
227 }
228
230 bool HasAuthoredTypeName() const {
231 return HasAuthoredMetadata(SdfFieldKeys->TypeName);
232 }
233
238 bool IsActive() const { return _Prim()->IsActive(); }
239
244 bool SetActive(bool active) const {
245 return SetMetadata(SdfFieldKeys->Active, active);
246 }
247
253 bool ClearActive() const {
254 return ClearMetadata(SdfFieldKeys->Active);
255 }
256
261 bool HasAuthoredActive() const {
262 return HasAuthoredMetadata(SdfFieldKeys->Active);
263 }
264
268 bool IsLoaded() const { return _Prim()->IsLoaded(); }
269
272 bool IsModel() const { return _Prim()->IsModel(); }
273
280 bool IsGroup() const { return _Prim()->IsGroup(); }
281
285 bool IsComponent() const { return _Prim()->IsComponent(); }
286
293 USD_API
294 bool IsSubComponent() const { return _Prim()->IsSubComponent(); }
295
297 bool IsAbstract() const { return _Prim()->IsAbstract(); }
298
301 bool IsDefined() const { return _Prim()->IsDefined(); }
302
305 bool HasDefiningSpecifier() const {
306 return _Prim()->HasDefiningSpecifier();
307 }
308
315 USD_API
317
321 std::function<bool (const TfToken &propertyName)>;
322
334 USD_API
336 const PropertyPredicateFunc &predicate={}) const;
337
351 USD_API
353 const PropertyPredicateFunc &predicate={}) const;
354
398 USD_API
399 std::vector<UsdProperty> GetProperties(
400 const PropertyPredicateFunc &predicate={}) const;
401
415 USD_API
416 std::vector<UsdProperty> GetAuthoredProperties(
417 const PropertyPredicateFunc &predicate={}) const;
418
430 USD_API
431 std::vector<UsdProperty>
432 GetPropertiesInNamespace(const std::vector<std::string> &namespaces) const;
433
438 USD_API
439 std::vector<UsdProperty>
440 GetPropertiesInNamespace(const std::string &namespaces) const;
441
447 USD_API
448 std::vector<UsdProperty>
450 const std::vector<std::string> &namespaces) const;
451
457 USD_API
458 std::vector<UsdProperty>
459 GetAuthoredPropertiesInNamespace(const std::string &namespaces) const;
460
462 USD_API
464
467 void SetPropertyOrder(const TfTokenVector &order) const {
468 SetMetadata(SdfFieldKeys->PropertyOrder, order);
469 }
470
473 void ClearPropertyOrder() const {
474 ClearMetadata(SdfFieldKeys->PropertyOrder);
475 }
476
485 USD_API
486 bool RemoveProperty(const TfToken &propName);
487
500 USD_API
501 UsdProperty GetProperty(const TfToken &propName) const;
502
505 USD_API
506 bool HasProperty(const TfToken &propName) const;
507
526 USD_API
527 bool GetKind(TfToken *kind) const;
528
531 USD_API
532 bool SetKind(const TfToken &kind) const;
533
534private:
535 // Helper functions for the public schema query and API schema
536 // authoring functions. The public functions have overloads that take
537 // a type, an identifier, or a family which all are used to find the
538 // SchemaInfo from the schema registry.
539 USD_API
540 bool _IsA(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
541
542 USD_API
543 bool _HasAPI(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
544
545 USD_API
546 bool _HasAPIInstance(
547 const UsdSchemaRegistry::SchemaInfo *schemaInfo,
548 const TfToken &instanceName) const;
549
550 USD_API
551 bool _CanApplySingleApplyAPI(
552 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
553 std::string *whyNot) const;
554
555 USD_API
556 bool _CanApplyMultipleApplyAPI(
557 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
558 const TfToken& instanceName,
559 std::string *whyNot) const;
560
561 USD_API
562 bool _ApplySingleApplyAPI(
563 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
564
565 USD_API
566 bool _ApplyMultipleApplyAPI(
567 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
568 const TfToken &instanceName) const;
569
570 USD_API
571 bool _RemoveSingleApplyAPI(
572 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
573
574 USD_API
575 bool _RemoveMultipleApplyAPI(
576 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
577 const TfToken &instanceName) const;
578
579public:
583
590 template <typename SchemaType>
591 bool IsA() const {
592 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
593 "Provided type must derive UsdSchemaBase.");
594 return _IsA(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
595 };
596
598 USD_API
599 bool IsA(const TfType& schemaType) const;
600
603 USD_API
604 bool IsA(const TfToken& schemaIdentifier) const;
605
608 USD_API
609 bool IsA(const TfToken& schemaFamily,
610 UsdSchemaVersion schemaVersion) const;
611
613
617
620 USD_API
621 bool IsInFamily(const TfToken &schemaFamily) const;
622
626 USD_API
628 const TfToken &schemaFamily,
629 UsdSchemaVersion schemaVersion,
630 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
631
636 template <typename SchemaType>
638 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
639 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
640 "Provided type must derive UsdSchemaBase.");
641 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
642 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
643 if (!schemaInfo) {
644 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
645 "UsdSchemaRegistry as a schema type. The schema may need to be "
646 "regenerated.",
647 TfType::Find<SchemaType>().GetTypeName().c_str());
648 return false;
649 }
650 return IsInFamily(schemaInfo->family, schemaInfo->version,
651 versionPolicy);
652 };
653
658 USD_API
660 const TfType &schemaType,
661 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
662
671 USD_API
673 const TfToken &schemaIdentifier,
674 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
675
680 USD_API
682 const TfToken &schemaFamily,
683 UsdSchemaVersion *schemaVersion) const;
684
686
732
739 template <typename SchemaType>
740 bool
741 HasAPI() const {
742 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
743 "Provided type must derive UsdAPISchemaBase.");
744 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
745 "Provided type must not be UsdAPISchemaBase.");
746 static_assert(
747 SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI ||
748 SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
749 "Provided schema type must be an applied API schema.");
750
751 return _HasAPI(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
752 }
753
759 template <typename SchemaType>
760 bool
761 HasAPI(const TfToken &instanceName) const {
762 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
763 "Provided type must derive UsdAPISchemaBase.");
764 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
765 "Provided type must not be UsdAPISchemaBase.");
766 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
767 "Provided schema type must be a multi apply API schema.");
768
769 return _HasAPIInstance(
770 UsdSchemaRegistry::FindSchemaInfo<SchemaType>(), instanceName);
771 }
772
774 USD_API
775 bool HasAPI(const TfType& schemaType) const;
776
779 USD_API
780 bool HasAPI(const TfType& schemaType,
781 const TfToken& instanceName) const;
782
785 USD_API
786 bool HasAPI(const TfToken& schemaIdentifier) const;
787
791 USD_API
792 bool HasAPI(const TfToken& schemaIdentifier,
793 const TfToken& instanceName) const;
794
797 USD_API
798 bool HasAPI(const TfToken& schemaFamily,
799 UsdSchemaVersion schemaVersion) const;
800
804 USD_API
805 bool HasAPI(const TfToken& schemaFamily,
806 UsdSchemaVersion schemaVersion,
807 const TfToken& instanceName) const;
808
810
814
821 USD_API
823 const TfToken &schemaFamily) const;
824
830 USD_API
832 const TfToken &schemaFamily,
833 const TfToken &instanceName) const;
834
843 USD_API
845 const TfToken &schemaFamily,
846 UsdSchemaVersion schemaVersion,
847 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
848
855 USD_API
857 const TfToken &schemaFamily,
858 UsdSchemaVersion schemaVersion,
860 const TfToken &instanceName) const;
861
866 template <typename SchemaType>
868 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
869 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
870 "Provided type must derive UsdSchemaBase.");
871 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
872 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
873 if (!schemaInfo) {
874 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
875 "UsdSchemaRegistry as a schema type. The schema may need to be "
876 "regenerated.",
877 TfType::Find<SchemaType>().GetTypeName().c_str());
878 return false;
879 }
880 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
881 versionPolicy);
882 };
883
888 template <typename SchemaType>
891 const TfToken &instanceName) const {
892 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
893 "Provided type must derive UsdSchemaBase.");
894 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
895 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
896 if (!schemaInfo) {
897 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
898 "UsdSchemaRegistry as a schema type. The schema may need to be "
899 "regenerated.",
900 TfType::Find<SchemaType>().GetTypeName().c_str());
901 return false;
902 }
903 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
904 versionPolicy, instanceName);
905 };
906
911 USD_API
913 const TfType &schemaType,
914 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
915
920 USD_API
922 const TfType &schemaType,
924 const TfToken &instanceName) const;
925
934 USD_API
936 const TfToken &schemaIdentifier,
937 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
938
947 USD_API
949 const TfToken &schemaIdentifier,
951 const TfToken &instanceName) const;
952
966 USD_API
967 bool
969 const TfToken &schemaFamily,
970 UsdSchemaVersion *schemaVersion) const;
971
984 USD_API
985 bool
987 const TfToken &schemaFamily,
988 const TfToken &instanceName,
989 UsdSchemaVersion *schemaVersion) const;
990
992
996
1009 template <typename SchemaType>
1010 bool CanApplyAPI(std::string *whyNot = nullptr) const {
1011 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1012 "Provided type must derive UsdAPISchemaBase.");
1013 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1014 "Provided type must not be UsdAPISchemaBase.");
1015 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1016 "Provided schema type must be a single apply API schema.");
1017
1018 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1019 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1020 if (!schemaInfo) {
1021 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1022 "UsdSchemaRegistry as a schema type. The schema may need to be "
1023 "regenerated.",
1024 TfType::Find<SchemaType>().GetTypeName().c_str());
1025 return false;
1026 }
1027 return _CanApplySingleApplyAPI(*schemaInfo, whyNot);
1028 }
1029
1043 template <typename SchemaType>
1044 bool CanApplyAPI(const TfToken &instanceName,
1045 std::string *whyNot = nullptr) const {
1046 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1047 "Provided type must derive UsdAPISchemaBase.");
1048 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1049 "Provided type must not be UsdAPISchemaBase.");
1050 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1051 "Provided schema type must be a multiple apply API schema.");
1052
1053 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1054 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1055 if (!schemaInfo) {
1056 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1057 "UsdSchemaRegistry as a schema type. The schema may need to be "
1058 "regenerated.",
1059 TfType::Find<SchemaType>().GetTypeName().c_str());
1060 return false;
1061 }
1062 return _CanApplyMultipleApplyAPI(*schemaInfo, instanceName, whyNot);
1063 }
1064
1067 USD_API
1068 bool CanApplyAPI(const TfType& schemaType,
1069 std::string *whyNot = nullptr) const;
1070
1074 USD_API
1075 bool CanApplyAPI(const TfType& schemaType,
1076 const TfToken& instanceName,
1077 std::string *whyNot = nullptr) const;
1078
1081 USD_API
1082 bool CanApplyAPI(const TfToken& schemaIdentifier,
1083 std::string *whyNot = nullptr) const;
1084
1089 USD_API
1090 bool CanApplyAPI(const TfToken& schemaIdentifier,
1091 const TfToken& instanceName,
1092 std::string *whyNot = nullptr) const;
1093
1096 USD_API
1097 bool CanApplyAPI(const TfToken& schemaFamily,
1098 UsdSchemaVersion schemaVersion,
1099 std::string *whyNot = nullptr) const;
1100
1105 USD_API
1106 bool CanApplyAPI(const TfToken& schemaFamily,
1107 UsdSchemaVersion schemaVersion,
1108 const TfToken& instanceName,
1109 std::string *whyNot = nullptr) const;
1110
1112
1116
1132 template <typename SchemaType>
1133 bool ApplyAPI() const {
1134 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1135 "Provided type must derive UsdAPISchemaBase.");
1136 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1137 "Provided type must not be UsdAPISchemaBase.");
1138 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1139 "Provided schema type must be a single apply API schema.");
1140
1141 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1142 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1143 if (!schemaInfo) {
1144 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1145 "UsdSchemaRegistry as a schema type. The schema may need to be "
1146 "regenerated.",
1147 TfType::Find<SchemaType>().GetTypeName().c_str());
1148 return false;
1149 }
1150 return _ApplySingleApplyAPI(*schemaInfo);
1151 }
1152
1173 template <typename SchemaType>
1174 bool ApplyAPI(const TfToken &instanceName) const {
1175 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1176 "Provided type must derive UsdAPISchemaBase.");
1177 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1178 "Provided type must not be UsdAPISchemaBase.");
1179 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1180 "Provided schema type must be a multiple apply API schema.");
1181
1182 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1183 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1184 if (!schemaInfo) {
1185 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1186 "UsdSchemaRegistry as a schema type. The schema may need to be "
1187 "regenerated.",
1188 TfType::Find<SchemaType>().GetTypeName().c_str());
1189 return false;
1190 }
1191 return _ApplyMultipleApplyAPI(*schemaInfo, instanceName);
1192 }
1193
1195 USD_API
1196 bool ApplyAPI(const TfType& schemaType) const;
1197
1200 USD_API
1201 bool ApplyAPI(const TfType& schemaType,
1202 const TfToken& instanceName) const;
1203
1206 USD_API
1207 bool ApplyAPI(const TfToken& schemaIdentifier) const;
1208
1212 USD_API
1213 bool ApplyAPI(const TfToken& schemaIdentifier,
1214 const TfToken& instanceName) const;
1215
1218 USD_API
1219 bool ApplyAPI(const TfToken& schemaFamily,
1220 UsdSchemaVersion schemaVersion) const;
1221
1225 USD_API
1226 bool ApplyAPI(const TfToken& schemaFamily,
1227 UsdSchemaVersion schemaVersion,
1228 const TfToken& instanceName) const;
1229
1231
1235
1252 template <typename SchemaType>
1253 bool RemoveAPI() const {
1254 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1255 "Provided type must derive UsdAPISchemaBase.");
1256 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1257 "Provided type must not be UsdAPISchemaBase.");
1258 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1259 "Provided schema type must be a single apply API schema.");
1260
1261 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1262 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1263 if (!schemaInfo) {
1264 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1265 "UsdSchemaRegistry as a schema type. The schema may need to be "
1266 "regenerated.",
1267 TfType::Find<SchemaType>().GetTypeName().c_str());
1268 return false;
1269 }
1270 return _RemoveSingleApplyAPI(*schemaInfo);
1271 }
1272
1294 template <typename SchemaType>
1295 bool RemoveAPI(const TfToken &instanceName) const {
1296 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1297 "Provided type must derive UsdAPISchemaBase.");
1298 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1299 "Provided type must not be UsdAPISchemaBase.");
1300 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1301 "Provided schema type must be a multiple apply API schema.");
1302
1303 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1304 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1305 if (!schemaInfo) {
1306 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1307 "UsdSchemaRegistry as a schema type. The schema may need to be "
1308 "regenerated.",
1309 TfType::Find<SchemaType>().GetTypeName().c_str());
1310 return false;
1311 }
1312 return _RemoveMultipleApplyAPI(*schemaInfo, instanceName);
1313 }
1314
1316 USD_API
1317 bool RemoveAPI(const TfType& schemaType) const;
1318
1321 USD_API
1322 bool RemoveAPI(const TfType& schemaType,
1323 const TfToken& instanceName) const;
1324
1327 USD_API
1328 bool RemoveAPI(const TfToken& schemaIdentifier) const;
1329
1333 USD_API
1334 bool RemoveAPI(const TfToken& schemaIdentifier,
1335 const TfToken& instanceName) const;
1336
1339 USD_API
1340 bool RemoveAPI(const TfToken& schemaFamily,
1341 UsdSchemaVersion schemaVersion) const;
1342
1346 USD_API
1347 bool RemoveAPI(const TfToken& schemaFamily,
1348 UsdSchemaVersion schemaVersion,
1349 const TfToken& instanceName) const;
1350
1352
1376 USD_API
1377 bool AddAppliedSchema(const TfToken &appliedSchemaName) const;
1378
1403 USD_API
1404 bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const;
1405
1406 // --------------------------------------------------------------------- //
1408 // --------------------------------------------------------------------- //
1409
1415 USD_API
1416 UsdPrim GetChild(const TfToken &name) const;
1417
1426 inline SiblingRange GetChildren() const;
1427
1429 inline SiblingRange GetAllChildren() const;
1430
1450 inline SiblingRange
1451 GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const;
1452
1455 USD_API
1457
1460 USD_API
1462
1465 USD_API
1467 const Usd_PrimFlagsPredicate &predicate) const;
1468
1481 inline SubtreeRange GetDescendants() const;
1482
1491 inline SubtreeRange GetAllDescendants() const;
1492
1516 inline SubtreeRange
1517 GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const;
1518
1524 USD_API
1526
1529 void SetChildrenReorder(const TfTokenVector &order) const {
1530 SetMetadata(SdfFieldKeys->PrimOrder, order);
1531 }
1532
1536 ClearMetadata(SdfFieldKeys->PrimOrder);
1537 }
1538
1539public:
1540 // --------------------------------------------------------------------- //
1542 // --------------------------------------------------------------------- //
1543
1547 Usd_PrimDataConstPtr prim = get_pointer(_Prim());
1548 SdfPath proxyPrimPath = _ProxyPrimPath();
1549 Usd_MoveToParent(prim, proxyPrimPath);
1550 return UsdPrim(prim, proxyPrimPath);
1551 }
1552
1561 USD_API
1563
1569 USD_API
1571 const Usd_PrimFlagsPredicate &predicate) const;
1572
1579 USD_API
1580 bool IsPseudoRoot() const;
1581
1585 USD_API UsdPrim GetPrimAtPath(const SdfPath& path) const;
1586
1590 USD_API UsdObject GetObjectAtPath(const SdfPath& path) const;
1591
1600 USD_API UsdProperty GetPropertyAtPath(const SdfPath& path) const;
1601
1610 USD_API UsdAttribute GetAttributeAtPath(const SdfPath& path) const;
1611
1621
1622 // --------------------------------------------------------------------- //
1624 // --------------------------------------------------------------------- //
1625
1631 USD_API
1633
1641 USD_API
1642 UsdVariantSet GetVariantSet(const std::string& variantSetName) const;
1643
1649 USD_API
1650 bool HasVariantSets() const;
1651
1652 // --------------------------------------------------------------------- //
1654 // --------------------------------------------------------------------- //
1655
1695 USD_API
1698 const SdfValueTypeName &typeName,
1699 bool custom,
1700 SdfVariability variability = SdfVariabilityVarying) const;
1703 USD_API
1706 const SdfValueTypeName &typeName,
1707 SdfVariability variability = SdfVariabilityVarying) const;
1708
1713 USD_API
1715 const std::vector<std::string> &nameElts,
1716 const SdfValueTypeName &typeName,
1717 bool custom,
1718 SdfVariability variability = SdfVariabilityVarying) const;
1722 USD_API
1724 const std::vector<std::string> &nameElts,
1725 const SdfValueTypeName &typeName,
1726 SdfVariability variability = SdfVariabilityVarying) const;
1727
1729 USD_API
1730 std::vector<UsdAttribute> GetAttributes() const;
1731
1734 USD_API
1735 std::vector<UsdAttribute> GetAuthoredAttributes() const;
1736
1749 USD_API
1750 UsdAttribute GetAttribute(const TfToken& attrName) const;
1751
1754 USD_API
1755 bool HasAttribute(const TfToken& attrName) const;
1756
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 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1860 bool recurseOnTargets = false) const;
1861
1862 // --------------------------------------------------------------------- //
1869 // --------------------------------------------------------------------- //
1870
1874 USD_API
1875 bool ClearPayload() const;
1876
1881 USD_API
1882 bool HasPayload() const;
1883
1889 USD_API
1890 bool SetPayload(const SdfPayload& payload) const;
1891
1894 USD_API
1896 const std::string& assetPath, const SdfPath& primPath) const;
1897
1901 USD_API
1902 bool SetPayload(const SdfLayerHandle& layer, const SdfPath& primPath) const;
1903
1905
1906 // --------------------------------------------------------------------- //
1908 // --------------------------------------------------------------------- //
1909
1917 USD_API
1919
1921 USD_API
1923
1929 USD_API
1931
1935 USD_API
1936 void Unload() const;
1937
1938 // --------------------------------------------------------------------- //
1940 // --------------------------------------------------------------------- //
1941
1951 USD_API
1953
1955 USD_API
1957
1958 // --------------------------------------------------------------------- //
1960 // --------------------------------------------------------------------- //
1961
1971 USD_API
1973
1975 USD_API
1977
1978 // --------------------------------------------------------------------- //
1980 // --------------------------------------------------------------------- //
1981
1989 USD_API
1991
1993 USD_API
1995
1996 // --------------------------------------------------------------------- //
2000 // --------------------------------------------------------------------- //
2001
2008 bool IsInstanceable() const {
2009 bool instanceable = false;
2010 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
2011 instanceable;
2012 }
2013
2016 bool SetInstanceable(bool instanceable) const {
2017 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2018 }
2019
2022 bool ClearInstanceable() const {
2023 return ClearMetadata(SdfFieldKeys->Instanceable);
2024 }
2025
2029 return HasAuthoredMetadata(SdfFieldKeys->Instanceable);
2030 }
2031
2037 bool IsInstance() const { return _Prim()->IsInstance(); }
2038
2042 bool IsInstanceProxy() const {
2043 return Usd_IsInstanceProxy(_Prim(), _ProxyPrimPath());
2044 }
2045
2053 USD_API
2054 static bool IsPrototypePath(const SdfPath& path);
2055
2060 USD_API
2061 static bool IsPathInPrototype(const SdfPath& path);
2062
2067 bool IsPrototype() const { return _Prim()->IsPrototype(); }
2068
2073 bool IsInPrototype() const {
2074 return (IsInstanceProxy() ?
2076 }
2077
2080 USD_API
2082
2087 if (IsInstanceProxy()) {
2088 return UsdPrim(_Prim(), SdfPath());
2089 }
2090 return UsdPrim();
2091 }
2092
2098 USD_API
2099 std::vector<UsdPrim> GetInstances() const;
2101
2102 // --------------------------------------------------------------------- //
2105 // --------------------------------------------------------------------- //
2106
2129 const PcpPrimIndex &GetPrimIndex() const { return _Prim()->GetPrimIndex(); }
2130
2151 USD_API
2153
2161 USD_API
2163 const UsdEditTarget &editTarget) const;
2164
2172 USD_API
2174 const UsdEditTarget &editTarget) const;
2175
2177
2178private:
2179 class _ProtoToInstancePathMap {
2180 friend class UsdPrim;
2181 public:
2182 using _Map = std::vector<std::pair<SdfPath, SdfPath>>;
2183 SdfPath MapProtoToInstance(SdfPath const &protoPath) const;
2184 private:
2185 _Map _map;
2186 };
2187
2188 friend class UsdObject;
2189 friend class UsdPrimSiblingIterator;
2190 friend class UsdPrimSubtreeIterator;
2191 friend class UsdProperty;
2192 friend class UsdSchemaBase;
2193 friend class UsdAPISchemaBase;
2194 friend class UsdStage;
2195 friend class Usd_StageImplAccess;
2196 friend class UsdPrimRange;
2197 friend class Usd_PrimData;
2198 friend class Usd_PrimFlagsPredicate;
2199 friend struct UsdPrim_RelTargetFinder;
2200 friend struct UsdPrim_AttrConnectionFinder;
2201
2202 // Prim constructor.
2203 UsdPrim(const Usd_PrimDataHandle &primData,
2204 const SdfPath &proxyPrimPath)
2205 : UsdObject(primData, proxyPrimPath) { }
2206
2207 // General constructor.
2208 UsdPrim(UsdObjType objType,
2209 const Usd_PrimDataHandle &prim,
2210 const SdfPath &proxyPrimPath,
2211 const TfToken &propName)
2212 : UsdObject(objType, prim, proxyPrimPath, propName) {}
2213
2214 // Helper to make a sibling range.
2215 inline SiblingRange
2216 _MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const;
2217
2218 // Helper to make a range of descendants.
2219 inline SubtreeRange
2220 _MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const;
2221
2222 // Helper to make a vector of properties from names.
2223 std::vector<UsdProperty>
2224 _MakeProperties(const TfTokenVector &names) const;
2225
2226 // Helper for Get{Authored}{PropertyNames,Properties}
2227 TfTokenVector _GetPropertyNames(
2228 bool onlyAuthored,
2229 bool applyOrder=true,
2230 const PropertyPredicateFunc &predicate={}) const;
2231
2232 // Helper for Get(Authored)PropertiesInNamespace.
2233 std::vector<UsdProperty>
2234 _GetPropertiesInNamespace(const std::string &namespaces,
2235 bool onlyAuthored) const;
2236
2237 // Helper for Get(Authored)Attributes.
2238 std::vector<UsdAttribute>
2239 _GetAttributes(bool onlyAuthored, bool applyOrder=false) const;
2240
2241 // Helper for Get(Authored)Relationships.
2242 std::vector<UsdRelationship>
2243 _GetRelationships(bool onlyAuthored, bool applyOrder=false) const;
2244
2245 friend const PcpPrimIndex &Usd_PrimGetSourcePrimIndex(const UsdPrim&);
2246 // Return a const reference to the source PcpPrimIndex for this prim.
2247 //
2248 // For all prims in prototypes (which includes the prototype prim itself),
2249 // this is the prim index for the instance that was chosen to serve
2250 // as the prototype for all other instances. This prim index will not
2251 // have the same path as the prim's path.
2252 //
2253 // This is a private helper but is also wrapped out to Python
2254 // for testing and debugging purposes.
2255 const PcpPrimIndex &_GetSourcePrimIndex() const
2256 { return _Prim()->GetSourcePrimIndex(); }
2257
2258 // Helper function for MakeResolveTargetUpToEditTarget and
2259 // MakeResolveTargetStrongerThanEditTarget.
2261 _MakeResolveTargetFromEditTarget(
2262 const UsdEditTarget &editTarget,
2263 bool makeAsStrongerThan) const;
2264
2265 _ProtoToInstancePathMap _GetProtoToInstancePathMap() const;
2266};
2267
2272 using _UnderlyingIterator = const Usd_PrimData*;
2273 class _PtrProxy {
2274 public:
2275 UsdPrim* operator->() { return &_prim; }
2276 private:
2277 friend class UsdPrimSiblingIterator;
2278 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2279 UsdPrim _prim;
2280 };
2281public:
2282 using iterator_category = std::forward_iterator_tag;
2283 using value_type = UsdPrim;
2284 using reference = UsdPrim;
2285 using pointer = _PtrProxy;
2286 using difference_type = std::ptrdiff_t;
2287
2288 // Default ctor.
2289 UsdPrimSiblingIterator() = default;
2290
2292 reference operator*() const { return dereference(); }
2293
2295 pointer operator->() const { return pointer(dereference()); }
2296
2299 increment();
2300 return *this;
2301 }
2302
2305 UsdPrimSiblingIterator result = *this;
2306 increment();
2307 return result;
2308 }
2309
2310 bool operator==(const UsdPrimSiblingIterator& other) const {
2311 return equal(other);
2312 }
2313
2314 bool operator!=(const UsdPrimSiblingIterator& other) const {
2315 return !equal(other);
2316 }
2317
2318private:
2319 friend class UsdPrim;
2320
2321 // Constructor used by Prim.
2322 UsdPrimSiblingIterator(const _UnderlyingIterator &i,
2323 const SdfPath& proxyPrimPath,
2324 const Usd_PrimFlagsPredicate &predicate)
2325 : _underlyingIterator(i)
2326 , _proxyPrimPath(proxyPrimPath)
2327 , _predicate(predicate) {
2328 // Need to advance iterator to first matching element.
2329 if (_underlyingIterator &&
2330 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2331 _proxyPrimPath))
2332 increment();
2333 }
2334
2335 bool equal(const UsdPrimSiblingIterator &other) const {
2336 return _underlyingIterator == other._underlyingIterator &&
2337 _proxyPrimPath == other._proxyPrimPath &&
2338 _predicate == other._predicate;
2339 }
2340
2341 void increment() {
2342 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator, _proxyPrimPath,
2343 _predicate)) {
2344 _underlyingIterator = nullptr;
2345 _proxyPrimPath = SdfPath();
2346 }
2347 }
2348
2349 reference dereference() const {
2350 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2351 }
2352
2353 _UnderlyingIterator _underlyingIterator = nullptr;
2354 SdfPath _proxyPrimPath;
2355 Usd_PrimFlagsPredicate _predicate;
2356};
2357
2363public:
2369 typedef std::ptrdiff_t difference_type;
2374
2375 UsdPrimSiblingRange() = default;
2376
2379 UsdPrimSiblingIterator end) : _begin(begin),
2380 _end(end) {}
2381
2383 iterator begin() const { return _begin; }
2384
2386 const_iterator cbegin() const { return _begin; }
2387
2389 iterator end() const { return _end; }
2390
2392 const_iterator cend() const { return _end; }
2393
2395 explicit operator bool() const { return !empty(); }
2396
2398 bool equal(const UsdPrimSiblingRange& other) const {
2399 return _begin == other._begin && _end == other._end;
2400 }
2401
2404 TF_DEV_AXIOM(!empty());
2405 return *begin();
2406 }
2407
2410 std::advance(_begin, n);
2411 return *this;
2412 }
2413
2416 std::advance(_end, n);
2417 return *this;
2418 }
2419
2421 bool empty() const { return begin() == end(); }
2422
2423private:
2425 friend bool operator==(const UsdPrimSiblingRange &lhs,
2426 const UsdPrimSiblingRange &rhs) {
2427 return lhs.equal(rhs);
2428 }
2429
2431 template <class ForwardRange>
2432 friend bool operator==(const UsdPrimSiblingRange& lhs,
2433 const ForwardRange& rhs) {
2434 static_assert(
2435 std::is_same<typename decltype(std::cbegin(rhs))::iterator_category,
2436 std::forward_iterator_tag>::value,
2437 "rhs must be a forward iterator."
2438 );
2439 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2440 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2441 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2442 }
2443
2445 template <class ForwardRange>
2446 friend bool operator==(const ForwardRange& lhs,
2447 const UsdPrimSiblingRange& rhs) {
2448 return rhs == lhs;
2449 }
2450
2452 friend bool operator!=(const UsdPrimSiblingRange &lhs,
2453 const UsdPrimSiblingRange &rhs) {
2454 return !lhs.equal(rhs);
2455 }
2456
2458 template <class ForwardRange>
2459 friend bool operator!=(const ForwardRange& lhs,
2460 const UsdPrimSiblingRange& rhs) {
2461 return !(lhs == rhs);
2462 }
2463
2465 template <class ForwardRange>
2466 friend bool operator!=(const UsdPrimSiblingRange& lhs,
2467 const ForwardRange& rhs) {
2468 return !(lhs == rhs);
2469 }
2470
2471 iterator _begin;
2472 iterator _end;
2473};
2474
2475// Inform TfIterator it should feel free to make copies of the range type.
2476template <>
2477struct Tf_ShouldIterateOverCopy<
2478 UsdPrimSiblingRange> : std::true_type {};
2479template <>
2480struct Tf_ShouldIterateOverCopy<
2481 const UsdPrimSiblingRange> : std::true_type {};
2482
2484UsdPrim::GetFilteredChildren(const Usd_PrimFlagsPredicate &pred) const
2485{
2486 return _MakeSiblingRange(
2487 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2488}
2489
2492{
2494}
2495
2498{
2500}
2501
2502// Helper to make a sibling range.
2504UsdPrim::_MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const {
2505 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2506 SdfPath firstChildPath = _ProxyPrimPath();
2507 if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2508 firstChild = nullptr;
2509 firstChildPath = SdfPath();
2510 }
2511
2512 return SiblingRange(
2513 SiblingIterator(firstChild, firstChildPath, pred),
2514 SiblingIterator(nullptr, SdfPath(), pred));
2515}
2516
2521 using _UnderlyingIterator = Usd_PrimDataConstPtr;
2522 class _PtrProxy {
2523 public:
2524 UsdPrim* operator->() { return &_prim; }
2525 private:
2526 friend class UsdPrimSubtreeIterator;
2527 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2528 UsdPrim _prim;
2529 };
2530public:
2531 using iterator_category = std::forward_iterator_tag;
2532 using value_type = UsdPrim;
2533 using reference = UsdPrim;
2534 using pointer = _PtrProxy;
2535 using difference_type = std::ptrdiff_t;
2536
2537 // Default ctor.
2538 UsdPrimSubtreeIterator() = default;
2539
2541 reference operator*() const { return dereference(); }
2543 pointer operator->() const { return pointer(dereference()); }
2544
2547 increment();
2548 return *this;
2549 }
2550
2554 increment();
2555 return result;
2556 }
2557
2559 bool operator==(const UsdPrimSubtreeIterator &other) const {
2560 return equal(other);
2561 }
2562
2564 bool operator!=(const UsdPrimSubtreeIterator &other) const {
2565 return !equal(other);
2566 }
2567
2568
2569private:
2570 friend class UsdPrim;
2571
2572 // Constructor used by Prim.
2573 UsdPrimSubtreeIterator(const _UnderlyingIterator &i,
2574 const SdfPath &proxyPrimPath,
2575 const Usd_PrimFlagsPredicate &predicate)
2576 : _underlyingIterator(i)
2577 , _proxyPrimPath(proxyPrimPath)
2578 , _predicate(predicate) {
2579 // Need to advance iterator to first matching element.
2580 if (_underlyingIterator &&
2581 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2582 _proxyPrimPath)) {
2583 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2584 _proxyPrimPath, _predicate)) {
2585 _underlyingIterator = nullptr;
2586 _proxyPrimPath = SdfPath();
2587 }
2588 }
2589 }
2590
2591 bool equal(const UsdPrimSubtreeIterator &other) const {
2592 return _underlyingIterator == other._underlyingIterator &&
2593 _proxyPrimPath == other._proxyPrimPath &&
2594 _predicate == other._predicate;
2595 }
2596
2597 void increment() {
2598 if (!Usd_MoveToChild(_underlyingIterator, _proxyPrimPath,
2599 _predicate)) {
2600 while (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2601 _proxyPrimPath,
2602 _predicate)) {}
2603 }
2604 }
2605
2606 reference dereference() const {
2607 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2608 }
2609
2610 _UnderlyingIterator _underlyingIterator = nullptr;
2611 SdfPath _proxyPrimPath;
2612 Usd_PrimFlagsPredicate _predicate;
2613};
2614
2620public:
2626 typedef std::ptrdiff_t difference_type;
2631
2632 UsdPrimSubtreeRange() = default;
2633
2636 UsdPrimSubtreeIterator end) : _begin(begin),
2637 _end(end) {}
2638
2640 iterator begin() const { return _begin; }
2641
2643 const_iterator cbegin() const { return _begin; }
2644
2646 iterator end() const { return _end; }
2647
2649 const_iterator cend() const { return _end; }
2650
2652 explicit operator bool() const {
2653 return !empty();
2654 }
2655
2657 bool equal(const UsdPrimSubtreeRange& other) const {
2658 return _begin == other._begin && _end == other._end;
2659 }
2660
2663 TF_DEV_AXIOM(!empty());
2664 return *begin();
2665 }
2666
2669 std::advance(_begin, n);
2670 return *this;
2671 }
2672
2675 std::advance(_end, n);
2676 return *this;
2677 }
2678
2680 bool empty() const { return begin() == end(); }
2681
2682private:
2684 friend bool operator==(const UsdPrimSubtreeRange &lhs,
2685 const UsdPrimSubtreeRange &rhs) {
2686 return lhs.equal(rhs);
2687 }
2688
2690 template <class ForwardRange>
2691 friend bool operator==(const UsdPrimSubtreeRange& lhs,
2692 const ForwardRange& rhs) {
2693 static_assert(
2694 std::is_convertible<
2695 typename decltype(std::cbegin(rhs))::iterator_category,
2696 std::forward_iterator_tag>::value,
2697 "rhs must be a forward iterator."
2698 );
2699 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2700 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2701 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2702 }
2703
2705 template <class ForwardRange>
2706 friend bool operator==(const ForwardRange& lhs,
2707 const UsdPrimSubtreeRange& rhs) {
2708 return rhs == lhs;
2709 }
2710
2712 friend bool operator!=(const UsdPrimSubtreeRange &lhs,
2713 const UsdPrimSubtreeRange &rhs) {
2714 return !lhs.equal(rhs);
2715 }
2716
2718 template <class ForwardRange>
2719 friend bool operator!=(const ForwardRange& lhs,
2720 const UsdPrimSubtreeRange& rhs) {
2721 return !(lhs == rhs);
2722 }
2723
2725 template <class ForwardRange>
2726 friend bool operator!=(const UsdPrimSubtreeRange& lhs,
2727 const ForwardRange& rhs) {
2728 return !(lhs == rhs);
2729 }
2730
2731 iterator _begin;
2732 iterator _end;
2733};
2734
2735// Inform TfIterator it should feel free to make copies of the range type.
2736template <>
2737struct Tf_ShouldIterateOverCopy<
2738 UsdPrimSubtreeRange> : std::true_type {};
2739template <>
2740struct Tf_ShouldIterateOverCopy<
2741 const UsdPrimSubtreeRange> : std::true_type {};
2742
2744UsdPrim::GetFilteredDescendants(const Usd_PrimFlagsPredicate &pred) const
2745{
2746 return _MakeDescendantsRange(
2747 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2748}
2749
2752{
2754}
2755
2758{
2760}
2761
2762// Helper to make a sibling range.
2764UsdPrim::_MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const {
2765 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2766 SdfPath firstChildPath = _ProxyPrimPath();
2767 Usd_PrimDataConstPtr endChild = firstChild;
2768 SdfPath endChildPath = firstChildPath;
2769 if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2770 while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
2771 }
2772
2773 return SubtreeRange(
2774 SubtreeIterator(firstChild, firstChildPath, pred),
2775 SubtreeIterator(endChild, endChildPath, pred));
2776}
2777
2778
2780// UsdObject methods that require UsdPrim be a complete type.
2781
2782inline UsdPrim
2784{
2785 return UsdPrim(_prim, _proxyPrimPath);
2786}
2787
2788PXR_NAMESPACE_CLOSE_SCOPE
2789
2790#endif // PXR_USD_USD_PRIM_H
2791
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:78
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Represents a payload and all its meta data.
Definition: payload.h:58
Represents a value type name, i.e.
Definition: valueTypeName.h:88
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
TfType represents a dynamic runtime type.
Definition: type.h:65
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:79
A proxy class for applying listOp edits to the inherit paths list for a prim.
Definition: inherits.h:51
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:132
bool SetMetadata(const TfToken &key, const T &value) const
Set metadatum key's value to value.
Definition: object.h:764
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:2783
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:218
bool GetMetadata(const TfToken &key, T *value) const
Resolve the requested metadatum named key into value, returning true on success.
Definition: object.h:756
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:43
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:134
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
Definition: prim.h:2491
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:164
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:2129
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:2086
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:2042
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:1546
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:145
bool IsInstanceable() const
Return true if this prim has been marked as instanceable.
Definition: prim.h:2008
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:2497
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:1044
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:2757
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:1010
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:219
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:2028
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:2744
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
Definition: prim.h:169
const UsdPrimTypeInfo & GetPrimTypeInfo() const
Return the prim's full type info composed from its type name, applied API schemas,...
Definition: prim.h:157
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:253
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:2751
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:2484
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:1535
USD_API bool IsSubComponent() const
Return true if this prim is a subcomponent based on its kind metadata, false otherwise.
Definition: prim.h:294
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:741
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:1529
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:473
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:761
bool IsPrototype() const
Return true if this prim is an instancing prototype prim, false otherwise.
Definition: prim.h:2067
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:268
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:591
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:141
bool IsInPrototype() const
Return true if this prim is a prototype prim or a descendant of a prototype prim, false otherwise.
Definition: prim.h:2073
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:467
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:2037
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
Search the prim subtree rooted at this prim for relationships for which predicate returns true,...
bool HasAuthoredActive() const
Return true if this prim has an authored opinion for 'active', false otherwise.
Definition: prim.h:261
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:301
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:889
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:216
std::function< bool(const TfToken &propertyName)> PropertyPredicateFunc
Alias for the "predicate" function parameter passed into the various Get{Authored}{PropertyNames,...
Definition: prim.h:321
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:1295
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:1253
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:205
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:285
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
Definition: prim.h:137
bool IsActive() const
Return true if this prim is active, meaning neither it nor any of its ancestors have active=false.
Definition: prim.h:238
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:244
bool HasDefiningSpecifier() const
Return true if this prim has a specifier of type SdfSpecifierDef or SdfSpecifierClass.
Definition: prim.h:305
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 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
Search the prim subtree rooted at this prim for attributes for which predicate returns true,...
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:1133
bool IsGroup() const
Return true if this prim is a model group based on its kind metadata, false otherwise.
Definition: prim.h:280
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:2016
bool IsModel() const
Return true if this prim is a model based on its kind metadata, false otherwise.
Definition: prim.h:272
bool ClearInstanceable() const
Remove the authored 'instanceable' opinion at the current EditTarget.
Definition: prim.h:2022
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:1174
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:230
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:297
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:867
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:637
bool ClearTypeName() const
Clear the opinion for this Prim's typeName at the current edit target.
Definition: prim.h:225
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Definition: primRange.h:119
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2271
UsdPrimSiblingIterator & operator++()
Preincrement.
Definition: prim.h:2298
reference operator*() const
Dereference.
Definition: prim.h:2292
UsdPrimSiblingIterator operator++(int)
Postincrement.
Definition: prim.h:2304
pointer operator->() const
Indirection.
Definition: prim.h:2295
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2362
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2403
iterator begin() const
First iterator.
Definition: prim.h:2383
UsdPrimSiblingIterator iterator
Iterator type.
Definition: prim.h:2365
const_iterator cbegin() const
First iterator.
Definition: prim.h:2386
UsdPrimSiblingRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2415
UsdPrimSiblingRange(UsdPrimSiblingIterator begin, UsdPrimSiblingIterator end)
Construct with a pair of iterators.
Definition: prim.h:2378
bool empty() const
Return begin() == end().
Definition: prim.h:2421
iterator end() const
Past-the-end iterator.
Definition: prim.h:2389
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2373
friend bool operator!=(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2466
friend bool operator==(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2432
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2392
friend bool operator==(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2446
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2459
bool equal(const UsdPrimSiblingRange &other) const
Equality compare.
Definition: prim.h:2398
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2371
UsdPrimSiblingRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2409
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2369
friend bool operator!=(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2452
friend bool operator==(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2425
UsdPrimSiblingIterator const_iterator
Const iterator type.
Definition: prim.h:2367
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2520
bool operator==(const UsdPrimSubtreeIterator &other) const
Equality.
Definition: prim.h:2559
UsdPrimSubtreeIterator & operator++()
Preincrement.
Definition: prim.h:2546
reference operator*() const
Dereference.
Definition: prim.h:2541
UsdPrimSubtreeIterator operator++(int)
Postincrement.
Definition: prim.h:2552
bool operator!=(const UsdPrimSubtreeIterator &other) const
Inequality.
Definition: prim.h:2564
pointer operator->() const
Indirection.
Definition: prim.h:2543
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2619
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2662
iterator begin() const
First iterator.
Definition: prim.h:2640
UsdPrimSubtreeIterator const_iterator
Const iterator type.
Definition: prim.h:2624
const_iterator cbegin() const
First iterator.
Definition: prim.h:2643
UsdPrimSubtreeIterator iterator
Iterator type.
Definition: prim.h:2622
friend bool operator==(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2706
bool empty() const
Return begin() == end().
Definition: prim.h:2680
iterator end() const
Past-the-end iterator.
Definition: prim.h:2646
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2630
friend bool operator==(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2684
UsdPrimSubtreeRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2674
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2649
bool equal(const UsdPrimSubtreeRange &other) const
Equality compare.
Definition: prim.h:2657
UsdPrimSubtreeRange(UsdPrimSubtreeIterator begin, UsdPrimSubtreeIterator end)
Construct with a pair of iterators.
Definition: prim.h:2635
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2712
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2628
UsdPrimSubtreeRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2668
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2626
friend bool operator==(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2691
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2726
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2719
Class that holds the full type information for a prim.
Definition: primTypeInfo.h:48
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:55
UsdReferences provides an interface to authoring and introspecting references in Usd.
Definition: references.h:214
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:73
The base class for all schema types in Usd.
Definition: schemaBase.h:56
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:51
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
Definition: stage.h:152
A UsdVariantSet represents a single VariantSet in USD (e.g.
Definition: variantSets.h:56
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
Definition: variantSets.h:222
UsdLoadPolicy
Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or not descendant prims are ...
Definition: common.h:116
@ UsdLoadWithDescendants
Load a prim plus all its descendants.
Definition: common.h:118
Standard pointer typedefs.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
Definition: diagnostic.h:222
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
Definition: diagnostic.h:85
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:52
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:442
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
Definition: types.h:117
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:173