7#ifndef PXR_USD_USD_NOTICE_H
8#define PXR_USD_USD_NOTICE_H
11#include "pxr/usd/usd/api.h"
16#include "pxr/usd/sdf/path.h"
19PXR_NAMESPACE_OPEN_SCOPE
38 const UsdStageWeakPtr &
GetStage()
const {
return _stage; }
41 UsdStageWeakPtr _stage;
129 RenameAndReparentSource,
130 RenameAndReparentDestination,
161 using _PathsToChangesMap =
162 std::map<SdfPath, std::vector<const SdfChangeList::Entry*>>;
164 struct _PrimResyncInfo {
168 using _PrimResyncInfoMap = std::map<SdfPath, _PrimResyncInfo>;
170 struct _NamespaceEditsInfo {
171 _PrimResyncInfoMap primResyncsInfo;
175 static const _PathsToChangesMap& _GetEmptyChangesMap();
176 static const _NamespaceEditsInfo& _GetEmptyNamespaceEditsInfo();
179 ObjectsChanged(
const UsdStageWeakPtr &stage,
180 const _PathsToChangesMap *resyncChanges,
181 const _PathsToChangesMap *infoChanges,
182 const _PathsToChangesMap *assetPathChanges,
183 const _NamespaceEditsInfo *namespaceEditsInfo)
185 , _resyncChanges(resyncChanges)
186 , _infoChanges(infoChanges)
187 , _assetPathChanges(assetPathChanges)
188 , _namespaceEditsInfo(namespaceEditsInfo) {}
190 ObjectsChanged(
const UsdStageWeakPtr &stage,
191 const _PathsToChangesMap *resyncChanges);
194 USD_API ~ObjectsChanged()
override;
234 using _UnderlyingIterator = _PathsToChangesMap::const_iterator;
236 using iterator_category = std::forward_iterator_tag;
237 using value_type =
const SdfPath&;
238 using reference =
const SdfPath&;
239 using pointer =
const SdfPath*;
240 using difference_type =
241 typename _UnderlyingIterator::difference_type;
243 iterator() =
default;
244 reference operator*()
const {
return dereference(); }
245 pointer operator->()
const {
return &(dereference()); }
247 iterator& operator++() {
248 ++_underlyingIterator;
252 iterator operator++(
int) {
253 iterator result = *
this;
254 ++_underlyingIterator;
258 bool operator==(
const iterator& other)
const{
259 return _underlyingIterator == other._underlyingIterator;
262 bool operator!=(
const iterator& other)
const{
263 return _underlyingIterator != other._underlyingIterator;
276 USD_API
bool HasChangedFields()
const;
279 _UnderlyingIterator GetBase()
const {
280 return _underlyingIterator;
284 _UnderlyingIterator base()
const {
291 explicit iterator(_UnderlyingIterator baseIter)
292 : _underlyingIterator(baseIter) {}
294 inline reference dereference()
const {
295 return _underlyingIterator->first;
298 _UnderlyingIterator _underlyingIterator;
301 using const_iterator = iterator;
306 explicit operator SdfPathVector()
const {
307 return SdfPathVector(
begin(),
end());
312 return !_changes || _changes->empty();
317 return _changes ? _changes->size() : 0;
322 return iterator(_changes->cbegin());
327 return iterator(_changes->cbegin());
332 return iterator(_changes->cend());
337 return iterator(_changes->cend());
344 return const_iterator(_changes->find(path));
349 explicit PathRange(
const _PathsToChangesMap* changes)
353 const _PathsToChangesMap* _changes;
450 SdfPath *associatedPrimPath =
nullptr)
const;
457 return _namespaceEditsInfo->renamedProperties;
461 const _PathsToChangesMap *_resyncChanges;
462 const _PathsToChangesMap *_infoChanges;
463 const _PathsToChangesMap *_assetPathChanges;
464 const _NamespaceEditsInfo *_namespaceEditsInfo;
496 const std::vector<std::string>& mutedLayers,
497 const std::vector<std::string>& unmutedLayers)
499 _mutedLayers(mutedLayers),
500 _unMutedLayers(unmutedLayers) {}
519 return _unMutedLayers;
523 const std::vector<std::string>& _mutedLayers;
524 const std::vector<std::string>& _unMutedLayers;
530PXR_NAMESPACE_CLOSE_SCOPE
A path value used to locate objects in layers or scenegraphs.
The base class for objects used to notify interested parties (listeners) when events have occurred.
Notice sent after a set of layers have been newly muted or unmuted.
const std::vector< std::string > & GetMutedLayers() const
Returns the identifier of the layers that were muted.
const std::vector< std::string > & GetUnmutedLayers() const
Returns the identifier of the layers that were unmuted.
An iterable range of paths to objects that have changed.
iterator begin() const
Return iterator to the start of this range.
size_t size() const
Return the number of paths in this range.
const_iterator cbegin() const
Return iterator to the start of this range.
bool empty() const
Return true if this range contains any paths, false otherwise.
iterator end() const
Return the end iterator for this range.
const_iterator cend() const
Return the end iterator for this range.
const_iterator find(const SdfPath &path) const
Return an iterator to the specified path in this range if it exists, or end() if it does not.
Notice sent in response to authored changes that affect UsdObjects.
USD_API PathRange GetChangedInfoOnlyPaths() const
Return the set of paths that have only info changes (those that do not affect the structure of cached...
bool AffectedObject(const UsdObject &obj) const
Return true if obj was possibly affected by the layer changes that generated this notice.
USD_API TfTokenVector GetChangedFields(const UsdObject &obj) const
Return the set of changed fields in layers that affected obj.
USD_API TfTokenVector GetChangedFields(const SdfPath &path) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool ResolvedAssetPathsResynced(const UsdObject &obj) const
Return true if asset path values in obj were resynced by the layer changes that generated this notice...
USD_API PathRange GetResyncedPaths() const
Return the set of paths that are resynced in lexicographical order.
USD_API bool HasChangedFields(const UsdObject &obj) const
Return true if there are any changed fields that affected obj, false otherwise.
USD_API PrimResyncType GetPrimResyncType(const SdfPath &primPath, SdfPath *associatedPrimPath=nullptr) const
Returns the type of resync that has occurred for the prim at primPath.
USD_API bool HasChangedFields(const SdfPath &path) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API PathRange GetResolvedAssetPathsResyncedPaths() const
Return the set of paths affected by changes that may cause asset path values to resolve to different ...
USD_API bool ChangedInfoOnly(const UsdObject &obj) const
Return true if obj was changed but not resynced by the layer changes that generated this notice.
USD_API bool ResyncedObject(const UsdObject &obj) const
Return true if obj was resynced by the layer changes that generated this notice.
std::vector< std::pair< SdfPath, TfToken > > RenamedProperties
Value type holding a list of property paths that have been renamed via the UsdNamespaceEditor paired ...
const RenamedProperties & GetRenamedProperties() const
Return the list of property paths that have been renamed via a UsdNamespaceEditor ApplyEdits operatio...
PrimResyncType
A type for further classifying objects that have may have been resynced because of namespace edits.
@ UnchangedPrimStack
The UnchangedPrimStack type indicates that the resynced object still exists and is effectively unchan...
@ RenameSource
These six types indicate that a resynced object was moved to a new path, via a UsdNamespaceEditor,...
@ Invalid
Invalid indicates that the object has not been resynced.
@ Other
This type indicates all other resyncs that we cannot classify based on namespace edit information.
@ Delete
This Delete type indicates that an object has been removed from the stage without an indication that ...
Ultra-conservative notice sent when the given UsdStage's contents have changed in any way.
Notice sent when a stage's EditTarget has changed.
Base class for UsdStage notices.
const UsdStageWeakPtr & GetStage() const
Return the stage associated with this notice.
Container class for Usd notices.
Base class for Usd scenegraph objects, providing common API.
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
std::vector< TfToken > TfTokenVector
Convenience types.