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/dependency.h"
15#include "pxr/usd/pcp/errors.h"
19#include "pxr/usd/sdf/path.h"
25#include <unordered_set>
27PXR_NAMESPACE_OPEN_SCOPE
69 SdfPathVector newRelocatesPrimPaths;
70 PcpErrorVector newRelocatesErrors;
84 , _didChangeExpressionVariablesSource(false)
92 bool _didChangeExpressionVariablesSource;
105 TargetTypeConnection = 1 << 0,
106 TargetTypeRelationshipTarget = 1 << 1
139 SdfLayerChangeListVec layerChangeListVec;
145 using _ProcessedLayerSublayerPathPairsKey =
146 std::pair<SdfLayerHandle, std::string>;
148 using _LayerToLayerStacks =
149 std::unordered_map<SdfLayerHandle, PcpLayerStackPtrVector, TfHash>;
154 void _SetLayerStacksUsingLayerOverride(
155 const SdfLayerHandle& layer,
156 const PcpLayerStackPtrVector& layerStacks);
159 const PcpLayerStackPtrVector&
160 _GetLayerStacksUsingLayerOverride(
const SdfLayerHandle& layer)
const;
165 std::unordered_set<_ProcessedLayerSublayerPathPairsKey, TfHash>
166 _processedLayerSublayerPathPairs;
172 SdfPathSet _didChangeSpecsInternal;
179 SdfPathSet _didChangePrimSpecsAndChildrenInternal;
182 _LayerToLayerStacks _layerToLayerStackOverrides;
196 void Retain(
const PcpLayerStackRefPtr& layerStack);
206 std::set<SdfLayerRefPtr> _layers;
207 std::set<PcpLayerStackRefPtr> _layerStacks;
233 const SdfLayerChangeListVec& changes);
241 const SdfLayerHandle& layer,
242 const std::string& assetPath);
249 const SdfLayerHandle& srcLayer,
250 const std::string& assetPath);
266 const std::vector<std::string>& layersToMute,
267 const std::vector<std::string>& layersToUnmute);
276 enum ChangeSpecsType {
277 ChangeSpecsTypeRemoved,
288 const SdfLayerHandle& changedLayer,
289 const SdfPath& changedPath, ChangeSpecsType changeType);
300 PcpCacheChanges::TargetType targetType);
330 typedef std::map<PcpLayerStackPtr, PcpLayerStackChanges> LayerStackChanges;
331 typedef std::map<PcpCache*, PcpCacheChanges> CacheChanges;
360 const SdfLayerHandle& siteLayer,
362 PcpDependencyFlags depMask,
365 bool filterForExistingCachesOnly)
const;
372 const PcpLayerStackPtrVector&
374 const SdfLayerHandle& layer)
const;
378 typedef std::map<SdfPath, SdfPath> _PathEditMap;
379 typedef std::map<PcpCache*, _PathEditMap> _RenameChanges;
388 _PathEditMap& _GetRenameChanges(
const PcpCache* cache);
392 void _Optimize()
const;
402 const _PathEditMap* pathChanges);
405 enum _SublayerChangeType {
413 const SdfLayerHandle& layer,
414 const std::string& sublayerPath,
415 _SublayerChangeType changeType)
const;
420 const std::string& sublayerPath,
421 _SublayerChangeType changeType)
const;
426 void _DidChangeSublayerAndLayerStacks(
const PcpCache* cache,
427 const PcpLayerStackPtrVector& stacks,
428 const std::string& sublayerPath,
429 const SdfLayerHandle& sublayer,
430 _SublayerChangeType sublayerChange,
431 std::string* debugSummary);
435 void _DidChangeSublayer(
const PcpCache* cache,
436 const PcpLayerStackPtrVector& layerStacks,
437 const std::string& sublayerPath,
438 const SdfLayerHandle& sublayer,
439 _SublayerChangeType sublayerChange,
440 std::string* debugSummary,
445 void _DidAddOrRemoveSublayer(
const PcpCache* cache,
446 const PcpLayerStackPtrVector& layerStacks,
447 const SdfLayerHandle& layer,
448 const std::string& sublayerPath,
449 _SublayerChangeType sublayerChange,
450 std::string* debugSummary,
451 std::vector<bool> *significant);
454 void _DidChangeLayerStack(
456 const PcpLayerStackPtr& layerStack,
457 bool requiresLayerStackChange,
458 bool requiresLayerStackOffsetsChange,
459 bool requiresSignificantChange);
465 void _DidChangeLayerStackRelocations(
467 const PcpLayerStackPtr& layerStack,
468 std::string* debugSummary);
472 void _DidChangeLayerStackResolvedPath(
474 const PcpLayerStackPtr& layerStack,
475 bool requiresLayerStackChange,
476 std::string* debugSummary);
481 void _DidChangeLayerStackExpressionVariables(
483 const PcpLayerStackPtr& layerStack,
484 std::string* debugSummary);
489 void _DidChangeSpecStackInternal(
492 void _DidChangeSpecStackAndChildrenInternal(
498 void _ProcessLayerStackAndDependencyChanges(
500 const PcpLayerStackPtrVector& layerStacks);
507 void _MarkReferencingSitesAsSignificantlyChanged(
509 const PcpLayerStackPtrVector& layerStacks);
512 LayerStackChanges _layerStackChanges;
513 CacheChanges _cacheChanges;
514 _RenameChanges _renameChanges;
518PXR_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.
SdfPathSet didChangePrims
Must rebuild the prim indexes at each path.
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 PcpDependencyVector FindSiteDependencies(const PcpCache *cache, const SdfLayerHandle &siteLayer, const SdfPath &sitePath, PcpDependencyFlags depMask, bool recurseOnSite, bool recurseOnIndex, bool filterForExistingCachesOnly) const
Returns dependencies of the given site of scene description.
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.
PCP_API const PcpLayerStackPtrVector & FindAllLayerStacksUsingLayer(const PcpCache *cache, const SdfLayerHandle &layer) const
Returns every layer stack that includes layer.
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.