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;
154 SdfPathSet _didChangeSpecsInternal;
161 SdfPathSet _didChangeSpecsAndChildrenInternal;
175 void Retain(
const PcpLayerStackRefPtr& layerStack);
185 std::set<SdfLayerRefPtr> _layers;
186 std::set<PcpLayerStackRefPtr> _layerStacks;
212 const SdfLayerChangeListVec& changes);
220 const SdfLayerHandle& layer,
221 const std::string& assetPath);
228 const SdfLayerHandle& srcLayer,
229 const std::string& assetPath);
245 const std::vector<std::string>& layersToMute,
246 const std::vector<std::string>& layersToUnmute);
255 enum ChangeSpecsType {
256 ChangeSpecsTypeRemoved,
267 const SdfLayerHandle& changedLayer,
268 const SdfPath& changedPath, ChangeSpecsType changeType);
279 PcpCacheChanges::TargetType targetType);
309 typedef std::map<PcpLayerStackPtr, PcpLayerStackChanges> LayerStackChanges;
310 typedef std::map<PcpCache*, PcpCacheChanges> CacheChanges;
334 typedef std::map<SdfPath, SdfPath> _PathEditMap;
335 typedef std::map<PcpCache*, _PathEditMap> _RenameChanges;
344 _PathEditMap& _GetRenameChanges(
const PcpCache* cache);
348 void _Optimize()
const;
358 const _PathEditMap* pathChanges);
361 enum _SublayerChangeType {
369 const SdfLayerHandle& layer,
370 const std::string& sublayerPath,
371 _SublayerChangeType changeType)
const;
376 const std::string& sublayerPath,
377 _SublayerChangeType changeType)
const;
382 void _DidChangeSublayerAndLayerStacks(
const PcpCache* cache,
383 const PcpLayerStackPtrVector& stacks,
384 const std::string& sublayerPath,
385 const SdfLayerHandle& sublayer,
386 _SublayerChangeType sublayerChange,
387 std::string* debugSummary);
391 void _DidChangeSublayer(
const PcpCache* cache,
392 const PcpLayerStackPtrVector& layerStacks,
393 const std::string& sublayerPath,
394 const SdfLayerHandle& sublayer,
395 _SublayerChangeType sublayerChange,
396 std::string* debugSummary,
401 void _DidAddOrRemoveSublayer(
const PcpCache* cache,
402 const PcpLayerStackPtrVector& layerStacks,
403 const SdfLayerHandle& layer,
404 const std::string& sublayerPath,
405 _SublayerChangeType sublayerChange,
406 std::string* debugSummary,
407 std::vector<bool> *significant);
410 void _DidChangeLayerStack(
412 const PcpLayerStackPtr& layerStack,
413 bool requiresLayerStackChange,
414 bool requiresLayerStackOffsetsChange,
415 bool requiresSignificantChange);
421 void _DidChangeLayerStackRelocations(
423 const PcpLayerStackPtr& layerStack,
424 std::string* debugSummary);
428 void _DidChangeLayerStackResolvedPath(
430 const PcpLayerStackPtr& layerStack,
431 bool requiresLayerStackChange,
432 std::string* debugSummary);
437 void _DidChangeLayerStackExpressionVariables(
439 const PcpLayerStackPtr& layerStack,
440 std::string* debugSummary);
445 void _DidChangeSpecStackInternal(
448 void _DidChangeSpecStackAndChildrenInternal(
454 void _ProcessLayerStackAndDependencyChanges(
456 const PcpLayerStackPtrVector& layerStacks);
463 void _MarkReferencingSitesAsSignificantlyChanged(
465 const PcpLayerStackPtrVector& layerStacks);
468 LayerStackChanges _layerStackChanges;
469 CacheChanges _cacheChanges;
470 _RenameChanges _renameChanges;
474PXR_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.