7#ifndef PXR_USD_PCP_LAYER_STACK_H
8#define PXR_USD_PCP_LAYER_STACK_H
13#include "pxr/usd/pcp/api.h"
14#include "pxr/usd/pcp/errors.h"
16#include "pxr/usd/pcp/mapExpression.h"
20#include <tbb/spin_mutex.h>
24#include <unordered_set>
27PXR_NAMESPACE_OPEN_SCOPE
34class Pcp_LayerStackRegistry;
111 return _localErrors ? *_localErrors.get() : PcpErrorVector();
123 {
return *_expressionVariables; }
128 const std::unordered_set<std::string>&
130 {
return _expressionVariableDependencies; }
215 friend class Pcp_LayerStackRegistry;
219 friend bool Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr&);
226 const Pcp_LayerStackRegistry ®istry);
229 void _BlowRelocations();
230 void _Compute(
const std::string &fileFormatTarget,
231 const Pcp_MutedLayers &mutedLayers);
234 const SdfLayerHandle & layer,
239 const std::string & sessionOwner,
240 const Pcp_MutedLayers & mutedLayers,
241 SdfLayerHandleSet *seenLayers,
242 PcpErrorVector *errors);
251 Pcp_LayerStackRegistryPtr _registry;
264 SdfLayerRefPtrVector _layers;
269 std::vector<PcpMapFunction> _mapFunctions;
273 double _timeCodesPerSecond;
284 struct _SublayerSourceInfo {
285 _SublayerSourceInfo() =
default;
287 const SdfLayerHandle& layer_,
288 const std::string& authoredSublayerPath_,
289 const std::string& computedSublayerPath_)
291 , authoredSublayerPath(authoredSublayerPath_)
292 , computedSublayerPath(computedSublayerPath_) { }
294 SdfLayerHandle layer;
295 std::string authoredSublayerPath;
296 std::string computedSublayerPath;
300 std::vector<_SublayerSourceInfo> _sublayerSourceInfo;
303 std::set<std::string> _mutedAssetPaths;
307 std::unique_ptr<PcpErrorVector> _localErrors;
320 SdfPath::FastLessThan> _RelocatesVarMap;
321 _RelocatesVarMap _relocatesVariables;
322 tbb::spin_mutex _relocatesVariablesMutex;
325 SdfPathVector _relocatesPrimPaths;
328 std::shared_ptr<PcpExpressionVariables> _expressionVariables;
331 std::unordered_set<std::string> _expressionVariableDependencies;
337std::ostream&
operator<<(std::ostream&,
const PcpLayerStackPtr&);
339std::ostream&
operator<<(std::ostream&,
const PcpLayerStackRefPtr&);
346Pcp_IsValidRelocatesEntry(
347 const SdfPath &source,
const SdfPath &target, std::string *errorMessage);
352 const std::vector<std::pair<SdfLayerHandle, SdfRelocates>> &layerRelocates,
354 PcpErrorVector *errors);
360Pcp_ComputeRelocationsForLayerStack(
366 SdfPathVector *relocatesPrimPaths,
367 PcpErrorVector *errors);
375Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpLayerStackPtr& layerStack);
381Pcp_NeedToRecomputeLayerStackTimeCodesPerSecond(
382 const PcpLayerStackPtr& layerStack,
const SdfLayerHandle &changedLayer);
392PXR_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.