This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PcpLayerStack Class Reference

Represents a stack of layers that contribute opinions to composition. More...

#include <layerStack.h>

+ Inheritance diagram for PcpLayerStack:

Public Member Functions

PCP_API const PcpLayerStackIdentifierGetIdentifier () const
 Returns the identifier for this layer stack.
 
bool IsUsd () const
 Return true if this layer stack is in USD mode.
 
PCP_API const SdfLayerRefPtrVector & GetLayers () const
 Returns the layers in this layer stack in strong-to-weak order.
 
PCP_API SdfLayerHandleVector GetSessionLayers () const
 Returns only the session layers in the layer stack in strong-to-weak order.
 
PCP_API const SdfLayerTreeHandleGetLayerTree () const
 Returns the layer tree representing the structure of the non-session layers in the layer stack.
 
PCP_API const SdfLayerTreeHandleGetSessionLayerTree () const
 Returns the layer tree representing the structure of the session layers in the layer stack or null if there are no session layers.
 
PCP_API const SdfLayerOffsetGetLayerOffsetForLayer (const SdfLayerHandle &) const
 Returns the layer offset for the given layer, or NULL if the layer can't be found or is the identity.
 
PCP_API const SdfLayerOffsetGetLayerOffsetForLayer (const SdfLayerRefPtr &) const
 Return the layer offset for the given layer, or NULL if the layer can't be found or is the identity.
 
PCP_API const SdfLayerOffsetGetLayerOffsetForLayer (size_t layerIdx) const
 Returns the layer offset for the layer at the given index in this layer stack.
 
PCP_API const std::set< std::string > & GetMutedLayers () const
 Returns the set of layers that were muted in this layer stack.
 
PcpErrorVector GetLocalErrors () const
 Return the list of errors local to this layer stack.
 
PCP_API bool HasLayer (const SdfLayerHandle &layer) const
 Returns true if this layer stack contains the given layer, false otherwise.
 
PCP_API bool HasLayer (const SdfLayerRefPtr &layer) const
 
const PcpExpressionVariablesGetExpressionVariables () const
 Return the composed expression variables for this layer stack.
 
const std::unordered_set< std::string > & GetExpressionVariableDependencies () const
 Return the set of expression variables used during the computation of this layer stack.
 
double GetTimeCodesPerSecond () const
 Return the time codes per second value of the layer stack.
 
PCP_API const SdfRelocatesMapGetRelocatesSourceToTarget () const
 Returns relocation source-to-target mapping for this layer stack.
 
PCP_API const SdfRelocatesMapGetRelocatesTargetToSource () const
 Returns relocation target-to-source mapping for this layer stack.
 
PCP_API const SdfRelocatesMapGetIncrementalRelocatesSourceToTarget () const
 Returns incremental relocation source-to-target mapping for this layer stack.
 
PCP_API const SdfRelocatesMapGetIncrementalRelocatesTargetToSource () const
 Returns incremental relocation target-to-source mapping for this layer stack.
 
PCP_API const SdfPathVector & GetPathsToPrimsWithRelocates () const
 Returns a list of paths to all prims across all layers in this layer stack that contained relocates.
 
PCP_API void Apply (const PcpLayerStackChanges &changes, PcpLifeboat *lifeboat)
 Apply the changes in changes.
 
PCP_API PcpMapExpression GetExpressionForRelocatesAtPath (const SdfPath &path)
 Return a PcpMapExpression representing the relocations that affect namespace at and below the given path.
 
PCP_API bool HasRelocates () const
 Return true if there are any relocated prim paths in this layer stack.
 
- Public Member Functions inherited from TfRefBase
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object.
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object.
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 

Friends

class PcpCache
 

Additional Inherited Members

- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr) (TfRefBase const *, bool)
 
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 
- Protected Member Functions inherited from TfWeakBase
TfRefPtr< Tf_Remnant > _Register () const
 
template<class T >
TfRefPtr< Tf_Remnant > _Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Detailed Description

Represents a stack of layers that contribute opinions to composition.

Each PcpLayerStack is identified by a PcpLayerStackIdentifier. This identifier contains all of the parameters needed to construct a layer stack, such as the root layer, session layer, and path resolver context.

PcpLayerStacks are constructed and managed by a Pcp_LayerStackRegistry.

Definition at line 50 of file layerStack.h.

Member Function Documentation

◆ Apply()

PCP_API void Apply ( const PcpLayerStackChanges changes,
PcpLifeboat lifeboat 
)

Apply the changes in changes.

This blows caches. It's up to the client to pull on those caches again as needed.

Objects that are no longer needed and would be destroyed are retained in lifeboat and won't be destroyed until lifeboat is itself destroyed. This gives the client control over the timing of the destruction of those objects. Clients may choose to pull on the caches before destroying lifeboat. That may cause the caches to again retain the objects, meaning they won't be destroyed when lifeboat is destroyed.

For example, if blowing a cache means an SdfLayer is no longer needed then lifeboat will hold an SdfLayerRefPtr to that layer. The client can then pull on that cache, which could cause the cache to hold an SdfLayerRefPtr to the layer again. If so then destroying changes will not destroy the layer. In any case, we don't destroy the layer and then read it again. However, if the client destroys lifeboat before pulling on the cache then we would destroy the layer then read it again.

◆ GetExpressionForRelocatesAtPath()

PCP_API PcpMapExpression GetExpressionForRelocatesAtPath ( const SdfPath path)

