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;
118 return _localErrors ? *_localErrors.get() : PcpErrorVector();
130 {
return *_expressionVariables; }
135 const std::unordered_set<std::string>&
137 {
return _expressionVariableDependencies; }
216 friend class Pcp_LayerStackRegistry;
220 friend bool Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr&);
227 const Pcp_LayerStackRegistry ®istry);
230 void _BlowRelocations();
231 void _Compute(
const std::string &fileFormatTarget,
232 const Pcp_MutedLayers &mutedLayers);
235 const SdfLayerHandle & layer,
240 const std::string & sessionOwner,
241 const Pcp_MutedLayers & mutedLayers,
242 SdfLayerHandleSet *seenLayers,
243 PcpErrorVector *errors);
252 Pcp_LayerStackRegistryPtr _registry;
265 SdfLayerRefPtrVector _layers;
270 std::vector<PcpMapFunction> _mapFunctions;
274 double _timeCodesPerSecond;
281 struct _SublayerSourceInfo {
282 _SublayerSourceInfo() =
default;
284 const SdfLayerHandle& layer_,
285 const std::string& authoredSublayerPath_,
286 const std::string& computedSublayerPath_)
288 , authoredSublayerPath(authoredSublayerPath_)
289 , computedSublayerPath(computedSublayerPath_) { }
291 SdfLayerHandle layer;
292 std::string authoredSublayerPath;
293 std::string computedSublayerPath;
297 std::vector<_SublayerSourceInfo> _sublayerSourceInfo;
300 std::set<std::string> _mutedAssetPaths;
304 std::unique_ptr<PcpErrorVector> _localErrors;
317 SdfPath::FastLessThan> _RelocatesVarMap;
318 _RelocatesVarMap _relocatesVariables;
319 tbb::spin_mutex _relocatesVariablesMutex;
322 SdfPathVector _relocatesPrimPaths;
325 std::shared_ptr<PcpExpressionVariables> _expressionVariables;
328 std::unordered_set<std::string> _expressionVariableDependencies;
334std::ostream&
operator<<(std::ostream&,
const PcpLayerStackPtr&);
336std::ostream&
operator<<(std::ostream&,
const PcpLayerStackRefPtr&);
342Pcp_ComputeRelocationsForLayerStack(
343 const SdfLayerRefPtrVector & layers,
348 SdfPathVector *relocatesPrimPaths);
356Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr& layerStack);
362Pcp_NeedToRecomputeLayerStackTimeCodesPerSecond(
363 const PcpLayerStackPtr& layerStack,
const SdfLayerHandle &changedLayer);
373PXR_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 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 this layer stack.
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.