Loading...
Searching...
No Matches
stage.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_STAGE_H
8#define PXR_USD_USD_STAGE_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/editTarget.h"
17#include "pxr/usd/usd/schemaRegistry.h"
19#include "pxr/usd/usd/stagePopulationMask.h"
20#include "pxr/usd/usd/primDefinition.h"
22
24#include "pxr/base/tf/hashmap.h"
25#include "pxr/base/tf/type.h"
27
28#include "pxr/usd/ar/ar.h"
29#include "pxr/usd/ar/notice.h"
31#include "pxr/usd/sdf/notice.h"
32#include "pxr/usd/sdf/path.h"
33#include "pxr/usd/sdf/types.h"
34#include "pxr/usd/pcp/cache.h"
35#include "pxr/base/vt/value.h"
37
38#include <tbb/concurrent_vector.h>
39#include <tbb/concurrent_unordered_set.h>
40#include <tbb/concurrent_hash_map.h>
41#include <tbb/spin_rw_mutex.h>
42
43#include <functional>
44#include <string>
45#include <memory>
46#include <optional>
47#include <unordered_map>
48#include <utility>
49
50PXR_NAMESPACE_OPEN_SCOPE
51
53class GfInterval;
55class TsSpline;
56class Usd_AssetPathContext;
57class Usd_ClipCache;
58class Usd_InstanceCache;
59class Usd_InstanceChanges;
60class Usd_InterpolatorBase;
61class Usd_Resolver;
62class UsdResolveInfo;
64class UsdPrim;
65class UsdPrimRange;
66
67SDF_DECLARE_HANDLES(SdfLayer);
68
136class UsdStage : public TfRefBase, public TfWeakBase {
137public:
138
139 // --------------------------------------------------------------------- //
143 // --------------------------------------------------------------------- //
144
150 {
152 LoadNone
153 };
154
165 //
177 USD_API
178 static UsdStageRefPtr
179 CreateNew(const std::string& identifier,
180 InitialLoadSet load = LoadAll);
182 USD_API
183 static UsdStageRefPtr
184 CreateNew(const std::string& identifier,
185 const SdfLayerHandle& sessionLayer,
186 InitialLoadSet load = LoadAll);
188 USD_API
189 static UsdStageRefPtr
190 CreateNew(const std::string& identifier,
191 const SdfLayerHandle& sessionLayer,
192 const ArResolverContext& pathResolverContext,
193 InitialLoadSet load = LoadAll);
195 USD_API
196 static UsdStageRefPtr
197 CreateNew(const std::string& identifier,
198 const ArResolverContext& pathResolverContext,
199 InitialLoadSet load = LoadAll);
200
218 USD_API
219 static UsdStageRefPtr
222 USD_API
223 static UsdStageRefPtr
224 CreateInMemory(const std::string& identifier,
225 InitialLoadSet load = LoadAll);
227 USD_API
228 static UsdStageRefPtr
229 CreateInMemory(const std::string& identifier,
230 const ArResolverContext& pathResolverContext,
231 InitialLoadSet load = LoadAll);
233 USD_API
234 static UsdStageRefPtr
235 CreateInMemory(const std::string& identifier,
236 const SdfLayerHandle &sessionLayer,
237 InitialLoadSet load = LoadAll);
239 USD_API
240 static UsdStageRefPtr
241 CreateInMemory(const std::string& identifier,
242 const SdfLayerHandle &sessionLayer,
243 const ArResolverContext& pathResolverContext,
244 InitialLoadSet load = LoadAll);
245
261 USD_API
262 static UsdStageRefPtr
263 Open(const std::string& filePath, InitialLoadSet load = LoadAll);
265 USD_API
266 static UsdStageRefPtr
267 Open(const std::string& filePath,
268 const ArResolverContext& pathResolverContext,
269 InitialLoadSet load = LoadAll);
270
288 USD_API
289 static UsdStageRefPtr
290 OpenMasked(const std::string &filePath,
291 UsdStagePopulationMask const &mask,
292 InitialLoadSet load = LoadAll);
294 USD_API
295 static UsdStageRefPtr
296 OpenMasked(const std::string &filePath,
297 const ArResolverContext &pathResolverContext,
298 UsdStagePopulationMask const &mask,
299 InitialLoadSet load = LoadAll);
300
329 USD_API
330 static UsdStageRefPtr
331 Open(const SdfLayerHandle& rootLayer,
334 USD_API
335 static UsdStageRefPtr
336 Open(const SdfLayerHandle& rootLayer,
337 const SdfLayerHandle& sessionLayer,
340 USD_API
341 static UsdStageRefPtr
342 Open(const SdfLayerHandle& rootLayer,
343 const ArResolverContext& pathResolverContext,
346 USD_API
347 static UsdStageRefPtr
348 Open(const SdfLayerHandle& rootLayer,
349 const SdfLayerHandle& sessionLayer,
350 const ArResolverContext& pathResolverContext,
352
373 USD_API
374 static UsdStageRefPtr
375 OpenMasked(const SdfLayerHandle& rootLayer,
376 const UsdStagePopulationMask &mask,
379 USD_API
380 static UsdStageRefPtr
381 OpenMasked(const SdfLayerHandle& rootLayer,
382 const SdfLayerHandle& sessionLayer,
383 const UsdStagePopulationMask &mask,
386 USD_API
387 static UsdStageRefPtr
388 OpenMasked(const SdfLayerHandle& rootLayer,
389 const ArResolverContext& pathResolverContext,
390 const UsdStagePopulationMask &mask,
393 USD_API
394 static UsdStageRefPtr
395 OpenMasked(const SdfLayerHandle& rootLayer,
396 const SdfLayerHandle& sessionLayer,
397 const ArResolverContext& pathResolverContext,
398 const UsdStagePopulationMask &mask,
400
401 USD_API
402 virtual ~UsdStage();
403
421 USD_API
422 void Reload();
423
432 USD_API
433 static bool
434 IsSupportedFile(const std::string& filePath);
435
437
438 // --------------------------------------------------------------------- //
447
455 USD_API
456 void Save();
457
465 USD_API
467
469
470 // --------------------------------------------------------------------- //
516
518 USD_API
520
526 USD_API
527 static void
529
531
532 // --------------------------------------------------------------------- //
561 // --------------------------------------------------------------------- //
562
570 USD_API
573
579 USD_API
581
593 USD_API
594 void LoadAndUnload(const SdfPathSet &loadSet, const SdfPathSet &unloadSet,
596
607 USD_API
608 SdfPathSet GetLoadSet();
609
629 USD_API
630 SdfPathSet FindLoadable(
631 const SdfPath& rootPath = SdfPath::AbsoluteRootPath());
632
639 return _loadRules;
640 }
641
651 USD_API
652 void SetLoadRules(UsdStageLoadRules const &rules);
653
656 return _populationMask;
657 }
658
660 USD_API
662
676 USD_API
678 Usd_PrimFlagsPredicate const &traversalPredicate,
679 std::function<bool (UsdRelationship const &)> const &relPred = nullptr,
680 std::function<bool (UsdAttribute const &)> const &attrPred = nullptr);
681
685 USD_API
687 std::function<bool (UsdRelationship const &)> const &relPred = nullptr,
688 std::function<bool (UsdAttribute const &)> const &attrPred = nullptr);
689
691
692 // --------------------------------------------------------------------- //
701 // --------------------------------------------------------------------- //
702
712 USD_API
714
722 USD_API
724
736 USD_API
737 void SetDefaultPrim(const UsdPrim &prim);
738
746 USD_API
748
756 USD_API
757 bool HasDefaultPrim() const;
758
768 USD_API
769 UsdPrim GetPrimAtPath(const SdfPath &path) const;
770
795 USD_API
797
806 USD_API
808
817 USD_API
819
828 USD_API
830private:
831 // Return the primData object at \p path.
832 Usd_PrimDataConstPtr _GetPrimDataAtPath(const SdfPath &path) const;
833 Usd_PrimDataPtr _GetPrimDataAtPath(const SdfPath &path);
834
835 // Return the primData object at \p path. If \p path indicates a prim
836 // beneath an instance, return the primData object for the corresponding
837 // prim in the instance's prototype.
838 Usd_PrimDataConstPtr
839 _GetPrimDataAtPathOrInPrototype(const SdfPath &path) const;
840
842 std::vector<UsdPrim>
843 _GetInstancesForPrototype(const UsdPrim& prototype) const;
844
845public:
846
867 USD_API
869
874 USD_API
875 UsdPrimRange Traverse(const Usd_PrimFlagsPredicate &predicate);
876
881 USD_API
883
902 USD_API
904
928 USD_API
930 const TfToken &typeName=TfToken());
931
944 USD_API
945 UsdPrim CreateClassPrim(const SdfPath &rootPrimPath);
946
968 USD_API
969 bool RemovePrim(const SdfPath& path);
970
972
973 // --------------------------------------------------------------------- //
977 // --------------------------------------------------------------------- //
978
980 USD_API
981 SdfLayerHandle GetSessionLayer() const;
982
984 USD_API
985 SdfLayerHandle GetRootLayer() const;
986
991 USD_API
993
1003 USD_API
1004 std::string
1005 ResolveIdentifierToEditTarget(std::string const &identifier) const;
1006
1009 USD_API
1010 PcpErrorVector GetCompositionErrors() const;
1011
1017 USD_API
1018 SdfLayerHandleVector GetLayerStack(bool includeSessionLayers=true) const;
1019
1031 USD_API
1032 SdfLayerHandleVector GetUsedLayers(bool includeClipLayers=true) const;
1033
1036 USD_API
1037 bool HasLocalLayer(const SdfLayerHandle &layer) const;
1038
1040 USD_API
1042
1046 USD_API
1048
1052 USD_API
1053 UsdEditTarget GetEditTargetForLocalLayer(const SdfLayerHandle &layer);
1054
1061 USD_API
1062 void SetEditTarget(const UsdEditTarget &editTarget);
1063
1090 USD_API
1091 void MuteLayer(const std::string &layerIdentifier);
1092
1095 USD_API
1096 void UnmuteLayer(const std::string &layerIdentifier);
1097
1105 USD_API
1106 void MuteAndUnmuteLayers(const std::vector<std::string> &muteLayers,
1107 const std::vector<std::string> &unmuteLayers);
1108
1110 USD_API
1111 const std::vector<std::string>& GetMutedLayers() const;
1112
1117 USD_API
1118 bool IsLayerMuted(const std::string& layerIdentifier) const;
1119
1121
1122 // --------------------------------------------------------------------- //
1126 // --------------------------------------------------------------------- //
1127 // Future Work:
1128 // * Flatten sub-trees or individual prims
1129 // * Allow flattening of local LayerStack
1130 // * Move Flatten into a free-function to ensure it doesn't rely on
1131 // Stage internals.
1132
1140 USD_API
1141 bool Export(const std::string &filename,
1142 bool addSourceFileComment=true,
1143 const SdfLayer::FileFormatArguments &args =
1145
1153 USD_API
1154 bool ExportToString(std::string *result,
1155 bool addSourceFileComment=true) const;
1156
1183 USD_API
1184 SdfLayerRefPtr Flatten(bool addSourceFileComment=true) const;
1186
1187public:
1188 // --------------------------------------------------------------------- //
1196 // --------------------------------------------------------------------- //
1197
1209 template <class T>
1210 bool GetMetadata(const TfToken &key, T *value) const;
1212 USD_API
1213 bool GetMetadata(const TfToken &key, VtValue *value) const;
1214
1221 USD_API
1222 bool HasMetadata(const TfToken &key) const;
1223
1232 USD_API
1233 bool HasAuthoredMetadata(const TfToken &key) const;
1234
1243 template<typename T>
1244 bool SetMetadata(const TfToken &key, const T &value) const;
1246 USD_API
1247 bool SetMetadata(const TfToken &key, const VtValue &value) const;
1248
1257 USD_API
1258 bool ClearMetadata(const TfToken &key) const;
1259
1275 template<typename T>
1276 bool GetMetadataByDictKey(const TfToken& key, const TfToken &keyPath,
1277 T* value) const;
1279 USD_API
1281 const TfToken& key, const TfToken &keyPath, VtValue *value) const;
1282
1293 USD_API
1295 const TfToken& key, const TfToken &keyPath) const;
1296
1305 USD_API
1307 const TfToken& key, const TfToken &keyPath) const;
1308
1320 template<typename T>
1321 bool SetMetadataByDictKey(const TfToken& key, const TfToken &keyPath,
1322 const T& value) const;
1324 USD_API
1326 const TfToken& key, const TfToken &keyPath, const VtValue& value) const;
1327
1339 USD_API
1341 const TfToken& key, const TfToken& keyPath) const;
1342
1361 USD_API
1363
1365
1366 // --------------------------------------------------------------------- //
1373 // --------------------------------------------------------------------- //
1377 USD_API
1378 double GetStartTimeCode() const;
1379
1386 USD_API
1387 void SetStartTimeCode(double);
1388
1392 USD_API
1393 double GetEndTimeCode() const;
1394
1401 USD_API
1402 void SetEndTimeCode(double);
1403
1406 USD_API
1408
1424 USD_API
1426
1435 USD_API
1436 void SetTimeCodesPerSecond(double timeCodesPerSecond) const;
1437
1447 USD_API
1448 double GetFramesPerSecond() const;
1449
1458 USD_API
1459 void SetFramesPerSecond(double framesPerSecond) const;
1460
1462
1463 // --------------------------------------------------------------------- //
1484 // --------------------------------------------------------------------- //
1485
1491 USD_API
1492 void SetColorConfiguration(const SdfAssetPath &colorConfig) const;
1493
1497 USD_API
1499
1504 USD_API
1505 void SetColorManagementSystem(const TfToken &cms) const;
1506
1511 USD_API
1513
1524 USD_API
1525 static void GetColorConfigFallbacks(SdfAssetPath *colorConfiguration,
1526 TfToken *colorManagementSystem);
1527
1541 USD_API
1542 static void
1543 SetColorConfigFallbacks(const SdfAssetPath &colorConfiguration,
1544 const TfToken &colorManagementSystem);
1545
1547
1548 // --------------------------------------------------------------------- //
1555 // --------------------------------------------------------------------- //
1556
1561 USD_API
1563
1566 USD_API
1568
1570
1571 // --------------------------------------------------------------------- //
1576 // --------------------------------------------------------------------- //
1577
1579 USD_API
1580 std::vector<UsdPrim> GetPrototypes() const;
1581
1583
1584private:
1585 struct _IncludePayloadsPredicate;
1586
1587 // --------------------------------------------------------------------- //
1588 // Stage Construction & Initialization
1589 // --------------------------------------------------------------------- //
1590
1591 UsdStage(const SdfLayerRefPtr& rootLayer,
1592 const SdfLayerRefPtr& sessionLayer,
1593 const ArResolverContext& pathResolverContext,
1594 const UsdStagePopulationMask& mask,
1595 InitialLoadSet load);
1596
1597 // Helper for Open() overloads -- searches and publishes to bound caches.
1598 template <class... Args>
1599 static UsdStageRefPtr _OpenImpl(InitialLoadSet load, Args const &... args);
1600
1601 // Releases resources used by this stage.
1602 void _Close();
1603
1604 // Common ref ptr initialization, called by public, static constructors.
1605 //
1606 // This method will either return a valid refptr (if the stage is correctly
1607 // initialized) or it will return a null ref pointer, deleting the
1608 // raw stage pointer in the process.
1609 static UsdStageRefPtr
1610 _InstantiateStage(const SdfLayerRefPtr &rootLayer,
1611 const SdfLayerRefPtr &sessionLayer,
1612 const ArResolverContext &pathResolverContext,
1613 const UsdStagePopulationMask &mask,
1614 InitialLoadSet load);
1615
1616 // --------------------------------------------------------------------- //
1617 // Spec Existence & Definition Helpers
1618 // --------------------------------------------------------------------- //
1619
1620 SdfPropertySpecHandleVector
1621 _GetPropertyStack(const UsdProperty &prop, UsdTimeCode time) const;
1622
1623 std::vector<std::pair<SdfPropertySpecHandle, SdfLayerOffset>>
1624 _GetPropertyStackWithLayerOffsets(
1625 const UsdProperty &prop, UsdTimeCode time) const;
1626
1627 static SdfPrimSpecHandleVector
1628 _GetPrimStack(const UsdPrim &prim);
1629
1630 static std::vector<std::pair<SdfPrimSpecHandle, SdfLayerOffset>>
1631 _GetPrimStackWithLayerOffsets(const UsdPrim &prim);
1632
1634 _GetSchemaProperty(const UsdProperty &prop) const;
1635
1637 _GetSchemaAttribute(const UsdAttribute &attr) const;
1638
1640 _GetSchemaRelationship(const UsdRelationship &rel) const;
1641
1642 SdfAttributeSpecHandle
1643 _CreateNewSpecFromSchemaAttribute(
1644 const UsdPrim &prim,
1645 const UsdPrimDefinition::Attribute &attrDef);
1646
1647 SdfRelationshipSpecHandle
1648 _CreateNewSpecFromSchemaRelationship(
1649 const UsdPrim &prim,
1650 const UsdPrimDefinition::Relationship &relDef);
1651
1652 template <class PropType>
1654 _CreateNewPropertySpecFromSchema(const UsdProperty &prop);
1655
1656 SdfPrimSpecHandle
1657 _CreatePrimSpecForEditing(const UsdPrim& prim);
1658
1659 template <class PropType>
1661 _CreatePropertySpecForEditing(const UsdProperty &prop);
1662
1663 SdfPropertySpecHandle
1664 _CreatePropertySpecForEditing(const UsdProperty &prop);
1665
1666 SdfAttributeSpecHandle
1667 _CreateAttributeSpecForEditing(const UsdAttribute &attr);
1668
1669 SdfRelationshipSpecHandle
1670 _CreateRelationshipSpecForEditing(const UsdRelationship &rel);
1671
1672 // Check if the given path is valid to use with the prim creation API,
1673 // like DefinePrim. If it is valid, returns (true, GetPrimAtPath(path)).
1674 // Otherwise, returns (false, UsdPrim()).
1675 std::pair<bool, UsdPrim>
1676 _IsValidPathForCreatingPrim(const SdfPath &path) const;
1677
1678 // Validates that editing a specified prim is allowed. If editing is not
1679 // allowed, issues a coding error like "Cannot <operation> ..." and
1680 // returns false. Otherwise, returns true.
1681 bool _ValidateEditPrim(const UsdPrim &prim, const char* operation) const;
1682 bool _ValidateEditPrimAtPath(const SdfPath &primPath,
1683 const char* operation) const;
1684
1685 UsdPrim _DefinePrim(const SdfPath &path, const TfToken &typeName);
1686
1687 bool _RemoveProperty(const SdfPath& path);
1688
1689 UsdProperty _FlattenProperty(const UsdProperty &srcProp,
1690 const UsdPrim &dstParent,
1691 const TfToken &dstName);
1692
1693 // --------------------------------------------------------------------- //
1694 // Value & Metadata Authoring
1695 // --------------------------------------------------------------------- //
1696
1697 // Trait that allows us to call the correct versions of _SetValue and
1698 // _SetMetadata for types whose values need to be mapped when written to
1699 // different edit targets.
1700 template <class T>
1701 struct _IsEditTargetMappable {
1702 static const bool value =
1703 std::is_same<T, SdfTimeCode>::value ||
1704 std::is_same<T, VtArray<SdfTimeCode>>::value ||
1705 std::is_same<T, SdfPathExpression>::value ||
1706 std::is_same<T, VtArray<SdfPathExpression>>::value ||
1707 std::is_same<T, SdfTimeSampleMap>::value ||
1708 std::is_same<T, TsSpline>::value ||
1709 std::is_same<T, VtDictionary>::value;
1710 };
1711
1712 // Set value for types that don't need to be mapped for edit targets.
1713 template <class T>
1714 typename std::enable_if<!_IsEditTargetMappable<T>::value, bool>::type
1715 _SetValue(
1716 UsdTimeCode time, const UsdAttribute &attr, const T &newValue);
1717
1718 // Set value for types that do need to be mapped for edit targets.
1719 template <class T>
1720 typename std::enable_if<_IsEditTargetMappable<T>::value, bool>::type
1721 _SetValue(
1722 UsdTimeCode time, const UsdAttribute &attr, const T &newValue);
1723
1724 // Set value for dynamically typed VtValue. Will map the value across edit
1725 // targets if the held value type supports it.
1726 bool _SetValue(
1727 UsdTimeCode time, const UsdAttribute &attr, const VtValue &newValue);
1728
1729 template <class T>
1730 bool _SetEditTargetMappedValue(
1731 UsdTimeCode time, const UsdAttribute &attr, const T &newValue);
1732
1733 TfType _GetAttributeValueType(
1734 const UsdAttribute &attr) const;
1735
1736 template <class T>
1737 bool _SetValueImpl(
1738 UsdTimeCode time, const UsdAttribute &attr, const T& value);
1739
1740 bool _ClearValue(UsdTimeCode time, const UsdAttribute &attr);
1741
1742 // Set metadata for types that don't need to be mapped across edit targets.
1743 template <class T>
1744 typename std::enable_if<!_IsEditTargetMappable<T>::value, bool>::type
1745 _SetMetadata(const UsdObject &object, const TfToken& key,
1746 const TfToken &keyPath, const T& value);
1747
1748 // Set metadata for types that do need to be mapped for edit targets.
1749 template <class T>
1750 typename std::enable_if<_IsEditTargetMappable<T>::value, bool>::type
1751 _SetMetadata(const UsdObject &object, const TfToken& key,
1752 const TfToken &keyPath, const T& value);
1753
1754 // Set metadata for dynamically typed VtValue. Will map the value across
1755 // edit targets if the held value type supports it.
1756 USD_API
1757 bool _SetMetadata(const UsdObject &object,
1758 const TfToken& key,
1759 const TfToken &keyPath,
1760 const VtValue& value);
1761
1762 template <class T>
1763 bool _SetEditTargetMappedMetadata(
1764 const UsdObject &obj, const TfToken& fieldName,
1765 const TfToken &keyPath, const T &newValue);
1766
1767 template <class T>
1768 bool _SetMetadataImpl(
1769 const UsdObject &obj, const TfToken& fieldName,
1770 const TfToken &keyPath, const T &value);
1771
1772 bool _ClearMetadata(const UsdObject &obj, const TfToken& fieldName,
1773 const TfToken &keyPath=TfToken());
1774
1775 // --------------------------------------------------------------------- //
1776 // Misc Internal Helpers
1777 // --------------------------------------------------------------------- //
1778
1779 // Pcp helpers.
1780 PcpCache const *_GetPcpCache() const { return _cache.get(); }
1781 PcpCache *_GetPcpCache() { return _cache.get(); }
1782
1783 // Returns the PrimIndex, using the read-only PcpCache API. We expect prims
1784 // to be composed during initial stage composition, so this method should
1785 // not be used in that context.
1786 const PcpPrimIndex* _GetPcpPrimIndex(const SdfPath& primPath) const;
1787
1788 // Helper to report pcp errors.
1789 void _ReportPcpErrors(const PcpErrorVector &errors,
1790 const std::string &context) const;
1791 void _ReportErrors(const PcpErrorVector &errors,
1792 const std::vector<std::string>& otherErrors,
1793 const std::string &context) const;
1794
1795 // --------------------------------------------------------------------- //
1796 // Scenegraph Composition & Change Processing
1797 // --------------------------------------------------------------------- //
1798
1799 // Compose the prim indexes in the subtrees rooted at the paths in
1800 // \p primIndexPaths. If \p instanceChanges is given, returns
1801 // changes to prototypes and instances due to the discovery of new instances
1802 // during composition.
1803 void _ComposePrimIndexesInParallel(
1804 const std::vector<SdfPath>& primIndexPaths,
1805 const std::string& context,
1806 Usd_InstanceChanges* instanceChanges = nullptr);
1807
1808 // Recompose the subtree rooted at \p prim: compose its type, flags, and
1809 // list of children, then invoke _ComposeSubtree on all its children.
1810 void _ComposeSubtree(
1811 Usd_PrimDataPtr prim, Usd_PrimDataConstPtr parent,
1812 UsdStagePopulationMask const *mask,
1813 const SdfPath &primIndexPath = SdfPath());
1814 void _ComposeSubtreeImpl(
1815 Usd_PrimDataPtr prim, Usd_PrimDataConstPtr parent,
1816 UsdStagePopulationMask const *mask,
1817 const SdfPath &primIndexPath = SdfPath());
1818 void _ComposeSubtreesInParallel(
1819 const std::vector<Usd_PrimDataPtr> &prims,
1820 const std::vector<SdfPath> *primIndexPaths = nullptr);
1821
1822 // Composes the full prim type info for the prim based on its type name
1823 // and applied API schemas.
1824 void _ComposePrimTypeInfoImpl(Usd_PrimDataPtr prim);
1825
1826 // Compose subtree rooted at \p prim under \p parent. This function
1827 // ensures that the appropriate prim index is specified for \p prim if
1828 // \p parent is in a prototype.
1829 void _ComposeChildSubtree(Usd_PrimDataPtr prim,
1830 Usd_PrimDataConstPtr parent,
1831 UsdStagePopulationMask const *mask);
1832
1833 // Compose \p prim's list of children and make any modifications necessary
1834 // to its _children member and the stage's _primMap, including possibly
1835 // instantiating new prims, or destroying existing subtrees of prims. The
1836 // any newly created prims *do not* have their prim index, type, flags, or
1837 // children composed.
1838 //
1839 // Compose only \p prim's direct children if recurse=false. Otherwise
1840 // recompose every descendent of \p prim. Callers that pass recurse=false
1841 // should invoke _ComposeSubtree on any newly created prims to ensure caches
1842 // are correctly populated.
1843 void _ComposeChildren(Usd_PrimDataPtr prim,
1844 UsdStagePopulationMask const *mask, bool recurse);
1845
1846 // Instantiate a prim instance. There must not already be an instance
1847 // at \p primPath.
1848 Usd_PrimDataPtr _InstantiatePrim(const SdfPath &primPath);
1849
1850 // Instantiate a prototype prim and sets its parent to pseudoroot.
1851 // There must not already be a prototype at \p primPath.
1852 Usd_PrimDataPtr _InstantiatePrototypePrim(const SdfPath &primPath);
1853
1854 // For \p prim and all of its descendants, remove from _primMap and empty
1855 // their _children vectors.
1856 void _DestroyPrim(Usd_PrimDataPtr prim);
1857
1858 // Destroy the prim subtrees rooted at each path in \p paths. \p paths may
1859 // not contain any path that is a descendent of another path in \p paths.
1860 void _DestroyPrimsInParallel(const std::vector<SdfPath>& paths);
1861
1862 // Invoke _DestroyPrim() on all of \p prim's direct children.
1863 void _DestroyDescendents(Usd_PrimDataPtr prim);
1864
1865 // Returns true if the object at the given path is a descendant of
1866 // an instance prim, i.e. a prim beneath an instance prim, or a property
1867 // of a prim beneath an instance prim.
1868 bool _IsObjectDescendantOfInstance(const SdfPath& path) const;
1869
1870 // If the given prim is an instance, returns the corresponding
1871 // prototype prim. Otherwise, returns an invalid prim.
1872 Usd_PrimDataConstPtr _GetPrototypeForInstance(Usd_PrimDataConstPtr p) const;
1873
1874 // Returns the path of the Usd prim using the prim index at the given path.
1875 SdfPath _GetPrimPathUsingPrimIndexAtPath(const SdfPath& primIndexPath) const;
1876
1877 // Responds to LayersDidChangeSentPerLayer event and update stage contents
1878 // in response to changes in scene description.
1879 void _HandleLayersDidChange(const SdfNotice::LayersDidChangeSentPerLayer &);
1880
1881 // Pushes changes through PCP to determine invalidation based on
1882 // composition metadata.
1883 // Returns a value indicating if notices were sent during execution.
1884 bool _ProcessChangeLists(const SdfLayerChangeListVec &);
1885
1886 // Update stage contents in response to changes to the asset resolver.
1887 void _HandleResolverDidChange(const ArNotice::ResolverChanged &);
1888
1889 // Process stage change information stored in _pendingChanges.
1890 // _pendingChanges will be set to nullptr by the end of the function.
1891 // This function will return true if UsdNotice::ObjectsChanged and
1892 // UsdNotice::StageContentsChanged notices were sent during execution.
1893 bool _ProcessPendingChanges();
1894
1895 // Remove scene description for the prim at \p fullPath in the current edit
1896 // target.
1897 bool _RemovePrim(const SdfPath& fullPath);
1898
1899 SdfPrimSpecHandle _GetPrimSpec(const SdfPath& fullPath);
1900
1901 // Find and return the defining spec type for the property spec at the given
1902 // path, or SdfSpecTypeUnknown if none exists. The defining spec type is
1903 // either the builtin definition's spec type, if the indicated property is
1904 // builtin, otherwise it's the strongest authored spec's type if one exists,
1905 // otherwise it's SdfSpecTypeUnknown.
1906 SdfSpecType _GetDefiningSpecType(Usd_PrimDataConstPtr primData,
1907 const TfToken &propName) const;
1908
1909 // Helper to apply Pcp changes and recompose the scenegraph accordingly,
1910 // given an optional initial set of paths to recompose.
1911 void _Recompose(const PcpChanges &changes);
1912 template <class T>
1913 void _Recompose(const PcpChanges &changes, T *pathsToRecompose);
1914 template <class T>
1915 void _RecomposePrims(T *pathsToRecompose);
1916
1917 // Helper for _Recompose to find the subtrees that need to be
1918 // fully recomposed and to recompose the name children of the
1919 // parents of these subtrees. Note that [start, finish) must be a
1920 // sorted range of map iterators whose keys are paths with no descendent
1921 // paths. In C++20, consider using the ranges API to improve this.
1922 template <class Iter>
1923 void _ComputeSubtreesToRecompose(Iter start, Iter finish,
1924 std::vector<Usd_PrimDataPtr>* recompose);
1925
1926 // return true if the path is valid for load/unload operations.
1927 // This method will emit errors when invalid paths are encountered.
1928 bool _IsValidForLoad(const SdfPath& path) const;
1929 bool _IsValidForUnload(const SdfPath& path) const;
1930
1931 // Discover all payloads in a given subtree, adding the path of each
1932 // discovered prim index to the \p primIndexPaths set. If specified,
1933 // the corresponding UsdPrim path will be added to the \p usdPrimPaths
1934 // set. The root path will be considered for inclusion in the result set.
1935 //
1936 // Note that some payloads may not be discoverable in until an ancestral
1937 // payload has been included. UsdStage::LoadAndUnload takes this into
1938 // account.
1939 void _DiscoverPayloads(const SdfPath& rootPath,
1940 UsdLoadPolicy policy,
1941 SdfPathSet* primIndexPaths,
1942 bool unloadedOnly = false,
1943 SdfPathSet* usdPrimPaths = nullptr) const;
1944
1945 // ===================================================================== //
1946 // VALUE RESOLUTION //
1947 // ===================================================================== //
1948 // --------------------------------------------------------------------- //
1949 // Specialized Value Resolution
1950 // --------------------------------------------------------------------- //
1951
1952 // Helpers for resolving values for metadata fields requiring
1953 // special behaviors.
1954 static SdfSpecifier _GetSpecifier(Usd_PrimDataConstPtr primData);
1955 static TfToken _GetKind(Usd_PrimDataConstPtr primData);
1956 static bool _IsActive(Usd_PrimDataConstPtr primData);
1957
1958 // Custom is true if it is true anywhere in the stack.
1959 bool _IsCustom(const UsdProperty &prop) const;
1960
1961 // Variability is determined by the weakest opinion in the stack.
1962 SdfVariability _GetVariability(const UsdProperty &prop) const;
1963
1964 // Helper functions for resolving asset paths during value resolution.
1965 void _MakeResolvedAssetPaths(UsdTimeCode time, const UsdAttribute &attr,
1966 SdfAssetPath *assetPaths,
1967 size_t numAssetPaths,
1968 bool anchorAssetPathsOnly = false) const;
1969
1970 void _MakeResolvedAssetPathsValue(UsdTimeCode time, const UsdAttribute &attr,
1971 VtValue *value,
1972 bool anchorAssetPathsOnly = false) const;
1973
1974 void _MakeResolvedTimeCodes(UsdTimeCode time, const UsdAttribute &attr,
1975 SdfTimeCode *timeCodes,
1976 size_t numTimeCodes) const;
1977
1978 void _MakeResolvedPathExpressions(
1979 UsdTimeCode time, const UsdAttribute &attr,
1980 SdfPathExpression *pathExprs,
1981 size_t numPathExprs) const;
1982
1983 void _MakeResolvedAttributeValue(UsdTimeCode time, const UsdAttribute &attr,
1984 VtValue *value) const;
1985
1986 // --------------------------------------------------------------------- //
1987 // Metadata Resolution
1988 // --------------------------------------------------------------------- //
1989
1990public:
1991 // Trait that allows us to call the correct version of _GetMetadata for
1992 // types that require type specific value resolution as opposed to just
1993 // strongest opinion. These types also use type specific resolution
1994 // in _GetValue.
1995 template <class T>
1996 struct _HasTypeSpecificResolution {
1997 static const bool value =
1998 std::is_same<T, SdfAssetPath>::value ||
1999 std::is_same<T, VtArray<SdfAssetPath>>::value ||
2000 std::is_same<T, SdfTimeCode>::value ||
2001 std::is_same<T, VtArray<SdfTimeCode>>::value ||
2002 std::is_same<T, SdfPathExpression>::value ||
2003 std::is_same<T, VtArray<SdfPathExpression>>::value ||
2004 std::is_same<T, SdfTimeSampleMap>::value ||
2005 std::is_same<T, TsSpline>::value ||
2006 std::is_same<T, VtDictionary>::value;
2007 };
2008
2009private:
2010 // Get metadata for types that do not have type specific value resolution.
2011 template <class T>
2012 typename std::enable_if<!_HasTypeSpecificResolution<T>::value, bool>::type
2013 _GetMetadata(const UsdObject &obj,
2014 const TfToken& fieldName,
2015 const TfToken &keyPath,
2016 bool useFallbacks,
2017 T* result) const;
2018
2019 // Get metadata for types that do have type specific value resolution.
2020 template <class T>
2021 typename std::enable_if<_HasTypeSpecificResolution<T>::value, bool>::type
2022 _GetMetadata(const UsdObject &obj,
2023 const TfToken& fieldName,
2024 const TfToken &keyPath,
2025 bool useFallbacks,
2026 T* result) const;
2027
2028 // Get metadata as a dynamically typed VtValue. Will perform type specific
2029 // value resolution if the returned held type requires it.
2030 bool _GetMetadata(const UsdObject &obj,
2031 const TfToken& fieldName,
2032 const TfToken &keyPath,
2033 bool useFallbacks,
2034 VtValue* result) const;
2035
2036 // Gets a metadata value using only strongest value resolution. It is
2037 // assumed that result is holding a value that does not require type
2038 // specific value resolution.
2039 USD_API
2040 bool _GetStrongestResolvedMetadata(const UsdObject &obj,
2041 const TfToken& fieldName,
2042 const TfToken &keyPath,
2043 bool useFallbacks,
2044 SdfAbstractDataValue* result) const;
2045
2046 // Gets a metadata value with the type specific value resolution for the
2047 // type applied. This is only implemented for types that
2048 // _HasTypeSpecificResolution.
2049 template <class T>
2050 USD_API
2051 bool _GetTypeSpecificResolvedMetadata(const UsdObject &obj,
2052 const TfToken& fieldName,
2053 const TfToken &keyPath,
2054 bool useFallbacks,
2055 T* result) const;
2056
2057 template <class Composer>
2058 void _GetAttrTypeImpl(const UsdAttribute &attr,
2059 const TfToken &fieldName,
2060 bool useFallbacks,
2061 Composer *composer) const;
2062
2063 template <class Composer>
2064 void _GetAttrVariabilityImpl(const UsdAttribute &attr,
2065 bool useFallbacks,
2066 Composer *composer) const;
2067
2068 template <class Composer>
2069 void _GetPropCustomImpl(const UsdProperty &prop,
2070 bool useFallbacks,
2071 Composer *composer) const;
2072
2073 template <class Composer>
2074 bool _GetSpecialPropMetadataImpl(const UsdObject &obj,
2075 const TfToken &fieldName,
2076 const TfToken &keyPath,
2077 bool useFallbacks,
2078 Composer *composer) const;
2079 template <class Composer>
2080 bool _GetMetadataImpl(const UsdObject &obj,
2081 const TfToken& fieldName,
2082 const TfToken& keyPath,
2083 bool includeFallbacks,
2084 Composer *composer) const;
2085
2086 template <class Composer>
2087 bool _GetGeneralMetadataImpl(const UsdObject &obj,
2088 const TfToken& fieldName,
2089 const TfToken& keyPath,
2090 bool includeFallbacks,
2091 Composer *composer) const;
2092
2093 // NOTE: The "authoredOnly" flag is not yet in use, but when we have
2094 // support for prim-based metadata fallbacks, they should be ignored when
2095 // this flag is set to true.
2096 bool _HasMetadata(const UsdObject &obj, const TfToken& fieldName,
2097 const TfToken &keyPath, bool useFallbacks) const;
2098
2100 _ListMetadataFields(const UsdObject &obj, bool useFallbacks) const;
2101
2102 void _GetAllMetadata(const UsdObject &obj,
2103 bool useFallbacks,
2104 UsdMetadataValueMap* result,
2105 bool anchorAssetPathsOnly = false) const;
2106
2107 // --------------------------------------------------------------------- //
2108 // Default & TimeSample Resolution
2109 // --------------------------------------------------------------------- //
2110
2111 void _GetResolveInfo(const UsdAttribute &attr,
2112 UsdResolveInfo *resolveInfo,
2113 const UsdTimeCode *time = nullptr) const;
2114
2115 void _GetResolveInfoWithResolveTarget(
2116 const UsdAttribute &attr,
2117 const UsdResolveTarget &resolveTarget,
2118 UsdResolveInfo *resolveInfo,
2119 const UsdTimeCode *time = nullptr) const;
2120
2121 template <class T> struct _ExtraResolveInfo;
2122
2123 // Gets the value resolve info for the given attribute. If time is provided,
2124 // the resolve info is evaluated for that specific time (which may be
2125 // default). Otherwise, if time is null, the resolve info is evaluated for
2126 // "any numeric time" and will not populate values in extraInfo that
2127 // require a specific time to be evaluated.
2128 template <class T>
2129 void _GetResolveInfo(const UsdAttribute &attr,
2130 UsdResolveInfo *resolveInfo,
2131 const UsdTimeCode *time = nullptr,
2132 _ExtraResolveInfo<T> *extraInfo = nullptr) const;
2133
2134 // Gets the value resolve info for the given attribute using the given
2135 // resolve target. If time is provided, the resolve info is evaluated for
2136 // that specific time (which may be default). Otherwise, if time is null,
2137 // the resolve info is evaluated for "any numeric time" and will not
2138 // populate values in extraInfo that require a specific time to be
2139 // evaluated.
2140 template <class T>
2141 void _GetResolveInfoWithResolveTarget(
2142 const UsdAttribute &attr,
2143 const UsdResolveTarget &resolveTarget,
2144 UsdResolveInfo *resolveInfo,
2145 const UsdTimeCode *time = nullptr,
2146 _ExtraResolveInfo<T> *extraInfo = nullptr) const;
2147
2148 // Shared implementation function for _GetResolveInfo and
2149 // _GetResolveInfoWithResolveTarget. The only difference between how these
2150 // two functions behave is in how they create the Usd_Resolver used for
2151 // iterating over nodes and layers, thus they provide this implementation
2152 // with the needed MakeUsdResolverFn to create the Usd_Resolver.
2153 template <class T, class MakeUsdResolverFn>
2154 void _GetResolveInfoImpl(const UsdAttribute &attr,
2155 UsdResolveInfo *resolveInfo,
2156 const UsdTimeCode *time,
2157 _ExtraResolveInfo<T> *extraInfo,
2158 const MakeUsdResolverFn &makeUsdResolveFn) const;
2159
2160 template <class T> struct _ResolveInfoResolver;
2161 struct _PropertyStackResolver;
2162
2163 template <class Resolver, class MakeUsdResolverFn>
2164 void _GetResolvedValueAtDefaultImpl(
2165 const UsdProperty &prop,
2166 Resolver *resolver,
2167 const MakeUsdResolverFn &makeUsdResolverFn) const;
2168
2169 template <class Resolver, class MakeUsdResolverFn>
2170 void _GetResolvedValueAtTimeImpl(
2171 const UsdProperty &prop,
2172 Resolver *resolver,
2173 const double *time,
2174 const MakeUsdResolverFn &makeUsdResolverFn) const;
2175
2176 bool _GetValue(UsdTimeCode time, const UsdAttribute &attr,
2177 VtValue* result) const;
2178
2179 template <class T>
2180 bool _GetValue(UsdTimeCode time, const UsdAttribute &attr,
2181 T* result) const;
2182
2183 template <class T>
2184 bool _GetValueImpl(UsdTimeCode time, const UsdAttribute &attr,
2185 Usd_InterpolatorBase* interpolator,
2186 T* value) const;
2187
2188 USD_API
2189 bool _GetValueFromResolveInfo(const UsdResolveInfo &info,
2190 UsdTimeCode time, const UsdAttribute &attr,
2191 VtValue* result) const;
2192
2193 template <class T>
2194 USD_API
2195 bool _GetValueFromResolveInfo(const UsdResolveInfo &info,
2196 UsdTimeCode time, const UsdAttribute &attr,
2197 T* result) const;
2198
2199 template <class T>
2200 bool _GetValueFromResolveInfoImpl(const UsdResolveInfo &info,
2201 UsdTimeCode time, const UsdAttribute &attr,
2202 Usd_InterpolatorBase* interpolator,
2203 T* value) const;
2204
2205 template <class T>
2206 bool _GetDefaultValueFromResolveInfoImpl(const UsdResolveInfo &info,
2207 const UsdAttribute &attr,
2208 T* value) const;
2209
2210 Usd_AssetPathContext
2211 _GetAssetPathContext(UsdTimeCode time, const UsdAttribute &attr) const;
2212
2213 // --------------------------------------------------------------------- //
2214 // Specialized Time Sample I/O
2215 // --------------------------------------------------------------------- //
2216
2223 bool _GetTimeSamplesInInterval(const UsdAttribute &attr,
2224 const GfInterval& interval,
2225 std::vector<double>* times) const;
2226
2227 bool _GetTimeSamplesInIntervalFromResolveInfo(
2228 const UsdResolveInfo &info,
2229 const UsdAttribute &attr,
2230 const GfInterval& interval,
2231 std::vector<double>* times) const;
2232
2233 size_t _GetNumTimeSamples(const UsdAttribute &attr) const;
2234
2235 size_t _GetNumTimeSamplesFromResolveInfo(const UsdResolveInfo &info,
2236 const UsdAttribute &attr) const;
2237
2241 bool _GetBracketingTimeSamples(const UsdAttribute &attr,
2242 double desiredTime,
2243 bool authoredOnly,
2244 double* lower,
2245 double* upper,
2246 bool* hasSamples) const;
2247
2248 bool _GetBracketingTimeSamplesFromResolveInfo(const UsdResolveInfo &info,
2249 const UsdAttribute &attr,
2250 double desiredTime,
2251 bool authoredOnly,
2252 double* lower,
2253 double* upper,
2254 bool* hasSamples) const;
2255
2256 bool _ValueMightBeTimeVarying(const UsdAttribute &attr) const;
2257
2258 bool _ValueMightBeTimeVaryingFromResolveInfo(const UsdResolveInfo &info,
2259 const UsdAttribute &attr) const;
2260
2261 void _RegisterPerLayerNotices();
2262 void _RegisterResolverChangeNotice();
2263
2264 // Helper to obtain a malloc tag string for this stage.
2265 inline char const *_GetMallocTagId() const;
2266
2267private:
2268 class _PendingChanges;
2269
2270 // Change block for use by the UsdNamespaceEditor to allow it to indicate
2271 // to its dependent stages what the expected namespace edits are when the
2272 // stages handles notices from the changes the namespace editor performs.
2273 // The stage uses this provide additional information about prim resyncs
2274 // related to namespace edits in the ObjectsChanged notice it sends.
2275 class _NamespaceEditsChangeBlock {
2276 public:
2277 // Info about an expected namespace edit change from UsdNamespaceEditor.
2278 // This includes the original pre-edit prim stack of the prim at the old
2279 // path which is used to determine if the prim at the new path has the
2280 // same composed contents after the edits as the prim had originally at
2281 // the old path before the edits.
2282 struct ExpectedNamespaceEditChange {
2283 SdfPath oldPath;
2284 SdfPath newPath;
2285 SdfPrimSpecHandleVector oldPrimStack;
2286 };
2287 using ExpectedNamespaceEditChangeVector =
2288 std::vector<ExpectedNamespaceEditChange>;
2289
2290 _NamespaceEditsChangeBlock(const UsdStagePtr &stage,
2291 ExpectedNamespaceEditChangeVector &&expectedChanges);
2292 _NamespaceEditsChangeBlock(_NamespaceEditsChangeBlock &&);
2293 ~_NamespaceEditsChangeBlock();
2294
2295 private:
2296 UsdStagePtr _stage;
2297 std::unique_ptr<_PendingChanges> _localPendingChanges;
2298 };
2299
2300 // The 'pseudo root' prim.
2301 Usd_PrimDataPtr _pseudoRoot;
2302
2303 // The stage's root layer.
2304 SdfLayerRefPtr _rootLayer;
2305
2306 // Every UsdStage has an implicit, in-memory session layer.
2307 // This is to allow for runtime overrides such as variant selections.
2308 SdfLayerRefPtr _sessionLayer;
2309
2310 // The stage's EditTarget.
2311 UsdEditTarget _editTarget;
2312 bool _editTargetIsLocalLayer;
2313
2314 std::unique_ptr<PcpCache> _cache;
2315 std::unique_ptr<Usd_ClipCache> _clipCache;
2316 std::unique_ptr<Usd_InstanceCache> _instanceCache;
2317
2318 TfHashMap<TfToken, TfToken, TfHash> _invalidPrimTypeToFallbackMap;
2319
2320 size_t _usedLayersRevision;
2321
2322 // A concurrent map from Path to Prim, for fast random access.
2323 struct _TbbHashEq {
2324 inline bool equal(SdfPath const &l, SdfPath const &r) const {
2325 return l == r;
2326 }
2327 inline size_t hash(SdfPath const &path) const {
2328 return path.GetHash();
2329 }
2330 };
2331 using PathToNodeMap = tbb::concurrent_hash_map<
2332 SdfPath, Usd_PrimDataIPtr, _TbbHashEq>;
2333 PathToNodeMap _primMap;
2334
2335 // The interpolation type used for all attributes on the stage.
2336 UsdInterpolationType _interpolationType;
2337
2338 typedef std::vector<
2339 std::pair<SdfLayerHandle, TfNotice::Key> > _LayerAndNoticeKeyVec;
2340 _LayerAndNoticeKeyVec _layersAndNoticeKeys;
2341 size_t _lastChangeSerialNumber;
2342
2343 TfNotice::Key _resolverChangeKey;
2344
2345 // Data for pending change processing.
2346 _PendingChanges* _pendingChanges;
2347
2348 std::optional<WorkDispatcher> _dispatcher;
2349
2350 // To provide useful aggregation of malloc stats, we bill everything
2351 // for this stage - from all access points - to this tag.
2352 std::unique_ptr<std::string> _mallocTagID;
2353
2354 // The state used when instantiating the stage.
2355 const InitialLoadSet _initialLoadSet;
2356
2357 // The population mask that applies to this stage.
2358 UsdStagePopulationMask _populationMask;
2359
2360 // The load rules that apply to this stage.
2361 UsdStageLoadRules _loadRules;
2362
2363 bool _isClosingStage;
2364 bool _isWritingFallbackPrimTypes;
2365
2366 friend class UsdAPISchemaBase;
2367 friend class UsdAttribute;
2368 friend class UsdAttributeQuery;
2369 friend class UsdEditTarget;
2370 friend class UsdInherits;
2371 friend class UsdNamespaceEditor;
2372 friend class UsdObject;
2373 friend class UsdPrim;
2374 friend class UsdProperty;
2375 friend class UsdRelationship;
2376 friend class UsdSpecializes;
2377 friend class UsdVariantSet;
2378 friend class UsdVariantSets;
2379 friend class Usd_AssetPathContext;
2380 friend class Usd_FlattenAccess;
2381 friend class Usd_PcpCacheAccess;
2382 friend class Usd_PrimData;
2383 friend class Usd_StageOpenRequest;
2384 friend class Usd_TypeQueryAccess;
2385 template <class T> friend struct Usd_AttrGetValueHelper;
2386 friend struct Usd_AttrGetUntypedValueHelper;
2387 template <class RefsOrPayloadsEditorType, class RefsOrPayloadsProxyType>
2388 friend struct Usd_ListEditImpl;
2389};
2390
2391// UsdObject's typed metadata query relies on this specialization being
2392// externally visible and exporting the primary template does not
2393// automatically export this specialization.
2394template <>
2395USD_API
2396bool
2397UsdStage::_GetTypeSpecificResolvedMetadata(const UsdObject &obj,
2398 const TfToken& fieldName,
2399 const TfToken &keyPath,
2400 bool useFallbacks,
2401 SdfTimeSampleMap* result) const;
2402
2403template<typename T>
2404bool
2405UsdStage::GetMetadata(const TfToken& key, T* value) const
2406{
2407 VtValue result;
2408 if (!GetMetadata(key, &result)){
2409 return false;
2410 }
2411
2412 if (result.IsHolding<T>()){
2413 *value = result.UncheckedGet<T>();
2414 return true;
2415 } else {
2416 TF_CODING_ERROR("Requested type %s for stage metadatum %s does not"
2417 " match retrieved type %s",
2418 ArchGetDemangled<T>().c_str(),
2419 key.GetText(),
2420 result.GetTypeName().c_str());
2421 return false;
2422 }
2423}
2424
2425template<typename T>
2426bool
2427UsdStage::SetMetadata(const TfToken& key, const T& value) const
2428{
2429 VtValue in(value);
2430 return SetMetadata(key, in);
2431}
2432
2433template<typename T>
2434bool
2436 T* value) const
2437{
2438 VtValue result;
2439 if (!GetMetadataByDictKey(key, keyPath, &result)){
2440 return false;
2441 }
2442
2443 if (result.IsHolding<T>()){
2444 *value = result.UncheckedGet<T>();
2445 return true;
2446 } else {
2447 TF_CODING_ERROR("Requested type %s for stage metadatum %s[%s] does not"
2448 " match retrieved type %s",
2449 ArchGetDemangled<T>().c_str(),
2450 key.GetText(),
2451 keyPath.GetText(),
2452 result.GetTypeName().c_str());
2453 return false;
2454 }
2455}
2456
2457template<typename T>
2458bool
2460 const T& value) const
2461{
2462 VtValue in(value);
2463 return SetMetadataByDictKey(key, keyPath, in);
2464}
2465
2466// Get metadata for types that do not have type specific value resolution.
2467template <class T>
2468typename std::enable_if<
2469 !UsdStage::_HasTypeSpecificResolution<T>::value, bool>::type
2470UsdStage::_GetMetadata(const UsdObject &obj,
2471 const TfToken& fieldName,
2472 const TfToken &keyPath,
2473 bool useFallbacks,
2474 T* result) const
2475{
2476 // Since these types don't have type specific value resolution, we can just
2477 // get the strongest metadata value and be done.
2478 SdfAbstractDataTypedValue<T> out(result);
2479 return _GetStrongestResolvedMetadata(
2480 obj, fieldName, keyPath, useFallbacks, &out);
2481}
2482
2483// Get metadata for types that do have type specific value resolution.
2484template <class T>
2485typename std::enable_if<
2486 UsdStage::_HasTypeSpecificResolution<T>::value, bool>::type
2487UsdStage::_GetMetadata(const UsdObject &obj,
2488 const TfToken& fieldName,
2489 const TfToken &keyPath,
2490 bool useFallbacks,
2491 T* result) const
2492{
2493 // Call the templated type specifice resolved metadata implementation that
2494 // will only be implemented for types that support it.
2495 return _GetTypeSpecificResolvedMetadata(
2496 obj, fieldName, keyPath, useFallbacks, result);
2497}
2498
2499
2500// Set metadata for types that don't need to be mapped across edit targets.
2501template <class T>
2502typename std::enable_if<!UsdStage::_IsEditTargetMappable<T>::value, bool>::type
2503UsdStage::_SetMetadata(const UsdObject &object, const TfToken& key,
2504 const TfToken &keyPath, const T& value)
2505{
2506 // Since we know that we don't need to map the value for edit targets,
2507 // we can just type erase the value and set the metadata as is.
2509 return _SetMetadataImpl<SdfAbstractDataConstValue>(
2510 object, key, keyPath, in);
2511}
2512
2513// Set metadata for types that do need to be mapped for edit targets.
2514template <class T>
2515typename std::enable_if<UsdStage::_IsEditTargetMappable<T>::value, bool>::type
2516UsdStage::_SetMetadata(const UsdObject &object, const TfToken& key,
2517 const TfToken &keyPath, const T& value)
2518{
2519 return _SetEditTargetMappedMetadata(object, key, keyPath, value);
2520}
2521
2522PXR_NAMESPACE_CLOSE_SCOPE
2523
2524#endif //PXR_USD_USD_STAGE_H
2525
Notice sent when asset paths may resolve to a different path than before due to a change in the resol...
Definition: notice.h:50
An asset resolver context allows clients to provide additional data to the resolver for use during re...
A basic mathematical interval class.
Definition: interval.h:33
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:77
Describes Pcp changes.
Definition: changes.h:207
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:62
The fully-typed container for a field value in an SdfAbstractData.
Definition: abstractData.h:572
The fully-typed container for a field value in an SdfAbstractData.
Definition: abstractData.h:476
A type-erased container for a field value in an SdfAbstractData.
Definition: abstractData.h:417
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:73
SdfHandle is a smart ptr that calls IsDormant() on the pointed-to object as an extra expiration check...
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:84
std::map< std::string, std::string > FileFormatArguments
Type for specifying additional file format-specific arguments to layer API.
Definition: layer.h:107
Notice sent per-layer indicating all layers whose contents have changed within a single round of chan...
Definition: notice.h:94
Objects of this class represent a logical expression syntax tree consisting of SdfPathPattern s,...
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
static SDF_API const SdfPath & AbsoluteRootPath()
The absolute path representing the top of the namespace hierarchy.
Value type that represents a time code.
Definition: timeCode.h:28
Stores a pointer to a ValueType which uses TfDelegatedCountIncrement and TfDelegatedCountDecrement to...
Handle-object returned by TfNotice::Register().
Definition: notice.h:240
Enable a concrete base class for use with TfRefPtr.
Definition: refBase.h:56
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
char const * GetText() const
Return the text that this token represents.
Definition: token.h:179
TfType represents a dynamic runtime type.
Definition: type.h:48
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:124
A mathematical description of a curved function from time to value.
Definition: spline.h:59
The base class for all API schemas.
Definition: apiSchemaBase.h:99
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:167
Object for efficiently making repeated queries for attribute values.
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:64
A proxy class for applying listOp edits to the inherit paths list for a prim.
Definition: inherits.h:34
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:115
Accessor to a attribute's definition in the prim definition.
Accessor to a property's definition in the prim definition.
Accessor to a relationship's definition in the prim definition.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Definition: primRange.h:102
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:38
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:111
Container for information about the source of an attribute's value, i.e.
Definition: resolveInfo.h:55
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:56
A proxy class for applying listOp edits to the specializes list for a prim.
Definition: specializes.h:34
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
Definition: stage.h:136
USD_API void SetEndTimeCode(double)
Sets the stage's end timeCode.
USD_API bool SetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, const VtValue &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API void LoadAndUnload(const SdfPathSet &loadSet, const SdfPathSet &unloadSet, UsdLoadPolicy policy=UsdLoadWithDescendants)
Unload and load the given path sets.
USD_API void WriteFallbackPrimTypes()
Writes the fallback prim types defined in the schema registry to the stage as dictionary valued fallb...
static USD_API void SetColorConfigFallbacks(const SdfAssetPath &colorConfiguration, const TfToken &colorManagementSystem)
Sets the global fallback values of color configuration metadata which includes the 'colorConfiguratio...
static USD_API UsdStageRefPtr Open(const SdfLayerHandle &rootLayer, const SdfLayerHandle &sessionLayer, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool ExportToString(std::string *result, bool addSourceFileComment=true) const
Writes the composite scene as a flattened Usd text representation into the given string.
bool SetMetadata(const TfToken &key, const T &value) const
Set the value of Stage metadatum key to value, if the stage's current UsdEditTarget is the root or se...
Definition: stage.h:2427
static USD_API UsdStageRefPtr OpenMasked(const SdfLayerHandle &rootLayer, const UsdStagePopulationMask &mask, InitialLoadSet load=LoadAll)
Open a stage rooted at rootLayer and with limited population subject to mask.
static USD_API UsdStageRefPtr CreateNew(const std::string &identifier, const SdfLayerHandle &sessionLayer, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API std::vector< UsdPrim > GetPrototypes() const
Returns all native instancing prototype prims.
USD_API bool HasAuthoredMetadataDictKey(const TfToken &key, const TfToken &keyPath) const
Return true if there exists any authored opinion (excluding fallbacks) for key and keyPath.
USD_API UsdPrim OverridePrim(const SdfPath &path)
Attempt to ensure a UsdPrim at path exists on this stage.
USD_API void SetPopulationMask(UsdStagePopulationMask const &mask)
Set this stage's population mask and recompose the stage.
USD_API void UnmuteLayer(const std::string &layerIdentifier)
Unmute the layer identified by layerIdentifier if it had previously been muted.
USD_API SdfPathSet GetLoadSet()
Returns a set of all loaded paths.
USD_API PcpErrorVector GetCompositionErrors() const
Return a PcpErrorVector containing all composition errors encountered when composing the prims and la...
static USD_API PcpVariantFallbackMap GetGlobalVariantFallbacks()
Get the global variant fallback preferences used in new UsdStages.
USD_API void ExpandPopulationMask(std::function< bool(UsdRelationship const &)> const &relPred=nullptr, std::function< bool(UsdAttribute const &)> const &attrPred=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool HasAuthoredMetadata(const TfToken &key) const
Returns true if the key has an authored value, false if no value was authored or the only value avail...
USD_API UsdEditTarget GetEditTargetForLocalLayer(size_t i)
Return a UsdEditTarget for editing the layer at index i in the layer stack.
USD_API SdfLayerHandleVector GetUsedLayers(bool includeClipLayers=true) const
Return a vector of all of the layers currently consumed by this stage, as determined by the compositi...
USD_API bool GetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, VtValue *value) const
overload
USD_API double GetEndTimeCode() const
Returns the stage's end timeCode.
static USD_API UsdStageRefPtr CreateInMemory(const std::string &identifier, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
UsdStagePopulationMask GetPopulationMask() const
Return this stage's population mask.
Definition: stage.h:655
USD_API bool Export(const std::string &filename, bool addSourceFileComment=true, const SdfLayer::FileFormatArguments &args=SdfLayer::FileFormatArguments()) const
Writes out the composite scene as a single flattened layer into filename.
static USD_API UsdStageRefPtr CreateNew(const std::string &identifier, InitialLoadSet load=LoadAll)
Create a new stage with root layer identifier, destroying potentially existing files with that identi...
USD_API UsdPrim GetPseudoRoot() const
Return the stage's "pseudo-root" prim, whose name is defined by Usd.
USD_API double GetFramesPerSecond() const
Returns the stage's framesPerSecond value.
USD_API std::string ResolveIdentifierToEditTarget(std::string const &identifier) const
Resolve the given identifier using this stage's ArResolverContext and the layer of its GetEditTarget(...
USD_API void ExpandPopulationMask(Usd_PrimFlagsPredicate const &traversalPredicate, std::function< bool(UsdRelationship const &)> const &relPred=nullptr, std::function< bool(UsdAttribute const &)> const &attrPred=nullptr)
Expand this stage's population mask to include the targets of all relationships that pass relPred and...
USD_API UsdProperty GetPropertyAtPath(const SdfPath &path) const
Return the UsdProperty at path, or an invalid UsdProperty if none exists.
static USD_API UsdStageRefPtr CreateInMemory(const std::string &identifier, const SdfLayerHandle &sessionLayer, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API UsdPrim DefinePrim(const SdfPath &path, const TfToken &typeName=TfToken())
Attempt to ensure a UsdPrim at path is defined (according to UsdPrim::IsDefined()) on this stage.
USD_API void SetTimeCodesPerSecond(double timeCodesPerSecond) const
Sets the stage's timeCodesPerSecond value.
USD_API UsdAttribute GetAttributeAtPath(const SdfPath &path) const
Return the UsdAttribute at path, or an invalid UsdAttribute if none exists.
USD_API UsdPrim GetDefaultPrim() const
Return the UsdPrim on this stage whose path is the root layer's defaultPrim metadata's value.
USD_API bool HasDefaultPrim() const
Return true if this stage's root layer has an authored opinion for the default prim layer metadata.
USD_API UsdPrimRange Traverse(const Usd_PrimFlagsPredicate &predicate)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API void GetColorConfigFallbacks(SdfAssetPath *colorConfiguration, TfToken *colorManagementSystem)
Returns the global fallback values of 'colorConfiguration' and 'colorManagementSystem'.
USD_API UsdPrim GetPrimAtPath(const SdfPath &path) const
Return the UsdPrim at path, or an invalid UsdPrim if none exists.
USD_API UsdInterpolationType GetInterpolationType() const
Returns the interpolation type used during value resolution for all attributes on this stage.
USD_API UsdPrimRange TraverseAll()
Traverse all the prims on this stage depth-first.
USD_API bool IsLayerMuted(const std::string &layerIdentifier) const
Returns true if the layer specified by layerIdentifier is muted in this cache, false otherwise.
USD_API void SetColorManagementSystem(const TfToken &cms) const
Sets the name of the color management system used to interpret the color configuration file pointed a...
USD_API void ClearDefaultPrim()
Clear the default prim layer metadata in this stage's root layer.
InitialLoadSet
Specifies the initial set of prims to load when opening a UsdStage.
Definition: stage.h:150
@ LoadAll
Load all loadable prims.
Definition: stage.h:151
@ LoadNone
Load no loadable prims.
Definition: stage.h:152
bool SetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, const T &value) const
Author value to the field identified by key and keyPath at the current EditTarget.
Definition: stage.h:2459
static USD_API UsdStageRefPtr CreateNew(const std::string &identifier, const SdfLayerHandle &sessionLayer, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API UsdStageRefPtr CreateInMemory(InitialLoadSet load=LoadAll)
Creates a new stage only in memory, analogous to creating an anonymous SdfLayer.
USD_API void SetDefaultPrim(const UsdPrim &prim)
Set the default prim layer metadata in this stage's root layer.
USD_API double GetTimeCodesPerSecond() const
Returns the stage's timeCodesPerSecond value.
static USD_API UsdStageRefPtr OpenMasked(const SdfLayerHandle &rootLayer, const SdfLayerHandle &sessionLayer, const ArResolverContext &pathResolverContext, const UsdStagePopulationMask &mask, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API double GetStartTimeCode() const
Returns the stage's start timeCode.
USD_API void MuteLayer(const std::string &layerIdentifier)
Mute the layer identified by layerIdentifier.
USD_API const std::vector< std::string > & GetMutedLayers() const
Returns a vector of all layers that have been muted on this stage.
USD_API bool HasMetadataDictKey(const TfToken &key, const TfToken &keyPath) const
Return true if there exists any authored or fallback opinion for key and keyPath.
USD_API UsdPrim CreateClassPrim(const SdfPath &rootPrimPath)
Author an SdfPrimSpec with specifier == SdfSpecifierClass for the class at root prim path path at the...
USD_API void SaveSessionLayers()
Calls SdfLayer::Save on all dirty session layers and sublayers of session layers contributing to this...
static USD_API UsdStageRefPtr CreateInMemory(const std::string &identifier, const SdfLayerHandle &sessionLayer, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API UsdStageRefPtr OpenMasked(const SdfLayerHandle &rootLayer, const ArResolverContext &pathResolverContext, const UsdStagePopulationMask &mask, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API UsdObject GetObjectAtPath(const SdfPath &path) const
Return the UsdObject at path, or an invalid UsdObject if none exists.
USD_API SdfLayerHandleVector GetLayerStack(bool includeSessionLayers=true) const
includeSessionLayers is true, return the linearized strong-to-weak sublayers rooted at the stage's se...
static USD_API UsdStageRefPtr CreateNew(const std::string &identifier, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API bool IsSupportedFile(const std::string &filePath)
Indicates whether the specified file is supported by UsdStage.
static USD_API UsdStageRefPtr CreateInMemory(const std::string &identifier, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API void MuteAndUnmuteLayers(const std::vector< std::string > &muteLayers, const std::vector< std::string > &unmuteLayers)
Mute and unmute the layers identified in muteLayers and unmuteLayers.
USD_API void SetColorConfiguration(const SdfAssetPath &colorConfig) const
Sets the default color configuration to be used for querying color configuration metadata stored in a...
USD_API bool HasLocalLayer(const SdfLayerHandle &layer) const
Return true if layer is one of the layers in this stage's local, root layerStack.
USD_API void SetFramesPerSecond(double framesPerSecond) const
Sets the stage's framesPerSecond value.
static USD_API UsdStageRefPtr Open(const SdfLayerHandle &rootLayer, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool GetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, T *value) const
Resolve the requested dictionary sub-element keyPath of dictionary-valued metadatum named key,...
Definition: stage.h:2435
USD_API SdfAssetPath GetColorConfiguration() const
Returns the default color configuration stored in layer metadata.
USD_API bool SetMetadata(const TfToken &key, const VtValue &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API UsdStageRefPtr Open(const std::string &filePath, InitialLoadSet load=LoadAll)
Attempt to find a matching existing stage in a cache if UsdStageCacheContext objects exist on the sta...
USD_API void Reload()
Calls SdfLayer::Reload on all layers contributing to this stage, except session layers and sublayers ...
USD_API bool RemovePrim(const SdfPath &path)
Remove all scene description for the given path and its subtree in the current UsdEditTarget.
USD_API bool HasAuthoredTimeCodeRange() const
Returns true if the stage has both start and end timeCodes authored in the session layer or the root ...
USD_API void SetEditTarget(const UsdEditTarget &editTarget)
Set the stage's EditTarget.
USD_API UsdEditTarget GetEditTargetForLocalLayer(const SdfLayerHandle &layer)
Return a UsdEditTarget for editing the given local layer.
USD_API void SetLoadRules(UsdStageLoadRules const &rules)
Set the UsdStageLoadRules to govern payload inclusion on this stage.
USD_API void SetInterpolationType(UsdInterpolationType interpolationType)
Sets the interpolation type used during value resolution for all attributes on this stage.
bool GetMetadata(const TfToken &key, T *value) const
Return in value an authored or fallback value (if one was defined for the given metadatum) for Stage ...
Definition: stage.h:2405
static USD_API UsdStageRefPtr Open(const SdfLayerHandle &rootLayer, InitialLoadSet load=LoadAll)
Open a stage rooted at rootLayer.
static USD_API UsdStageRefPtr OpenMasked(const std::string &filePath, const ArResolverContext &pathResolverContext, UsdStagePopulationMask const &mask, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API UsdStageRefPtr Open(const std::string &filePath, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API ArResolverContext GetPathResolverContext() const
Return the path resolver context for all path resolution during composition of this stage.
USD_API TfToken GetColorManagementSystem() const
Sets the name of the color management system to be used for loading and interpreting the color config...
USD_API UsdPrimRange Traverse()
Traverse the active, loaded, defined, non-abstract prims on this stage depth-first.
UsdStageLoadRules const & GetLoadRules() const
Return the stage's current UsdStageLoadRules governing payload inclusion.
Definition: stage.h:638
static USD_API void SetGlobalVariantFallbacks(const PcpVariantFallbackMap &fallbacks)
Set the global variant fallback preferences used in new UsdStages.
static USD_API UsdStageRefPtr OpenMasked(const std::string &filePath, UsdStagePopulationMask const &mask, InitialLoadSet load=LoadAll)
Create a new stage and recursively compose prims defined within and referenced by the layer at filePa...
USD_API void Save()
Calls SdfLayer::Save on all dirty layers contributing to this stage except session layers and sublaye...
USD_API SdfPathSet FindLoadable(const SdfPath &rootPath=SdfPath::AbsoluteRootPath())
Returns an SdfPathSet of all paths that can be loaded.
USD_API bool HasMetadata(const TfToken &key) const
Returns true if the key has a meaningful value, that is, if GetMetadata() will provide a value,...
USD_API SdfLayerRefPtr Flatten(bool addSourceFileComment=true) const
Returns a single, anonymous, merged layer for this composite scene.
USD_API SdfLayerHandle GetRootLayer() const
Return this stage's root layer.
static USD_API UsdStageRefPtr OpenMasked(const SdfLayerHandle &rootLayer, const SdfLayerHandle &sessionLayer, const UsdStagePopulationMask &mask, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API UsdRelationship GetRelationshipAtPath(const SdfPath &path) const
Return the UsdAttribute at path, or an invalid UsdAttribute if none exists.
USD_API UsdPrim Load(const SdfPath &path=SdfPath::AbsoluteRootPath(), UsdLoadPolicy policy=UsdLoadWithDescendants)
Modify this stage's load rules to load the prim at path, its ancestors, and all of its descendants if...
USD_API void Unload(const SdfPath &path=SdfPath::AbsoluteRootPath())
Modify this stage's load rules to unload the prim and its descendants specified by path.
USD_API void SetStartTimeCode(double)
Sets the stage's start timeCode.
USD_API bool GetMetadata(const TfToken &key, VtValue *value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USD_API UsdStageRefPtr Open(const SdfLayerHandle &rootLayer, const SdfLayerHandle &sessionLayer, const ArResolverContext &pathResolverContext, InitialLoadSet load=LoadAll)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool ClearMetadata(const TfToken &key) const
Clear the value of stage metadatum key, if the stage's current UsdEditTarget is the root or session l...
USD_API SdfLayerHandle GetSessionLayer() const
Return this stage's root session layer.
USD_API const UsdEditTarget & GetEditTarget() const
Return the stage's EditTarget.
USD_API bool ClearMetadataByDictKey(const TfToken &key, const TfToken &keyPath) const
Clear any authored value identified by key and keyPath at the current EditTarget.
This class represents rules that govern payload inclusion on UsdStages.
This class represents a mask that may be applied to a UsdStage to limit the set of UsdPrim s it popul...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:72
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
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
VT_API std::string GetTypeName() const
Return the type name of the held typeid.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
Definition: value.h:1064
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
Definition: value.h:1104
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_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
Definition: diagnostic.h:68
UsdInterpolationType
Attribute value interpolation options.
Definition: interpolation.h:28
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
typedef std::map<std::string, std::vector<std::string>> PcpVariantFallbackMap
Definition: types.h:189
Basic Sdf data types.
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:68
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
Definition: types.h:100
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:156
std::map< double, VtValue > SdfTimeSampleMap
A map from sample times to sample values.
Definition: types.h:277