7#ifndef PXR_USD_USD_STAGE_H
8#define PXR_USD_USD_STAGE_H
13#include "pxr/usd/usd/api.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"
24#include "pxr/base/tf/hashmap.h"
25#include "pxr/base/tf/type.h"
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"
34#include "pxr/usd/pcp/cache.h"
35#include "pxr/base/vt/value.h"
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>
47#include <unordered_map>
50PXR_NAMESPACE_OPEN_SCOPE
56class Usd_AssetPathContext;
58class Usd_InstanceCache;
59class Usd_InstanceChanges;
60class Usd_InterpolatorBase;
178 static UsdStageRefPtr
183 static UsdStageRefPtr
185 const SdfLayerHandle& sessionLayer,
189 static UsdStageRefPtr
191 const SdfLayerHandle& sessionLayer,
196 static UsdStageRefPtr
219 static UsdStageRefPtr
223 static UsdStageRefPtr
228 static UsdStageRefPtr
234 static UsdStageRefPtr
236 const SdfLayerHandle &sessionLayer,
240 static UsdStageRefPtr
242 const SdfLayerHandle &sessionLayer,
262 static UsdStageRefPtr
266 static UsdStageRefPtr
267 Open(
const std::string& filePath,
289 static UsdStageRefPtr
295 static UsdStageRefPtr
330 static UsdStageRefPtr
331 Open(
const SdfLayerHandle& rootLayer,
335 static UsdStageRefPtr
336 Open(
const SdfLayerHandle& rootLayer,
337 const SdfLayerHandle& sessionLayer,
341 static UsdStageRefPtr
342 Open(
const SdfLayerHandle& rootLayer,
347 static UsdStageRefPtr
348 Open(
const SdfLayerHandle& rootLayer,
349 const SdfLayerHandle& sessionLayer,
374 static UsdStageRefPtr
380 static UsdStageRefPtr
382 const SdfLayerHandle& sessionLayer,
387 static UsdStageRefPtr
394 static UsdStageRefPtr
396 const SdfLayerHandle& sessionLayer,
656 return _populationMask;
678 Usd_PrimFlagsPredicate
const &traversalPredicate,
679 std::function<
bool (
UsdRelationship const &)>
const &relPred =
nullptr,
680 std::function<
bool (
UsdAttribute const &)>
const &attrPred =
nullptr);
687 std::function<
bool (
UsdRelationship const &)>
const &relPred =
nullptr,
688 std::function<
bool (
UsdAttribute const &)>
const &attrPred =
nullptr);
832 Usd_PrimDataConstPtr _GetPrimDataAtPath(
const SdfPath &path)
const;
833 Usd_PrimDataPtr _GetPrimDataAtPath(
const SdfPath &path);
839 _GetPrimDataAtPathOrInPrototype(
const SdfPath &path)
const;
843 _GetInstancesForPrototype(
const UsdPrim& prototype)
const;
1107 const std::vector<std::string> &unmuteLayers);
1142 bool addSourceFileComment=
true,
1155 bool addSourceFileComment=
true)
const;
1243 template<
typename T>
1275 template<
typename T>
1320 template<
typename T>
1322 const T& value)
const;
1526 TfToken *colorManagementSystem);
1544 const TfToken &colorManagementSystem);
1585 struct _IncludePayloadsPredicate;
1598 template <
class... Args>
1599 static UsdStageRefPtr _OpenImpl(
InitialLoadSet load, Args
const &... args);
1609 static UsdStageRefPtr
1620 SdfPropertySpecHandleVector
1623 std::vector<std::pair<SdfPropertySpecHandle, SdfLayerOffset>>
1624 _GetPropertyStackWithLayerOffsets(
1627 static SdfPrimSpecHandleVector
1628 _GetPrimStack(
const UsdPrim &prim);
1630 static std::vector<std::pair<SdfPrimSpecHandle, SdfLayerOffset>>
1631 _GetPrimStackWithLayerOffsets(
const UsdPrim &prim);
1634 _GetSchemaProperty(
const UsdProperty &prop)
const;
1642 SdfAttributeSpecHandle
1643 _CreateNewSpecFromSchemaAttribute(
1647 SdfRelationshipSpecHandle
1648 _CreateNewSpecFromSchemaRelationship(
1652 template <
class PropType>
1654 _CreateNewPropertySpecFromSchema(
const UsdProperty &prop);
1657 _CreatePrimSpecForEditing(
const UsdPrim& prim);
1659 template <
class PropType>
1661 _CreatePropertySpecForEditing(
const UsdProperty &prop);
1663 SdfPropertySpecHandle
1664 _CreatePropertySpecForEditing(
const UsdProperty &prop);
1666 SdfAttributeSpecHandle
1667 _CreateAttributeSpecForEditing(
const UsdAttribute &attr);
1669 SdfRelationshipSpecHandle
1675 std::pair<bool, UsdPrim>
1676 _IsValidPathForCreatingPrim(
const SdfPath &path)
const;
1681 bool _ValidateEditPrim(
const UsdPrim &prim,
const char* operation)
const;
1682 bool _ValidateEditPrimAtPath(
const SdfPath &primPath,
1683 const char* operation)
const;
1687 bool _RemoveProperty(
const SdfPath& path);
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;
1714 typename std::enable_if<!_IsEditTargetMappable<T>::value,
bool>::type
1720 typename std::enable_if<_IsEditTargetMappable<T>::value,
bool>::type
1730 bool _SetEditTargetMappedValue(
1733 TfType _GetAttributeValueType(
1744 typename std::enable_if<!_IsEditTargetMappable<T>::value,
bool>::type
1746 const TfToken &keyPath,
const T& value);
1750 typename std::enable_if<_IsEditTargetMappable<T>::value,
bool>::type
1752 const TfToken &keyPath,
const T& value);
1757 bool _SetMetadata(
const UsdObject &
object,
1763 bool _SetEditTargetMappedMetadata(
1765 const TfToken &keyPath,
const T &newValue);
1768 bool _SetMetadataImpl(
1770 const TfToken &keyPath,
const T &value);
1780 PcpCache const *_GetPcpCache()
const {
return _cache.get(); }
1781 PcpCache *_GetPcpCache() {
return _cache.get(); }
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;
1803 void _ComposePrimIndexesInParallel(
1804 const std::vector<SdfPath>& primIndexPaths,
1805 const std::string& context,
1806 Usd_InstanceChanges* instanceChanges =
nullptr);
1810 void _ComposeSubtree(
1811 Usd_PrimDataPtr prim, Usd_PrimDataConstPtr parent,
1814 void _ComposeSubtreeImpl(
1815 Usd_PrimDataPtr prim, Usd_PrimDataConstPtr parent,
1818 void _ComposeSubtreesInParallel(
1819 const std::vector<Usd_PrimDataPtr> &prims,
1820 const std::vector<SdfPath> *primIndexPaths =
nullptr);
1824 void _ComposePrimTypeInfoImpl(Usd_PrimDataPtr prim);
1829 void _ComposeChildSubtree(Usd_PrimDataPtr prim,
1830 Usd_PrimDataConstPtr parent,
1843 void _ComposeChildren(Usd_PrimDataPtr prim,
1848 Usd_PrimDataPtr _InstantiatePrim(
const SdfPath &primPath);
1852 Usd_PrimDataPtr _InstantiatePrototypePrim(
const SdfPath &primPath);
1856 void _DestroyPrim(Usd_PrimDataPtr prim);
1860 void _DestroyPrimsInParallel(
const std::vector<SdfPath>& paths);
1863 void _DestroyDescendents(Usd_PrimDataPtr prim);
1868 bool _IsObjectDescendantOfInstance(
const SdfPath& path)
const;
1872 Usd_PrimDataConstPtr _GetPrototypeForInstance(Usd_PrimDataConstPtr p)
const;
1875 SdfPath _GetPrimPathUsingPrimIndexAtPath(
const SdfPath& primIndexPath)
const;
1884 bool _ProcessChangeLists(
const SdfLayerChangeListVec &);
1893 bool _ProcessPendingChanges();
1897 bool _RemovePrim(
const SdfPath& fullPath);
1899 SdfPrimSpecHandle _GetPrimSpec(
const SdfPath& fullPath);
1906 SdfSpecType _GetDefiningSpecType(Usd_PrimDataConstPtr primData,
1907 const TfToken &propName)
const;
1913 void _Recompose(
const PcpChanges &changes, T *pathsToRecompose);
1915 void _RecomposePrims(T *pathsToRecompose);
1922 template <
class Iter>
1923 void _ComputeSubtreesToRecompose(Iter start, Iter finish,
1924 std::vector<Usd_PrimDataPtr>* recompose);
1928 bool _IsValidForLoad(
const SdfPath& path)
const;
1929 bool _IsValidForUnload(
const SdfPath& path)
const;
1939 void _DiscoverPayloads(
const SdfPath& rootPath,
1941 SdfPathSet* primIndexPaths,
1942 bool unloadedOnly =
false,
1943 SdfPathSet* usdPrimPaths =
nullptr)
const;
1954 static SdfSpecifier _GetSpecifier(Usd_PrimDataConstPtr primData);
1955 static TfToken _GetKind(Usd_PrimDataConstPtr primData);
1956 static bool _IsActive(Usd_PrimDataConstPtr primData);
1967 size_t numAssetPaths,
1968 bool anchorAssetPathsOnly =
false)
const;
1972 bool anchorAssetPathsOnly =
false)
const;
1976 size_t numTimeCodes)
const;
1978 void _MakeResolvedPathExpressions(
1981 size_t numPathExprs)
const;
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;
2012 typename std::enable_if<!_HasTypeSpecificResolution<T>::value,
bool>::type
2021 typename std::enable_if<_HasTypeSpecificResolution<T>::value,
bool>::type
2040 bool _GetStrongestResolvedMetadata(
const UsdObject &obj,
2051 bool _GetTypeSpecificResolvedMetadata(
const UsdObject &obj,
2057 template <
class Composer>
2061 Composer *composer)
const;
2063 template <
class Composer>
2066 Composer *composer)
const;
2068 template <
class Composer>
2071 Composer *composer)
const;
2073 template <
class Composer>
2074 bool _GetSpecialPropMetadataImpl(
const UsdObject &obj,
2078 Composer *composer)
const;
2079 template <
class Composer>
2080 bool _GetMetadataImpl(
const UsdObject &obj,
2083 bool includeFallbacks,
2084 Composer *composer)
const;
2086 template <
class Composer>
2087 bool _GetGeneralMetadataImpl(
const UsdObject &obj,
2090 bool includeFallbacks,
2091 Composer *composer)
const;
2097 const TfToken &keyPath,
bool useFallbacks)
const;
2100 _ListMetadataFields(
const UsdObject &obj,
bool useFallbacks)
const;
2102 void _GetAllMetadata(
const UsdObject &obj,
2104 UsdMetadataValueMap* result,
2105 bool anchorAssetPathsOnly =
false)
const;
2115 void _GetResolveInfoWithResolveTarget(
2121 template <
class T>
struct _ExtraResolveInfo;
2132 _ExtraResolveInfo<T> *extraInfo =
nullptr)
const;
2141 void _GetResolveInfoWithResolveTarget(
2146 _ExtraResolveInfo<T> *extraInfo =
nullptr)
const;
2153 template <
class T,
class MakeUsdResolverFn>
2157 _ExtraResolveInfo<T> *extraInfo,
2158 const MakeUsdResolverFn &makeUsdResolveFn)
const;
2160 template <
class T>
struct _ResolveInfoResolver;
2161 struct _PropertyStackResolver;
2163 template <
class Resolver,
class MakeUsdResolverFn>
2164 void _GetResolvedValueAtDefaultImpl(
2167 const MakeUsdResolverFn &makeUsdResolverFn)
const;
2169 template <
class Resolver,
class MakeUsdResolverFn>
2170 void _GetResolvedValueAtTimeImpl(
2174 const MakeUsdResolverFn &makeUsdResolverFn)
const;
2185 Usd_InterpolatorBase* interpolator,
2202 Usd_InterpolatorBase* interpolator,
2206 bool _GetDefaultValueFromResolveInfoImpl(
const UsdResolveInfo &info,
2210 Usd_AssetPathContext
2223 bool _GetTimeSamplesInInterval(
const UsdAttribute &attr,
2225 std::vector<double>* times)
const;
2227 bool _GetTimeSamplesInIntervalFromResolveInfo(
2231 std::vector<double>* times)
const;
2233 size_t _GetNumTimeSamples(
const UsdAttribute &attr)
const;
2235 size_t _GetNumTimeSamplesFromResolveInfo(
const UsdResolveInfo &info,
2241 bool _GetBracketingTimeSamples(
const UsdAttribute &attr,
2246 bool* hasSamples)
const;
2248 bool _GetBracketingTimeSamplesFromResolveInfo(
const UsdResolveInfo &info,
2254 bool* hasSamples)
const;
2256 bool _ValueMightBeTimeVarying(
const UsdAttribute &attr)
const;
2258 bool _ValueMightBeTimeVaryingFromResolveInfo(
const UsdResolveInfo &info,
2261 void _RegisterPerLayerNotices();
2262 void _RegisterResolverChangeNotice();
2265 inline char const *_GetMallocTagId()
const;
2268 class _PendingChanges;
2275 class _NamespaceEditsChangeBlock {
2282 struct ExpectedNamespaceEditChange {
2285 SdfPrimSpecHandleVector oldPrimStack;
2287 using ExpectedNamespaceEditChangeVector =
2288 std::vector<ExpectedNamespaceEditChange>;
2290 _NamespaceEditsChangeBlock(
const UsdStagePtr &stage,
2291 ExpectedNamespaceEditChangeVector &&expectedChanges);
2292 _NamespaceEditsChangeBlock(_NamespaceEditsChangeBlock &&);
2293 ~_NamespaceEditsChangeBlock();
2297 std::unique_ptr<_PendingChanges> _localPendingChanges;
2301 Usd_PrimDataPtr _pseudoRoot;
2312 bool _editTargetIsLocalLayer;
2314 std::unique_ptr<PcpCache> _cache;
2315 std::unique_ptr<Usd_ClipCache> _clipCache;
2316 std::unique_ptr<Usd_InstanceCache> _instanceCache;
2318 TfHashMap<TfToken, TfToken, TfHash> _invalidPrimTypeToFallbackMap;
2320 size_t _usedLayersRevision;
2327 inline size_t hash(
SdfPath const &path)
const {
2328 return path.GetHash();
2331 using PathToNodeMap = tbb::concurrent_hash_map<
2333 PathToNodeMap _primMap;
2338 typedef std::vector<
2339 std::pair<SdfLayerHandle, TfNotice::Key> > _LayerAndNoticeKeyVec;
2340 _LayerAndNoticeKeyVec _layersAndNoticeKeys;
2341 size_t _lastChangeSerialNumber;
2346 _PendingChanges* _pendingChanges;
2348 std::optional<WorkDispatcher> _dispatcher;
2352 std::unique_ptr<std::string> _mallocTagID;
2363 bool _isClosingStage;
2364 bool _isWritingFallbackPrimTypes;
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;
2397UsdStage::_GetTypeSpecificResolvedMetadata(
const UsdObject &obj,
2417 " match retrieved type %s",
2418 ArchGetDemangled<T>().c_str(),
2447 TF_CODING_ERROR(
"Requested type %s for stage metadatum %s[%s] does not"
2448 " match retrieved type %s",
2449 ArchGetDemangled<T>().c_str(),
2460 const T& value)
const
2468typename std::enable_if<
2469 !UsdStage::_HasTypeSpecificResolution<T>::value,
bool>::type
2470UsdStage::_GetMetadata(
const UsdObject &obj,
2479 return _GetStrongestResolvedMetadata(
2480 obj, fieldName, keyPath, useFallbacks, &out);
2485typename std::enable_if<
2486 UsdStage::_HasTypeSpecificResolution<T>::value,
bool>::type
2487UsdStage::_GetMetadata(
const UsdObject &obj,
2495 return _GetTypeSpecificResolvedMetadata(
2496 obj, fieldName, keyPath, useFallbacks, result);
2502typename std::enable_if<!UsdStage::_IsEditTargetMappable<T>::value,
bool>::type
2504 const TfToken &keyPath,
const T& value)
2509 return _SetMetadataImpl<SdfAbstractDataConstValue>(
2510 object, key, keyPath, in);
2515typename std::enable_if<UsdStage::_IsEditTargetMappable<T>::value,
bool>::type
2517 const TfToken &keyPath,
const T& value)
2519 return _SetEditTargetMappedMetadata(
object, key, keyPath, value);
2522PXR_NAMESPACE_CLOSE_SCOPE
Notice sent when asset paths may resolve to a different path than before due to a change in the resol...
An asset resolver context allows clients to provide additional data to the resolver for use during re...
A basic mathematical interval class.
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
The fully-typed container for a field value in an SdfAbstractData.
The fully-typed container for a field value in an SdfAbstractData.
A type-erased container for a field value in an SdfAbstractData.
Contains an asset path and optional evaluated and resolved paths.
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...
std::map< std::string, std::string > FileFormatArguments
Type for specifying additional file format-specific arguments to layer API.
Notice sent per-layer indicating all layers whose contents have changed within a single round of chan...
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.
static SDF_API const SdfPath & AbsoluteRootPath()
The absolute path representing the top of the namespace hierarchy.
Value type that represents a time code.
Stores a pointer to a ValueType which uses TfDelegatedCountIncrement and TfDelegatedCountDecrement to...
Handle-object returned by TfNotice::Register().
Enable a concrete base class for use with TfRefPtr.
Token for efficient comparison, assignment, and hashing of known strings.
char const * GetText() const
Return the text that this token represents.
TfType represents a dynamic runtime type.
Enable a concrete base class for use with TfWeakPtr.
A mathematical description of a curved function from time to value.
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
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...
A proxy class for applying listOp edits to the inherit paths list for a prim.
Base class for Usd scenegraph objects, providing common API.
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 ...
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Container for information about the source of an attribute's value, i.e.
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
A proxy class for applying listOp edits to the specializes list for a prim.
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
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...
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.
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.
@ LoadAll
Load all loadable prims.
@ LoadNone
Load no loadable prims.
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.
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,...
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 ...
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.
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...
A UsdVariantSet represents a single VariantSet in USD (e.g.
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
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.
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
UsdLoadPolicy
Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or not descendant prims are ...
@ UsdLoadWithDescendants
Load a prim plus all its descendants.
Standard pointer typedefs.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
UsdInterpolationType
Attribute value interpolation options.
std::vector< TfToken > TfTokenVector
Convenience types.
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
typedef std::map<std::string, std::vector<std::string>> PcpVariantFallbackMap
SdfSpecType
An enum that specifies the type of an object.
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
SdfVariability
An enum that identifies variability types for attributes.
std::map< double, VtValue > SdfTimeSampleMap
A map from sample times to sample values.