Return a PcpMapExpression representing the relocations that affect namespace at and below the given path.

The value of this expression will continue to track the effective relocations if they are changed later. In USD mode only, this will return a null expression if there are no relocations on this layer stack.

◆ GetExpressionVariableDependencies()

const std::unordered_set< std::string > & GetExpressionVariableDependencies ( ) const
inline

Return the set of expression variables used during the computation of this layer stack.

For example, this may include the variables used in expression variable expressions in sublayer asset paths.

Definition at line 129 of file layerStack.h.

◆ GetExpressionVariables()

const PcpExpressionVariables & GetExpressionVariables ( ) const
inline

Return the composed expression variables for this layer stack.

Definition at line 122 of file layerStack.h.

◆ GetIdentifier()

PCP_API const PcpLayerStackIdentifier & GetIdentifier ( ) const

Returns the identifier for this layer stack.

◆ GetIncrementalRelocatesSourceToTarget()

PCP_API const SdfRelocatesMap & GetIncrementalRelocatesSourceToTarget ( ) const

Returns incremental relocation source-to-target mapping for this layer stack.

This map contains the individual relocation entries found across all layers in this layer stack; it does not combine ancestral entries with descendant entries. For instance, if this layer stack contains relocations { /A: /B } and { /A/C: /A/D }, this map will contain { /A: /B } and { /A/C: /A/D }.

◆ GetIncrementalRelocatesTargetToSource()

PCP_API const SdfRelocatesMap & GetIncrementalRelocatesTargetToSource ( ) const

Returns incremental relocation target-to-source mapping for this layer stack.

See GetIncrementalRelocatesTargetToSource for more details.

◆ GetLayerOffsetForLayer() [1/3]

PCP_API const SdfLayerOffset * GetLayerOffsetForLayer ( const SdfLayerHandle &  ) const

Returns the layer offset for the given layer, or NULL if the layer can't be found or is the identity.

◆ GetLayerOffsetForLayer() [2/3]

PCP_API const SdfLayerOffset * GetLayerOffsetForLayer ( const SdfLayerRefPtr ) const

Return the layer offset for the given layer, or NULL if the layer can't be found or is the identity.

◆ GetLayerOffsetForLayer() [3/3]

PCP_API const SdfLayerOffset * GetLayerOffsetForLayer ( size_t  layerIdx) const

Returns the layer offset for the layer at the given index in this layer stack.

Returns NULL if the offset is the identity.

◆ GetLayers()

PCP_API const SdfLayerRefPtrVector & GetLayers ( ) const

Returns the layers in this layer stack in strong-to-weak order.

Note that this is only the local layer stack – it does not include any layers brought in by references inside prims.

◆ GetLayerTree()

PCP_API const SdfLayerTreeHandle & GetLayerTree ( ) const

Returns the layer tree representing the structure of the non-session layers in the layer stack.

◆ GetLocalErrors()

PcpErrorVector GetLocalErrors ( ) const
inline

Return the list of errors local to this layer stack.

Definition at line 110 of file layerStack.h.

◆ GetMutedLayers()

PCP_API const std::set< std::string > & GetMutedLayers ( ) const

Returns the set of layers that were muted in this layer stack.

◆ GetPathsToPrimsWithRelocates()

PCP_API const SdfPathVector & GetPathsToPrimsWithRelocates ( ) const

Returns a list of paths to all prims across all layers in this layer stack that contained relocates.

◆ GetRelocatesSourceToTarget()

PCP_API const SdfRelocatesMap & GetRelocatesSourceToTarget ( ) const

Returns relocation source-to-target mapping for this layer stack.

This map combines the individual relocation entries found across all layers in this layer stack; multiple entries that affect a single prim will be combined into a single entry. For instance, if this layer stack contains relocations { /A: /B } and { /A/C: /A/D }, this map will contain { /A: /B } and { /B/C: /B/D }. This allows consumers to go from unrelocated namespace to relocated namespace in a single step.

◆ GetRelocatesTargetToSource()

PCP_API const SdfRelocatesMap & GetRelocatesTargetToSource ( ) const

Returns relocation target-to-source mapping for this layer stack.

See GetRelocatesSourceToTarget for more details.

◆ GetSessionLayers()

PCP_API SdfLayerHandleVector GetSessionLayers ( ) const

Returns only the session layers in the layer stack in strong-to-weak order.

◆ GetSessionLayerTree()

PCP_API const SdfLayerTreeHandle & GetSessionLayerTree ( ) const

Returns the layer tree representing the structure of the session layers in the layer stack or null if there are no session layers.

◆ GetTimeCodesPerSecond()

double GetTimeCodesPerSecond ( ) const
inline

Return the time codes per second value of the layer stack.

This is usually the same as the computed time codes per second of the root layer but may be computed from the session layer when its present.

Definition at line 135 of file layerStack.h.

◆ HasLayer()

PCP_API bool HasLayer ( const SdfLayerHandle &  layer) const

Returns true if this layer stack contains the given layer, false otherwise.

◆ HasRelocates()

PCP_API bool HasRelocates ( ) const

Return true if there are any relocated prim paths in this layer stack.

◆ IsUsd()

bool IsUsd ( ) const
inline

Return true if this layer stack is in USD mode.

Definition at line 64 of file layerStack.h.

Friends And Related Function Documentation

◆ PcpCache

friend class PcpCache
friend

Definition at line 217 of file layerStack.h.


The documentation for this class was generated from the following file: