7#ifndef PXR_USD_PCP_CHANGES_H
8#define PXR_USD_PCP_CHANGES_H
13#include "pxr/usd/pcp/api.h"
14#include "pxr/usd/pcp/errors.h"
18#include "pxr/usd/sdf/path.h"
24#include <unordered_set>
26PXR_NAMESPACE_OPEN_SCOPE
68 SdfPathVector newRelocatesPrimPaths;
69 PcpErrorVector newRelocatesErrors;
83 , _didChangeExpressionVariablesSource(false)
91 bool _didChangeExpressionVariablesSource;
104 TargetTypeConnection = 1 << 0,
105 TargetTypeRelationshipTarget = 1 << 1
144 SdfLayerChangeListVec layerChangeListVec;
150 using _ProcessedLayerSublayerPathPairsKey =
151 std::pair<SdfLayerHandle, std::string>;
156 std::unordered_set<_ProcessedLayerSublayerPathPairsKey, TfHash>
157 _processedLayerSublayerPathPairs;
163 SdfPathSet _didChangeSpecsInternal;
170 SdfPathSet _didChangePrimSpecsAndChildrenInternal;
184 void Retain(
const PcpLayerStackRefPtr& layerStack);
194 std::set<SdfLayerRefPtr> _layers;
195 std::set<PcpLayerStackRefPtr> _layerStacks;
221 const SdfLayerChangeListVec& changes);
229 const SdfLayerHandle& layer,
230 const std::string& assetPath);
237 const SdfLayerHandle& srcLayer,
238 const std::string& assetPath);
254 const std::vector<std::string>& layersToMute,
255 const std::vector<std::string>& layersToUnmute);
264 enum ChangeSpecsType {
265 ChangeSpecsTypeRemoved,
276 const SdfLayerHandle& changedLayer,
277 const SdfPath& changedPath, ChangeSpecsType changeType);
288 PcpCacheChanges::TargetType targetType);
318 typedef std::map<PcpLayerStackPtr, PcpLayerStackChanges> LayerStackChanges;
319 typedef std::map<PcpCache*, PcpCacheChanges> CacheChanges;
343 typedef std::map<SdfPath, SdfPath> _PathEditMap;
344 typedef std::map<PcpCache*, _PathEditMap> _RenameChanges;
353 _PathEditMap& _GetRenameChanges(
const PcpCache* cache);
357 void _Optimize()
const;
367 const _PathEditMap* pathChanges);
370 enum _SublayerChangeType {
378 const SdfLayerHandle& layer,
379 const std::string& sublayerPath,
380 _SublayerChangeType changeType)
const;
385 const std::string& sublayerPath,
386 _SublayerChangeType changeType)
const;
391 void _DidChangeSublayerAndLayerStacks(
const PcpCache* cache,
392 const PcpLayerStackPtrVector& stacks,
393 const std::string& sublayerPath,
394 const SdfLayerHandle& sublayer,
395 _SublayerChangeType sublayerChange,
396 std::string* debugSummary);
400 void _DidChangeSublayer(
const PcpCache* cache,
401 const PcpLayerStackPtrVector& layerStacks,
402 const std::string& sublayerPath,
403 const SdfLayerHandle& sublayer,
404 _SublayerChangeType sublayerChange,
405 std::string* debugSummary,
410 void _DidAddOrRemoveSublayer(
const PcpCache* cache,
411 const PcpLayerStackPtrVector& layerStacks,
412 const SdfLayerHandle& layer,
413 const std::string& sublayerPath,
414 _SublayerChangeType sublayerChange,
415 std::string* debugSummary,
416 std::vector<bool> *significant);
419 void _DidChangeLayerStack(
421 const PcpLayerStackPtr& layerStack,
422 bool requiresLayerStackChange,
423 bool requiresLayerStackOffsetsChange,
424 bool requiresSignificantChange);
430 void _DidChangeLayerStackRelocations(
432 const PcpLayerStackPtr& layerStack,
433 std::string* debugSummary);
437 void _DidChangeLayerStackResolvedPath(
439 const PcpLayerStackPtr& layerStack,
440 bool requiresLayerStackChange,
441 std::string* debugSummary);
446 void _DidChangeLayerStackExpressionVariables(
448 const PcpLayerStackPtr& layerStack,
449 std::string* debugSummary);
454 void _DidChangeSpecStackInternal(
457 void _DidChangeSpecStackAndChildrenInternal(
463 void _ProcessLayerStackAndDependencyChanges(
465 const PcpLayerStackPtrVector& layerStacks);
472 void _MarkReferencingSitesAsSignificantlyChanged(
474 const PcpLayerStackPtrVector& layerStacks);
477 LayerStackChanges _layerStackChanges;
478 CacheChanges _cacheChanges;
479 _RenameChanges _renameChanges;
483PXR_NAMESPACE_CLOSE_SCOPE
Types of changes per cache.
std::vector< std::pair< SdfPath, SdfPath > > didChangePath
Must update the path on every namespace object at and below each given path.
bool didMuteOrUnmuteNonEmptyLayer
Will be true if a muting operation took place on a non empty layer.
SdfPathSet didChangePrims
Must rebuild the prim indexes at each path.
bool didAddOrRemoveNonEmptySublayer
Will be true if a non empty sublayer was added or removed.
SdfPathSet didChangeSpecs
Must rebuild the prim/property stacks at each path.
std::unordered_set< SdfLayerHandle, TfHash > layersAffectedByMutingOrRemoval
Set of layers that were explicitly muted or removed from a sublayer list and all sublayers of those l...
SdfPathSet didChangeSignificantly
Must rebuild the indexes at and below each path.
bool didMaybeChangeLayers
Layers used in the composition may have changed.
std::map< SdfPath, int, SdfPath::FastLessThan > didChangeTargets
Must rebuild the connections/targets at each path.
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
PCP_API void DidChangeSignificantly(const PcpCache *cache, const SdfPath &path)
The object at path changed significantly enough to require recomputing the entire prim or property in...
PCP_API void DidChangeSpecs(const PcpCache *cache, const SdfPath &path, const SdfLayerHandle &changedLayer, const SdfPath &changedPath, ChangeSpecsType changeType)
The spec stack for the prim or property has changed, due to the addition or removal of the spec in ch...
PCP_API void DidChangeAssetResolver(const PcpCache *cache)
The asset resolver has changed, invalidating previously-resolved asset paths.
PCP_API bool IsEmpty() const
Returns true iff there are no changes.
PCP_API void _DidMuteLayer(const PcpCache *cache, const std::string &layerId)
The layer identified by layerId was muted in cache.
PCP_API void DidMaybeFixSublayer(const PcpCache *cache, const SdfLayerHandle &layer, const std::string &assetPath)
Tries to load the sublayer of layer at sublayerPath.
PCP_API void DidChangePaths(const PcpCache *cache, const SdfPath &oldPath, const SdfPath &newPath)
The composed object at oldPath was moved to newPath.
PCP_API void DidChangeSpecStack(const PcpCache *cache, const SdfPath &path)
The spec stack for the prim or property at path in cache has changed.
PCP_API void Apply() const
Applies the changes to the layer stacks and caches.
PCP_API const CacheChanges & GetCacheChanges() const
Returns a map of all of the cache changes.
PCP_API void DidMaybeFixAsset(const PcpCache *cache, const PcpSite &site, const SdfLayerHandle &srcLayer, const std::string &assetPath)
Tries to load the asset at assetPath.
PCP_API void DidChangeTargets(const PcpCache *cache, const SdfPath &path, PcpCacheChanges::TargetType targetType)
The connections on the attribute or targets on the relationship have changed.
PCP_API void _DidUnmuteLayer(const PcpCache *cache, const std::string &layerId)
The layer identified by layerId was unmuted in cache.
PCP_API const LayerStackChanges & GetLayerStackChanges() const
Returns a map of all of the layer stack changes.
PCP_API void Swap(PcpChanges &other)
Swap the contents of this and other.
PCP_API const PcpLifeboat & GetLifeboat() const
Returns the lifeboat responsible for maintaining the lifetime of layers and layer stacks during chang...
PCP_API void DidChange(const PcpCache *cache, const SdfLayerChangeListVec &changes)
Breaks down changes into individual changes on cache.
void DidMuteAndUnmuteLayers(const PcpCache *cache, const std::vector< std::string > &layersToMute, const std::vector< std::string > &layersToUnmute)
Sets the list of layers that will ultimately be muted and unmuted for this round of changes.
PCP_API void DidDestroyCache(const PcpCache *cache)
Remove any changes for cache.
Represents the layer stack associated with a set of expression variables.
Types of changes per layer stack.
SdfRelocatesMap newRelocatesTargetToSource
New relocation maps for this layer stack.
bool didChangeLayers
Must rebuild the layer tree. Implies didChangeLayerOffsets.
bool didChangeExpressionVariables
Must rebuild expression variables.
VtDictionary newExpressionVariables
New expression variables for this layer stack.
bool didChangeLayerOffsets
Must rebuild the layer offsets.
bool didChangeSignificantly
A significant layer stack change means the composed opinions of the layer stack may have changed in a...
SdfPathSet pathsAffectedByRelocationChanges
Paths that are affected by the above relocation changes.
bool didChangeRelocates
Must rebuild the relocation tables.
Represents a stack of layers that contribute opinions to composition.
Structure used to temporarily retain layers and layerStacks within a code block.
void Retain(const PcpLayerStackRefPtr &layerStack)
Ensure that layerStack exists until this object is destroyed.
void Swap(PcpLifeboat &other)
Swap the contents of this and other.
void Retain(const SdfLayerRefPtr &layer)
Ensure that layer exists until this object is destroyed.
const std::set< PcpLayerStackRefPtr > & GetLayerStacks() const
Returns reference to the set of layer stacks currently being held in the lifeboat.
A site specifies a path in a layer stack of scene description.
A scene description container that can combine with other such containers to form simple component as...
A path value used to locate objects in layers or scenegraphs.
A map with string keys and VtValue values.
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.