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
461 USD_API
462 static void
464
467 void ClearPropertyOrder() const {
468 ClearMetadata(SdfFieldKeys->PropertyOrder);
469 }
470
482 USD_API
483 bool RemoveProperty(const TfToken &propName);
484
497 USD_API
498 UsdProperty GetProperty(const TfToken &propName) const;
499
502 USD_API
503 bool HasProperty(const TfToken &propName) const;
504
523 USD_API
524 bool GetKind(TfToken *kind) const;
525
528 USD_API
529 bool SetKind(const TfToken &kind) const;
530
531private:
532 // Helper functions for the public schema query and API schema
533 // authoring functions. The public functions have overloads that take
534 // a type, an identifier, or a family which all are used to find the
535 // SchemaInfo from the schema registry.
536 USD_API
537 bool _IsA(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
538
539 USD_API
540 bool _HasAPI(const UsdSchemaRegistry::SchemaInfo *schemaInfo) const;
541
542 USD_API
543 bool _HasAPIInstance(
544 const UsdSchemaRegistry::SchemaInfo *schemaInfo,
545 const TfToken &instanceName) const;
546
547 USD_API
548 bool _CanApplySingleApplyAPI(
549 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
550 std::string *whyNot) const;
551
552 USD_API
553 bool _CanApplyMultipleApplyAPI(
554 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
555 const TfToken& instanceName,
556 std::string *whyNot) const;
557
558 USD_API
559 bool _ApplySingleApplyAPI(
560 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
561
562 USD_API
563 bool _ApplyMultipleApplyAPI(
564 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
565 const TfToken &instanceName) const;
566
567 USD_API
568 bool _RemoveSingleApplyAPI(
569 const UsdSchemaRegistry::SchemaInfo &schemaInfo) const;
570
571 USD_API
572 bool _RemoveMultipleApplyAPI(
573 const UsdSchemaRegistry::SchemaInfo &schemaInfo,
574 const TfToken &instanceName) const;
575
576public:
580
587 template <typename SchemaType>
588 bool IsA() const {
589 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
590 "Provided type must derive UsdSchemaBase.");
591 return _IsA(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
592 };
593
595 USD_API
596 bool IsA(const TfType& schemaType) const;
597
600 USD_API
601 bool IsA(const TfToken& schemaIdentifier) const;
602
605 USD_API
606 bool IsA(const TfToken& schemaFamily,
607 UsdSchemaVersion schemaVersion) const;
608
610
614
617 USD_API
618 bool IsInFamily(const TfToken &schemaFamily) const;
619
623 USD_API
625 const TfToken &schemaFamily,
626 UsdSchemaVersion schemaVersion,
627 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
628
633 template <typename SchemaType>
635 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
636 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
637 "Provided type must derive UsdSchemaBase.");
638 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
639 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
640 if (!schemaInfo) {
641 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
642 "UsdSchemaRegistry as a schema type. The schema may need to be "
643 "regenerated.",
644 TfType::Find<SchemaType>().GetTypeName().c_str());
645 return false;
646 }
647 return IsInFamily(schemaInfo->family, schemaInfo->version,
648 versionPolicy);
649 };
650
655 USD_API
657 const TfType &schemaType,
658 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
659
668 USD_API
670 const TfToken &schemaIdentifier,
671 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
672
677 USD_API
679 const TfToken &schemaFamily,
680 UsdSchemaVersion *schemaVersion) const;
681
683
729
736 template <typename SchemaType>
737 bool
738 HasAPI() const {
739 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
740 "Provided type must derive UsdAPISchemaBase.");
741 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
742 "Provided type must not be UsdAPISchemaBase.");
743 static_assert(
744 SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI ||
745 SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
746 "Provided schema type must be an applied API schema.");
747
748 return _HasAPI(UsdSchemaRegistry::FindSchemaInfo<SchemaType>());
749 }
750
756 template <typename SchemaType>
757 bool
758 HasAPI(const TfToken &instanceName) const {
759 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
760 "Provided type must derive UsdAPISchemaBase.");
761 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
762 "Provided type must not be UsdAPISchemaBase.");
763 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
764 "Provided schema type must be a multi apply API schema.");
765
766 return _HasAPIInstance(
767 UsdSchemaRegistry::FindSchemaInfo<SchemaType>(), instanceName);
768 }
769
771 USD_API
772 bool HasAPI(const TfType& schemaType) const;
773
776 USD_API
777 bool HasAPI(const TfType& schemaType,
778 const TfToken& instanceName) const;
779
782 USD_API
783 bool HasAPI(const TfToken& schemaIdentifier) const;
784
788 USD_API
789 bool HasAPI(const TfToken& schemaIdentifier,
790 const TfToken& instanceName) const;
791
794 USD_API
795 bool HasAPI(const TfToken& schemaFamily,
796 UsdSchemaVersion schemaVersion) const;
797
801 USD_API
802 bool HasAPI(const TfToken& schemaFamily,
803 UsdSchemaVersion schemaVersion,
804 const TfToken& instanceName) const;
805
807
811
818 USD_API
820 const TfToken &schemaFamily) const;
821
827 USD_API
829 const TfToken &schemaFamily,
830 const TfToken &instanceName) const;
831
840 USD_API
842 const TfToken &schemaFamily,
843 UsdSchemaVersion schemaVersion,
844 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
845
852 USD_API
854 const TfToken &schemaFamily,
855 UsdSchemaVersion schemaVersion,
857 const TfToken &instanceName) const;
858
863 template <typename SchemaType>
865 UsdSchemaRegistry::VersionPolicy versionPolicy) const {
866 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
867 "Provided type must derive UsdSchemaBase.");
868 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
869 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
870 if (!schemaInfo) {
871 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
872 "UsdSchemaRegistry as a schema type. The schema may need to be "
873 "regenerated.",
874 TfType::Find<SchemaType>().GetTypeName().c_str());
875 return false;
876 }
877 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
878 versionPolicy);
879 };
880
885 template <typename SchemaType>
888 const TfToken &instanceName) const {
889 static_assert(std::is_base_of<UsdSchemaBase, SchemaType>::value,
890 "Provided type must derive UsdSchemaBase.");
891 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
892 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
893 if (!schemaInfo) {
894 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
895 "UsdSchemaRegistry as a schema type. The schema may need to be "
896 "regenerated.",
897 TfType::Find<SchemaType>().GetTypeName().c_str());
898 return false;
899 }
900 return HasAPIInFamily(schemaInfo->family, schemaInfo->version,
901 versionPolicy, instanceName);
902 };
903
908 USD_API
910 const TfType &schemaType,
911 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
912
917 USD_API
919 const TfType &schemaType,
921 const TfToken &instanceName) const;
922
931 USD_API
933 const TfToken &schemaIdentifier,
934 UsdSchemaRegistry::VersionPolicy versionPolicy) const;
935
944 USD_API
946 const TfToken &schemaIdentifier,
948 const TfToken &instanceName) const;
949
963 USD_API
964 bool
966 const TfToken &schemaFamily,
967 UsdSchemaVersion *schemaVersion) const;
968
981 USD_API
982 bool
984 const TfToken &schemaFamily,
985 const TfToken &instanceName,
986 UsdSchemaVersion *schemaVersion) const;
987
989
993
1006 template <typename SchemaType>
1007 bool CanApplyAPI(std::string *whyNot = nullptr) const {
1008 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1009 "Provided type must derive UsdAPISchemaBase.");
1010 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1011 "Provided type must not be UsdAPISchemaBase.");
1012 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1013 "Provided schema type must be a single apply API schema.");
1014
1015 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1016 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1017 if (!schemaInfo) {
1018 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1019 "UsdSchemaRegistry as a schema type. The schema may need to be "
1020 "regenerated.",
1021 TfType::Find<SchemaType>().GetTypeName().c_str());
1022 return false;
1023 }
1024 return _CanApplySingleApplyAPI(*schemaInfo, whyNot);
1025 }
1026
1040 template <typename SchemaType>
1041 bool CanApplyAPI(const TfToken &instanceName,
1042 std::string *whyNot = nullptr) const {
1043 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1044 "Provided type must derive UsdAPISchemaBase.");
1045 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1046 "Provided type must not be UsdAPISchemaBase.");
1047 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1048 "Provided schema type must be a multiple apply API schema.");
1049
1050 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1051 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1052 if (!schemaInfo) {
1053 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1054 "UsdSchemaRegistry as a schema type. The schema may need to be "
1055 "regenerated.",
1056 TfType::Find<SchemaType>().GetTypeName().c_str());
1057 return false;
1058 }
1059 return _CanApplyMultipleApplyAPI(*schemaInfo, instanceName, whyNot);
1060 }
1061
1064 USD_API
1065 bool CanApplyAPI(const TfType& schemaType,
1066 std::string *whyNot = nullptr) const;
1067
1071 USD_API
1072 bool CanApplyAPI(const TfType& schemaType,
1073 const TfToken& instanceName,
1074 std::string *whyNot = nullptr) const;
1075
1078 USD_API
1079 bool CanApplyAPI(const TfToken& schemaIdentifier,
1080 std::string *whyNot = nullptr) const;
1081
1086 USD_API
1087 bool CanApplyAPI(const TfToken& schemaIdentifier,
1088 const TfToken& instanceName,
1089 std::string *whyNot = nullptr) const;
1090
1093 USD_API
1094 bool CanApplyAPI(const TfToken& schemaFamily,
1095 UsdSchemaVersion schemaVersion,
1096 std::string *whyNot = nullptr) const;
1097
1102 USD_API
1103 bool CanApplyAPI(const TfToken& schemaFamily,
1104 UsdSchemaVersion schemaVersion,
1105 const TfToken& instanceName,
1106 std::string *whyNot = nullptr) const;
1107
1109
1113
1129 template <typename SchemaType>
1130 bool ApplyAPI() const {
1131 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1132 "Provided type must derive UsdAPISchemaBase.");
1133 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1134 "Provided type must not be UsdAPISchemaBase.");
1135 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1136 "Provided schema type must be a single apply API schema.");
1137
1138 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1139 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1140 if (!schemaInfo) {
1141 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1142 "UsdSchemaRegistry as a schema type. The schema may need to be "
1143 "regenerated.",
1144 TfType::Find<SchemaType>().GetTypeName().c_str());
1145 return false;
1146 }
1147 return _ApplySingleApplyAPI(*schemaInfo);
1148 }
1149
1170 template <typename SchemaType>
1171 bool ApplyAPI(const TfToken &instanceName) const {
1172 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1173 "Provided type must derive UsdAPISchemaBase.");
1174 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1175 "Provided type must not be UsdAPISchemaBase.");
1176 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1177 "Provided schema type must be a multiple apply API schema.");
1178
1179 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1180 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1181 if (!schemaInfo) {
1182 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1183 "UsdSchemaRegistry as a schema type. The schema may need to be "
1184 "regenerated.",
1185 TfType::Find<SchemaType>().GetTypeName().c_str());
1186 return false;
1187 }
1188 return _ApplyMultipleApplyAPI(*schemaInfo, instanceName);
1189 }
1190
1192 USD_API
1193 bool ApplyAPI(const TfType& schemaType) const;
1194
1197 USD_API
1198 bool ApplyAPI(const TfType& schemaType,
1199 const TfToken& instanceName) const;
1200
1203 USD_API
1204 bool ApplyAPI(const TfToken& schemaIdentifier) const;
1205
1209 USD_API
1210 bool ApplyAPI(const TfToken& schemaIdentifier,
1211 const TfToken& instanceName) const;
1212
1215 USD_API
1216 bool ApplyAPI(const TfToken& schemaFamily,
1217 UsdSchemaVersion schemaVersion) const;
1218
1222 USD_API
1223 bool ApplyAPI(const TfToken& schemaFamily,
1224 UsdSchemaVersion schemaVersion,
1225 const TfToken& instanceName) const;
1226
1228
1232
1249 template <typename SchemaType>
1250 bool RemoveAPI() const {
1251 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1252 "Provided type must derive UsdAPISchemaBase.");
1253 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1254 "Provided type must not be UsdAPISchemaBase.");
1255 static_assert(SchemaType::schemaKind == UsdSchemaKind::SingleApplyAPI,
1256 "Provided schema type must be a single apply API schema.");
1257
1258 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1259 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1260 if (!schemaInfo) {
1261 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1262 "UsdSchemaRegistry as a schema type. The schema may need to be "
1263 "regenerated.",
1264 TfType::Find<SchemaType>().GetTypeName().c_str());
1265 return false;
1266 }
1267 return _RemoveSingleApplyAPI(*schemaInfo);
1268 }
1269
1291 template <typename SchemaType>
1292 bool RemoveAPI(const TfToken &instanceName) const {
1293 static_assert(std::is_base_of<UsdAPISchemaBase, SchemaType>::value,
1294 "Provided type must derive UsdAPISchemaBase.");
1295 static_assert(!std::is_same<UsdAPISchemaBase, SchemaType>::value,
1296 "Provided type must not be UsdAPISchemaBase.");
1297 static_assert(SchemaType::schemaKind == UsdSchemaKind::MultipleApplyAPI,
1298 "Provided schema type must be a multiple apply API schema.");
1299
1300 const UsdSchemaRegistry::SchemaInfo *schemaInfo =
1301 UsdSchemaRegistry::FindSchemaInfo<SchemaType>();
1302 if (!schemaInfo) {
1303 TF_CODING_ERROR("Class '%s' is not correctly registered with the "
1304 "UsdSchemaRegistry as a schema type. The schema may need to be "
1305 "regenerated.",
1306 TfType::Find<SchemaType>().GetTypeName().c_str());
1307 return false;
1308 }
1309 return _RemoveMultipleApplyAPI(*schemaInfo, instanceName);
1310 }
1311
1313 USD_API
1314 bool RemoveAPI(const TfType& schemaType) const;
1315
1318 USD_API
1319 bool RemoveAPI(const TfType& schemaType,
1320 const TfToken& instanceName) const;
1321
1324 USD_API
1325 bool RemoveAPI(const TfToken& schemaIdentifier) const;
1326
1330 USD_API
1331 bool RemoveAPI(const TfToken& schemaIdentifier,
1332 const TfToken& instanceName) const;
1333
1336 USD_API
1337 bool RemoveAPI(const TfToken& schemaFamily,
1338 UsdSchemaVersion schemaVersion) const;
1339
1343 USD_API
1344 bool RemoveAPI(const TfToken& schemaFamily,
1345 UsdSchemaVersion schemaVersion,
1346 const TfToken& instanceName) const;
1347
1349
1373 USD_API
1374 bool AddAppliedSchema(const TfToken &appliedSchemaName) const;
1375
1400 USD_API
1401 bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const;
1402
1403 // --------------------------------------------------------------------- //
1405 // --------------------------------------------------------------------- //
1406
1412 USD_API
1413 UsdPrim GetChild(const TfToken &name) const;
1414
1423 inline SiblingRange GetChildren() const;
1424
1426 inline SiblingRange GetAllChildren() const;
1427
1447 inline SiblingRange
1448 GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const;
1449
1452 USD_API
1454
1457 USD_API
1459
1462 USD_API
1464 const Usd_PrimFlagsPredicate &predicate) const;
1465
1478 inline SubtreeRange GetDescendants() const;
1479
1488 inline SubtreeRange GetAllDescendants() const;
1489
1513 inline SubtreeRange
1514 GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const;
1515
1521 USD_API
1523
1526 void SetChildrenReorder(const TfTokenVector &order) const {
1527 SetMetadata(SdfFieldKeys->PrimOrder, order);
1528 }
1529
1533 ClearMetadata(SdfFieldKeys->PrimOrder);
1534 }
1535
1536public:
1537 // --------------------------------------------------------------------- //
1539 // --------------------------------------------------------------------- //
1540
1544 Usd_PrimDataConstPtr prim = get_pointer(_Prim());
1545 SdfPath proxyPrimPath = _ProxyPrimPath();
1546 Usd_MoveToParent(prim, proxyPrimPath);
1547 return UsdPrim(prim, proxyPrimPath);
1548 }
1549
1558 USD_API
1560
1566 USD_API
1568 const Usd_PrimFlagsPredicate &predicate) const;
1569
1576 USD_API
1577 bool IsPseudoRoot() const;
1578
1582 USD_API UsdPrim GetPrimAtPath(const SdfPath& path) const;
1583
1587 USD_API UsdObject GetObjectAtPath(const SdfPath& path) const;
1588
1597 USD_API UsdProperty GetPropertyAtPath(const SdfPath& path) const;
1598
1607 USD_API UsdAttribute GetAttributeAtPath(const SdfPath& path) const;
1608
1618
1619 // --------------------------------------------------------------------- //
1621 // --------------------------------------------------------------------- //
1622
1628 USD_API
1630
1638 USD_API
1639 UsdVariantSet GetVariantSet(const std::string& variantSetName) const;
1640
1646 USD_API
1647 bool HasVariantSets() const;
1648
1649 // --------------------------------------------------------------------- //
1651 // --------------------------------------------------------------------- //
1652
1692 USD_API
1695 const SdfValueTypeName &typeName,
1696 bool custom,
1697 SdfVariability variability = SdfVariabilityVarying) const;
1700 USD_API
1703 const SdfValueTypeName &typeName,
1704 SdfVariability variability = SdfVariabilityVarying) const;
1705
1710 USD_API
1712 const std::vector<std::string> &nameElts,
1713 const SdfValueTypeName &typeName,
1714 bool custom,
1715 SdfVariability variability = SdfVariabilityVarying) const;
1719 USD_API
1721 const std::vector<std::string> &nameElts,
1722 const SdfValueTypeName &typeName,
1723 SdfVariability variability = SdfVariabilityVarying) const;
1724
1726 USD_API
1727 std::vector<UsdAttribute> GetAttributes() const;
1728
1731 USD_API
1732 std::vector<UsdAttribute> GetAuthoredAttributes() const;
1733
1746 USD_API
1747 UsdAttribute GetAttribute(const TfToken& attrName) const;
1748
1751 USD_API
1752 bool HasAttribute(const TfToken& attrName) const;
1753
1760 USD_API
1761 SdfPathVector
1763 Usd_PrimFlagsPredicate const &traversalPredicate,
1764 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1765 bool recurseOnSources = false) const;
1766
1770 USD_API
1771 SdfPathVector
1773 std::function<bool (UsdAttribute const &)> const &pred = nullptr,
1774 bool recurseOnSources = false) const;
1775
1776 // --------------------------------------------------------------------- //
1778 // --------------------------------------------------------------------- //
1779
1816 USD_API
1818 bool custom=true) const;
1819
1824 USD_API
1825 UsdRelationship CreateRelationship(const std::vector<std::string> &nameElts,
1826 bool custom=true)
1827 const;
1828
1830 USD_API
1831 std::vector<UsdRelationship> GetRelationships() const;
1832
1835 USD_API
1836 std::vector<UsdRelationship> GetAuthoredRelationships() const;
1837
1850 USD_API
1852
1855 USD_API
1856 bool HasRelationship(const TfToken& relName) const;
1857
1864 USD_API
1865 SdfPathVector
1867 Usd_PrimFlagsPredicate const &traversalPredicate,
1868 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1869 bool recurseOnTargets = false) const;
1870
1874 USD_API
1875 SdfPathVector
1877 std::function<bool (UsdRelationship const &)> const &pred = nullptr,
1878 bool recurseOnTargets = false) const;
1879
1880 // --------------------------------------------------------------------- //
1887 // --------------------------------------------------------------------- //
1888
1892 USD_API
1893 bool ClearPayload() const;
1894
1899 USD_API
1900 bool HasPayload() const;
1901
1907 USD_API
1908 bool SetPayload(const SdfPayload& payload) const;
1909
1912 USD_API
1914 const std::string& assetPath, const SdfPath& primPath) const;
1915
1919 USD_API
1920 bool SetPayload(const SdfLayerHandle& layer, const SdfPath& primPath) const;
1921
1923
1924 // --------------------------------------------------------------------- //
1926 // --------------------------------------------------------------------- //
1927
1935 USD_API
1937
1939 USD_API
1941
1947 USD_API
1949
1953 USD_API
1954 void Unload() const;
1955
1956 // --------------------------------------------------------------------- //
1958 // --------------------------------------------------------------------- //
1959
1969 USD_API
1971
1973 USD_API
1975
1976 // --------------------------------------------------------------------- //
1978 // --------------------------------------------------------------------- //
1979
1989 USD_API
1991
1993 USD_API
1995
1996 // --------------------------------------------------------------------- //
1998 // --------------------------------------------------------------------- //
1999
2007 USD_API
2009
2011 USD_API
2013
2014 // --------------------------------------------------------------------- //
2018 // --------------------------------------------------------------------- //
2019
2026 bool IsInstanceable() const {
2027 bool instanceable = false;
2028 return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
2029 instanceable;
2030 }
2031
2034 bool SetInstanceable(bool instanceable) const {
2035 return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
2036 }
2037
2040 bool ClearInstanceable() const {
2041 return ClearMetadata(SdfFieldKeys->Instanceable);
2042 }
2043
2047 return HasAuthoredMetadata(SdfFieldKeys->Instanceable);
2048 }
2049
2055 bool IsInstance() const { return _Prim()->IsInstance(); }
2056
2060 bool IsInstanceProxy() const {
2061 return Usd_IsInstanceProxy(_Prim(), _ProxyPrimPath());
2062 }
2063
2071 USD_API
2072 static bool IsPrototypePath(const SdfPath& path);
2073
2078 USD_API
2079 static bool IsPathInPrototype(const SdfPath& path);
2080
2085 bool IsPrototype() const { return _Prim()->IsPrototype(); }
2086
2091 bool IsInPrototype() const {
2092 return (IsInstanceProxy() ?
2094 }
2095
2098 USD_API
2100
2105 if (IsInstanceProxy()) {
2106 return UsdPrim(_Prim(), SdfPath());
2107 }
2108 return UsdPrim();
2109 }
2110
2116 USD_API
2117 std::vector<UsdPrim> GetInstances() const;
2119
2120 // --------------------------------------------------------------------- //
2123 // --------------------------------------------------------------------- //
2124
2147 const PcpPrimIndex &GetPrimIndex() const { return _Prim()->GetPrimIndex(); }
2148
2169 USD_API
2171
2179 USD_API
2181 const UsdEditTarget &editTarget) const;
2182
2190 USD_API
2192 const UsdEditTarget &editTarget) const;
2193
2195
2196private:
2197 class _ProtoToInstancePathMap {
2198 friend class UsdPrim;
2199 public:
2200 using _Map = std::vector<std::pair<SdfPath, SdfPath>>;
2201 SdfPath MapProtoToInstance(SdfPath const &protoPath) const;
2202 private:
2203 _Map _map;
2204 };
2205
2206 friend class UsdObject;
2207 friend class UsdPrimSiblingIterator;
2208 friend class UsdPrimSubtreeIterator;
2209 friend class UsdProperty;
2210 friend class UsdSchemaBase;
2211 friend class UsdAPISchemaBase;
2212 friend class UsdStage;
2213 friend class UsdPrimRange;
2214 friend class Usd_PrimData;
2215 friend class Usd_PrimFlagsPredicate;
2216 friend struct Usd_StageImplAccess;
2217 friend struct UsdPrim_RelTargetFinder;
2218 friend struct UsdPrim_AttrConnectionFinder;
2219
2220 // Prim constructor.
2221 UsdPrim(const Usd_PrimDataHandle &primData,
2222 const SdfPath &proxyPrimPath)
2223 : UsdObject(primData, proxyPrimPath) { }
2224
2225 // General constructor.
2226 UsdPrim(UsdObjType objType,
2227 const Usd_PrimDataHandle &prim,
2228 const SdfPath &proxyPrimPath,
2229 const TfToken &propName)
2230 : UsdObject(objType, prim, proxyPrimPath, propName) {}
2231
2232 // Helper to make a sibling range.
2233 inline SiblingRange
2234 _MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const;
2235
2236 // Helper to make a range of descendants.
2237 inline SubtreeRange
2238 _MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const;
2239
2240 // Helper to make a vector of properties from names.
2241 std::vector<UsdProperty>
2242 _MakeProperties(const TfTokenVector &names) const;
2243
2244 // Helper for Get{Authored}{PropertyNames,Properties}
2245 TfTokenVector _GetPropertyNames(
2246 bool onlyAuthored,
2247 bool applyOrder=true,
2248 const PropertyPredicateFunc &predicate={}) const;
2249
2250 // Helper for Get(Authored)PropertiesInNamespace.
2251 std::vector<UsdProperty>
2252 _GetPropertiesInNamespace(const std::string &namespaces,
2253 bool onlyAuthored) const;
2254
2255 // Helper for Get(Authored)Attributes.
2256 std::vector<UsdAttribute>
2257 _GetAttributes(bool onlyAuthored, bool applyOrder=false) const;
2258
2259 // Helper for Get(Authored)Relationships.
2260 std::vector<UsdRelationship>
2261 _GetRelationships(bool onlyAuthored, bool applyOrder=false) const;
2262
2263 friend const PcpPrimIndex &Usd_PrimGetSourcePrimIndex(const UsdPrim&);
2264 // Return a const reference to the source PcpPrimIndex for this prim.
2265 //
2266 // For all prims in prototypes (which includes the prototype prim itself),
2267 // this is the prim index for the instance that was chosen to serve
2268 // as the prototype for all other instances. This prim index will not
2269 // have the same path as the prim's path.
2270 //
2271 // This is a private helper but is also wrapped out to Python
2272 // for testing and debugging purposes.
2273 const PcpPrimIndex &_GetSourcePrimIndex() const
2274 { return _Prim()->GetSourcePrimIndex(); }
2275
2276 // Helper function for MakeResolveTargetUpToEditTarget and
2277 // MakeResolveTargetStrongerThanEditTarget.
2279 _MakeResolveTargetFromEditTarget(
2280 const UsdEditTarget &editTarget,
2281 bool makeAsStrongerThan) const;
2282
2283 _ProtoToInstancePathMap _GetProtoToInstancePathMap() const;
2284};
2285
2290 using _UnderlyingIterator = const Usd_PrimData*;
2291 class _PtrProxy {
2292 public:
2293 UsdPrim* operator->() { return &_prim; }
2294 private:
2295 friend class UsdPrimSiblingIterator;
2296 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2297 UsdPrim _prim;
2298 };
2299public:
2300 using iterator_category = std::forward_iterator_tag;
2301 using value_type = UsdPrim;
2302 using reference = UsdPrim;
2303 using pointer = _PtrProxy;
2304 using difference_type = std::ptrdiff_t;
2305
2306 // Default ctor.
2307 UsdPrimSiblingIterator() = default;
2308
2310 reference operator*() const { return dereference(); }
2311
2313 pointer operator->() const { return pointer(dereference()); }
2314
2317 increment();
2318 return *this;
2319 }
2320
2323 UsdPrimSiblingIterator result = *this;
2324 increment();
2325 return result;
2326 }
2327
2328 bool operator==(const UsdPrimSiblingIterator& other) const {
2329 return equal(other);
2330 }
2331
2332 bool operator!=(const UsdPrimSiblingIterator& other) const {
2333 return !equal(other);
2334 }
2335
2336private:
2337 friend class UsdPrim;
2338
2339 // Constructor used by Prim.
2340 UsdPrimSiblingIterator(const _UnderlyingIterator &i,
2341 const SdfPath& proxyPrimPath,
2342 const Usd_PrimFlagsPredicate &predicate)
2343 : _underlyingIterator(i)
2344 , _proxyPrimPath(proxyPrimPath)
2345 , _predicate(predicate) {
2346 // Need to advance iterator to first matching element.
2347 if (_underlyingIterator &&
2348 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2349 _proxyPrimPath))
2350 increment();
2351 }
2352
2353 bool equal(const UsdPrimSiblingIterator &other) const {
2354 return _underlyingIterator == other._underlyingIterator &&
2355 _proxyPrimPath == other._proxyPrimPath &&
2356 _predicate == other._predicate;
2357 }
2358
2359 void increment() {
2360 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator, _proxyPrimPath,
2361 _predicate)) {
2362 _underlyingIterator = nullptr;
2363 _proxyPrimPath = SdfPath();
2364 }
2365 }
2366
2367 reference dereference() const {
2368 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2369 }
2370
2371 _UnderlyingIterator _underlyingIterator = nullptr;
2372 SdfPath _proxyPrimPath;
2373 Usd_PrimFlagsPredicate _predicate;
2374};
2375
2381public:
2387 typedef std::ptrdiff_t difference_type;
2392
2393 UsdPrimSiblingRange() = default;
2394
2397 UsdPrimSiblingIterator end) : _begin(begin),
2398 _end(end) {}
2399
2401 iterator begin() const { return _begin; }
2402
2404 const_iterator cbegin() const { return _begin; }
2405
2407 iterator end() const { return _end; }
2408
2410 const_iterator cend() const { return _end; }
2411
2413 explicit operator bool() const { return !empty(); }
2414
2416 bool equal(const UsdPrimSiblingRange& other) const {
2417 return _begin == other._begin && _end == other._end;
2418 }
2419
2422 TF_DEV_AXIOM(!empty());
2423 return *begin();
2424 }
2425
2428 std::advance(_begin, n);
2429 return *this;
2430 }
2431
2434 std::advance(_end, n);
2435 return *this;
2436 }
2437
2439 bool empty() const { return begin() == end(); }
2440
2441private:
2443 friend bool operator==(const UsdPrimSiblingRange &lhs,
2444 const UsdPrimSiblingRange &rhs) {
2445 return lhs.equal(rhs);
2446 }
2447
2449 template <class ForwardRange>
2450 friend bool operator==(const UsdPrimSiblingRange& lhs,
2451 const ForwardRange& rhs) {
2452 static_assert(
2453 std::is_same<typename decltype(std::cbegin(rhs))::iterator_category,
2454 std::forward_iterator_tag>::value,
2455 "rhs must be a forward iterator."
2456 );
2457 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2458 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2459 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2460 }
2461
2463 template <class ForwardRange>
2464 friend bool operator==(const ForwardRange& lhs,
2465 const UsdPrimSiblingRange& rhs) {
2466 return rhs == lhs;
2467 }
2468
2470 friend bool operator!=(const UsdPrimSiblingRange &lhs,
2471 const UsdPrimSiblingRange &rhs) {
2472 return !lhs.equal(rhs);
2473 }
2474
2476 template <class ForwardRange>
2477 friend bool operator!=(const ForwardRange& lhs,
2478 const UsdPrimSiblingRange& rhs) {
2479 return !(lhs == rhs);
2480 }
2481
2483 template <class ForwardRange>
2484 friend bool operator!=(const UsdPrimSiblingRange& lhs,
2485 const ForwardRange& rhs) {
2486 return !(lhs == rhs);
2487 }
2488
2489 iterator _begin;
2490 iterator _end;
2491};
2492
2493// Inform TfIterator it should feel free to make copies of the range type.
2494template <>
2495struct Tf_ShouldIterateOverCopy<
2496 UsdPrimSiblingRange> : std::true_type {};
2497template <>
2498struct Tf_ShouldIterateOverCopy<
2499 const UsdPrimSiblingRange> : std::true_type {};
2500
2502UsdPrim::GetFilteredChildren(const Usd_PrimFlagsPredicate &pred) const
2503{
2504 return _MakeSiblingRange(
2505 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2506}
2507
2510{
2512}
2513
2516{
2518}
2519
2520// Helper to make a sibling range.
2522UsdPrim::_MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const {
2523 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2524 SdfPath firstChildPath = _ProxyPrimPath();
2525 if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2526 firstChild = nullptr;
2527 firstChildPath = SdfPath();
2528 }
2529
2530 return SiblingRange(
2531 SiblingIterator(firstChild, firstChildPath, pred),
2532 SiblingIterator(nullptr, SdfPath(), pred));
2533}
2534
2539 using _UnderlyingIterator = Usd_PrimDataConstPtr;
2540 class _PtrProxy {
2541 public:
2542 UsdPrim* operator->() { return &_prim; }
2543 private:
2544 friend class UsdPrimSubtreeIterator;
2545 explicit _PtrProxy(const UsdPrim& prim) : _prim(prim) {}
2546 UsdPrim _prim;
2547 };
2548public:
2549 using iterator_category = std::forward_iterator_tag;
2550 using value_type = UsdPrim;
2551 using reference = UsdPrim;
2552 using pointer = _PtrProxy;
2553 using difference_type = std::ptrdiff_t;
2554
2555 // Default ctor.
2556 UsdPrimSubtreeIterator() = default;
2557
2559 reference operator*() const { return dereference(); }
2561 pointer operator->() const { return pointer(dereference()); }
2562
2565 increment();
2566 return *this;
2567 }
2568
2572 increment();
2573 return result;
2574 }
2575
2577 bool operator==(const UsdPrimSubtreeIterator &other) const {
2578 return equal(other);
2579 }
2580
2582 bool operator!=(const UsdPrimSubtreeIterator &other) const {
2583 return !equal(other);
2584 }
2585
2586
2587private:
2588 friend class UsdPrim;
2589
2590 // Constructor used by Prim.
2591 UsdPrimSubtreeIterator(const _UnderlyingIterator &i,
2592 const SdfPath &proxyPrimPath,
2593 const Usd_PrimFlagsPredicate &predicate)
2594 : _underlyingIterator(i)
2595 , _proxyPrimPath(proxyPrimPath)
2596 , _predicate(predicate) {
2597 // Need to advance iterator to first matching element.
2598 if (_underlyingIterator &&
2599 !Usd_EvalPredicate(_predicate, _underlyingIterator,
2600 _proxyPrimPath)) {
2601 if (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2602 _proxyPrimPath, _predicate)) {
2603 _underlyingIterator = nullptr;
2604 _proxyPrimPath = SdfPath();
2605 }
2606 }
2607 }
2608
2609 bool equal(const UsdPrimSubtreeIterator &other) const {
2610 return _underlyingIterator == other._underlyingIterator &&
2611 _proxyPrimPath == other._proxyPrimPath &&
2612 _predicate == other._predicate;
2613 }
2614
2615 void increment() {
2616 if (!Usd_MoveToChild(_underlyingIterator, _proxyPrimPath,
2617 _predicate)) {
2618 while (Usd_MoveToNextSiblingOrParent(_underlyingIterator,
2619 _proxyPrimPath,
2620 _predicate)) {}
2621 }
2622 }
2623
2624 reference dereference() const {
2625 return UsdPrim(_underlyingIterator, _proxyPrimPath);
2626 }
2627
2628 _UnderlyingIterator _underlyingIterator = nullptr;
2629 SdfPath _proxyPrimPath;
2630 Usd_PrimFlagsPredicate _predicate;
2631};
2632
2638public:
2644 typedef std::ptrdiff_t difference_type;
2649
2650 UsdPrimSubtreeRange() = default;
2651
2654 UsdPrimSubtreeIterator end) : _begin(begin),
2655 _end(end) {}
2656
2658 iterator begin() const { return _begin; }
2659
2661 const_iterator cbegin() const { return _begin; }
2662
2664 iterator end() const { return _end; }
2665
2667 const_iterator cend() const { return _end; }
2668
2670 explicit operator bool() const {
2671 return !empty();
2672 }
2673
2675 bool equal(const UsdPrimSubtreeRange& other) const {
2676 return _begin == other._begin && _end == other._end;
2677 }
2678
2681 TF_DEV_AXIOM(!empty());
2682 return *begin();
2683 }
2684
2687 std::advance(_begin, n);
2688 return *this;
2689 }
2690
2693 std::advance(_end, n);
2694 return *this;
2695 }
2696
2698 bool empty() const { return begin() == end(); }
2699
2700private:
2702 friend bool operator==(const UsdPrimSubtreeRange &lhs,
2703 const UsdPrimSubtreeRange &rhs) {
2704 return lhs.equal(rhs);
2705 }
2706
2708 template <class ForwardRange>
2709 friend bool operator==(const UsdPrimSubtreeRange& lhs,
2710 const ForwardRange& rhs) {
2711 static_assert(
2712 std::is_convertible<
2713 typename decltype(std::cbegin(rhs))::iterator_category,
2714 std::forward_iterator_tag>::value,
2715 "rhs must be a forward iterator."
2716 );
2717 return (std::distance(std::cbegin(lhs), std::cend(lhs)) ==
2718 std::distance(std::cbegin(rhs), std::cend(rhs))) &&
2719 std::equal(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs));
2720 }
2721
2723 template <class ForwardRange>
2724 friend bool operator==(const ForwardRange& lhs,
2725 const UsdPrimSubtreeRange& rhs) {
2726 return rhs == lhs;
2727 }
2728
2730 friend bool operator!=(const UsdPrimSubtreeRange &lhs,
2731 const UsdPrimSubtreeRange &rhs) {
2732 return !lhs.equal(rhs);
2733 }
2734
2736 template <class ForwardRange>
2737 friend bool operator!=(const ForwardRange& lhs,
2738 const UsdPrimSubtreeRange& rhs) {
2739 return !(lhs == rhs);
2740 }
2741
2743 template <class ForwardRange>
2744 friend bool operator!=(const UsdPrimSubtreeRange& lhs,
2745 const ForwardRange& rhs) {
2746 return !(lhs == rhs);
2747 }
2748
2749 iterator _begin;
2750 iterator _end;
2751};
2752
2753// Inform TfIterator it should feel free to make copies of the range type.
2754template <>
2755struct Tf_ShouldIterateOverCopy<
2756 UsdPrimSubtreeRange> : std::true_type {};
2757template <>
2758struct Tf_ShouldIterateOverCopy<
2759 const UsdPrimSubtreeRange> : std::true_type {};
2760
2762UsdPrim::GetFilteredDescendants(const Usd_PrimFlagsPredicate &pred) const
2763{
2764 return _MakeDescendantsRange(
2765 Usd_CreatePredicateForTraversal(_Prim(), _ProxyPrimPath(), pred));
2766}
2767
2770{
2772}
2773
2776{
2778}
2779
2780// Helper to make a sibling range.
2782UsdPrim::_MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const {
2783 Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
2784 SdfPath firstChildPath = _ProxyPrimPath();
2785 Usd_PrimDataConstPtr endChild = firstChild;
2786 SdfPath endChildPath = firstChildPath;
2787 if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
2788 while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
2789 }
2790
2791 return SubtreeRange(
2792 SubtreeIterator(firstChild, firstChildPath, pred),
2793 SubtreeIterator(endChild, endChildPath, pred));
2794}
2795
2796
2798// UsdObject methods that require UsdPrim be a complete type.
2799
2800inline UsdPrim
2802{
2803 return UsdPrim(_prim, _proxyPrimPath);
2804}
2805
2806PXR_NAMESPACE_CLOSE_SCOPE
2807
2808#endif // PXR_USD_USD_PRIM_H
2809
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:280
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:95
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:116
USD_API bool SetMetadata(const TfToken &key, VtValueRef value) const
Set metadatum key's value to value.
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:2801
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:202
bool GetMetadata(const TfToken &key, T *value) const
Resolve the requested metadatum named key into value, returning true on success.
Definition: object.h:739
USD_API bool ClearMetadata(const TfToken &key) const
Clears the authored key's value at the current EditTarget, returning false on error.
UsdPayloads provides an interface to authoring and introspecting payloads.
Definition: payloads.h:26
Class representing the builtin definition of a prim given the schemas registered in the schema regist...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
Definition: prim.h:2509
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:2147
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:2104
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:2060
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:1543
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:2026
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:2515
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:1041
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:2775
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:1007
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:2046
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:2762
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:2769
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:2502
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:1532
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:738
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:1526
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:467
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:758
bool IsPrototype() const
Return true if this prim is an instancing prototype prim, false otherwise.
Definition: prim.h:2085
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:588
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:2091
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:2055
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:886
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:1292
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:1250
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.
static USD_API void ApplyPropertyOrder(const TfTokenVector &order, TfTokenVector *names)
Change the order of items in 'names' so that all the things in 'order' that are also in 'names' are a...
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:1130
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:2034
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:2040
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:1171
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:864
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:634
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:2289
UsdPrimSiblingIterator & operator++()
Preincrement.
Definition: prim.h:2316
reference operator*() const
Dereference.
Definition: prim.h:2310
UsdPrimSiblingIterator operator++(int)
Postincrement.
Definition: prim.h:2322
pointer operator->() const
Indirection.
Definition: prim.h:2313
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2380
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2421
iterator begin() const
First iterator.
Definition: prim.h:2401
UsdPrimSiblingIterator iterator
Iterator type.
Definition: prim.h:2383
const_iterator cbegin() const
First iterator.
Definition: prim.h:2404
UsdPrimSiblingRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2433
UsdPrimSiblingRange(UsdPrimSiblingIterator begin, UsdPrimSiblingIterator end)
Construct with a pair of iterators.
Definition: prim.h:2396
bool empty() const
Return begin() == end().
Definition: prim.h:2439
iterator end() const
Past-the-end iterator.
Definition: prim.h:2407
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2391
friend bool operator!=(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2484
friend bool operator==(const UsdPrimSiblingRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2450
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2410
friend bool operator==(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2464
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2477
bool equal(const UsdPrimSiblingRange &other) const
Equality compare.
Definition: prim.h:2416
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2389
UsdPrimSiblingRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2427
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2387
friend bool operator!=(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Inequality comparison.
Definition: prim.h:2470
friend bool operator==(const UsdPrimSiblingRange &lhs, const UsdPrimSiblingRange &rhs)
Equality comparison.
Definition: prim.h:2443
UsdPrimSiblingIterator const_iterator
Const iterator type.
Definition: prim.h:2385
Forward traversal iterator of sibling UsdPrim s.
Definition: prim.h:2538
bool operator==(const UsdPrimSubtreeIterator &other) const
Equality.
Definition: prim.h:2577
UsdPrimSubtreeIterator & operator++()
Preincrement.
Definition: prim.h:2564
reference operator*() const
Dereference.
Definition: prim.h:2559
UsdPrimSubtreeIterator operator++(int)
Postincrement.
Definition: prim.h:2570
bool operator!=(const UsdPrimSubtreeIterator &other) const
Inequality.
Definition: prim.h:2582
pointer operator->() const
Indirection.
Definition: prim.h:2561
Forward iterator range of sibling UsdPrim s.
Definition: prim.h:2637
reference front() const
Return *begin(). This range must not be empty.
Definition: prim.h:2680
iterator begin() const
First iterator.
Definition: prim.h:2658
UsdPrimSubtreeIterator const_iterator
Const iterator type.
Definition: prim.h:2642
const_iterator cbegin() const
First iterator.
Definition: prim.h:2661
UsdPrimSubtreeIterator iterator
Iterator type.
Definition: prim.h:2640
friend bool operator==(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2724
bool empty() const
Return begin() == end().
Definition: prim.h:2698
iterator end() const
Past-the-end iterator.
Definition: prim.h:2664
iterator::reference reference
Iterator reference_type.
Definition: prim.h:2648
friend bool operator==(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Equality comparison.
Definition: prim.h:2702
UsdPrimSubtreeRange & advance_end(difference_type n)
Advance this range's end iterator.
Definition: prim.h:2692
const_iterator cend() const
Past-the-end iterator.
Definition: prim.h:2667
bool equal(const UsdPrimSubtreeRange &other) const
Equality compare.
Definition: prim.h:2675
UsdPrimSubtreeRange(UsdPrimSubtreeIterator begin, UsdPrimSubtreeIterator end)
Construct with a pair of iterators.
Definition: prim.h:2653
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2730
iterator::value_type value_type
Iterator value_type.
Definition: prim.h:2646
UsdPrimSubtreeRange & advance_begin(difference_type n)
Advance this range's begin iterator.
Definition: prim.h:2686
std::ptrdiff_t difference_type
Iterator difference type.
Definition: prim.h:2644
friend bool operator==(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Equality comparison.
Definition: prim.h:2709
friend bool operator!=(const UsdPrimSubtreeRange &lhs, const ForwardRange &rhs)
Inequality comparison.
Definition: prim.h:2744
friend bool operator!=(const ForwardRange &lhs, const UsdPrimSubtreeRange &rhs)
Inequality comparison.
Definition: prim.h:2737
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:137
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:103
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:159
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:36