24#ifndef PXR_USD_PCP_LAYER_STACK_H
25#define PXR_USD_PCP_LAYER_STACK_H
30#include "pxr/usd/pcp/api.h"
31#include "pxr/usd/pcp/errors.h"
33#include "pxr/usd/pcp/mapExpression.h"
37#include <tbb/spin_mutex.h>
41#include <unordered_set>
44PXR_NAMESPACE_OPEN_SCOPE
51class Pcp_LayerStackRegistry;
128 return _localErrors ? *_localErrors.get() : PcpErrorVector();
140 {
return *_expressionVariables; }
145 const std::unordered_set<std::string>&
147 {
return _expressionVariableDependencies; }
231 friend class Pcp_LayerStackRegistry;
235 friend bool Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr&);
242 const Pcp_LayerStackRegistry ®istry);
245 void _BlowRelocations();
246 void _Compute(
const std::string &fileFormatTarget,
247 const Pcp_MutedLayers &mutedLayers);
250 const SdfLayerHandle & layer,
255 const std::string & sessionOwner,
256 const Pcp_MutedLayers & mutedLayers,
257 SdfLayerHandleSet *seenLayers,
258 PcpErrorVector *errors);
267 Pcp_LayerStackRegistryPtr _registry;
280 SdfLayerRefPtrVector _layers;
285 std::vector<PcpMapFunction> _mapFunctions;
289 double _timeCodesPerSecond;
300 struct _SublayerSourceInfo {
301 _SublayerSourceInfo() =
default;
303 const SdfLayerHandle& layer_,
304 const std::string& authoredSublayerPath_,
305 const std::string& computedSublayerPath_)
307 , authoredSublayerPath(authoredSublayerPath_)
308 , computedSublayerPath(computedSublayerPath_) { }
310 SdfLayerHandle layer;
311 std::string authoredSublayerPath;
312 std::string computedSublayerPath;
316 std::vector<_SublayerSourceInfo> _sublayerSourceInfo;
319 std::set<std::string> _mutedAssetPaths;
323 std::unique_ptr<PcpErrorVector> _localErrors;
336 SdfPath::FastLessThan> _RelocatesVarMap;
337 _RelocatesVarMap _relocatesVariables;
338 tbb::spin_mutex _relocatesVariablesMutex;
341 SdfPathVector _relocatesPrimPaths;
344 std::shared_ptr<PcpExpressionVariables> _expressionVariables;
347 std::unordered_set<std::string> _expressionVariableDependencies;
353std::ostream&
operator<<(std::ostream&,
const PcpLayerStackPtr&);
355std::ostream&
operator<<(std::ostream&,
const PcpLayerStackRefPtr&);
361Pcp_ComputeRelocationsForLayerStack(
367 SdfPathVector *relocatesPrimPaths,
368 PcpErrorVector *errors);
376Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr& layerStack);
382Pcp_NeedToRecomputeLayerStackTimeCodesPerSecond(
383 const PcpLayerStackPtr& layerStack,
const SdfLayerHandle &changedLayer);
393PXR_NAMESPACE_CLOSE_SCOPE
An asset resolver context allows clients to provide additional data to the resolver for use during re...
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Object containing composed expression variables associated with a given layer stack,...
Types of changes per layer stack.
Represents a stack of layers that contribute opinions to composition.
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.
PCP_API void Apply(const PcpLayerStackChanges &changes, PcpLifeboat *lifeboat)
Apply the changes in changes.
double GetTimeCodesPerSecond() const
Return the time codes per second value of the layer stack.
PCP_API bool HasLayer(const SdfLayerHandle &layer) const
Returns true if this layer stack contains the given layer, false otherwise.
PCP_API SdfLayerHandleVector GetSessionLayers() const
Returns only the session layers in the layer stack in strong-to-weak order.
PCP_API bool HasRelocates() const
Return true if there are any relocated prim paths in this layer stack.
PCP_API const SdfLayerTreeHandle & GetSessionLayerTree() const
Returns the layer tree representing the structure of the session layers in the layer stack or null if...
PCP_API const SdfPathVector & GetPathsToPrimsWithRelocates() const
Returns a list of paths to all prims across all layers in this layer stack that contained relocates.
const std::unordered_set< std::string > & GetExpressionVariableDependencies() const
Return the set of expression variables used during the computation of this layer stack.
const PcpExpressionVariables & GetExpressionVariables() const
Return the composed expression variables for this layer stack.
PCP_API const std::set< std::string > & GetMutedLayers() const
Returns the set of layers that were muted in this layer stack.
PCP_API const SdfLayerTreeHandle & GetLayerTree() const
Returns the layer tree representing the structure of the non-session layers in the layer stack.
bool IsUsd() const
Return true if this layer stack is in USD mode.
PCP_API const PcpLayerStackIdentifier & GetIdentifier() const
Returns the identifier for this layer stack.
PCP_API const SdfRelocatesMap & GetRelocatesSourceToTarget() const
Returns relocation source-to-target mapping for this layer stack.
PCP_API PcpMapExpression GetExpressionForRelocatesAtPath(const SdfPath &path)
Return a PcpMapExpression representing the relocations that affect namespace at and below the given p...
PcpErrorVector GetLocalErrors() const
Return the list of errors local to this layer stack.
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.
PCP_API const SdfRelocatesMap & GetIncrementalRelocatesTargetToSource() const
Returns incremental relocation target-to-source mapping for this layer stack.
PCP_API const SdfLayerRefPtrVector & GetLayers() const
Returns the layers in this layer stack in strong-to-weak order.
PCP_API const SdfLayerOffset * GetLayerOffsetForLayer(size_t layerIdx) const
Returns the layer offset for the layer at the given index in this layer stack.
PCP_API const SdfRelocatesMap & GetIncrementalRelocatesSourceToTarget() const
Returns incremental relocation source-to-target mapping for this layer stack.
PCP_API const SdfRelocatesMap & GetRelocatesTargetToSource() const
Returns relocation target-to-source mapping for this layer stack.
Arguments used to identify a layer stack.
Structure used to temporarily retain layers and layerStacks within a code block.
An expression that yields a PcpMapFunction value.
std::unique_ptr< Variable > VariableUniquePtr
Variables are held by reference.
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.
Represents a time offset and scale between layers.
A path value used to locate objects in layers or scenegraphs.
Enable a concrete base class for use with TfRefPtr.
Enable a concrete base class for use with TfWeakPtr.
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
PCP_API bool PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled()
Returns true when the environment variable has been set to disable the behavior where differing time ...
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.