7 #ifndef PXR_EXEC_ESF_USD_STAGE_DATA_H 8 #define PXR_EXEC_ESF_USD_STAGE_DATA_H 14 #include "pxr/exec/esfUsd/api.h" 18 #include "pxr/usd/sdf/path.h" 19 #include "pxr/usd/usd/notice.h" 21 #ifdef TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 22 #include <tbb/concurrent_map.h> 24 #define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 1 25 #include <tbb/concurrent_map.h> 26 #undef TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 29 #include <tbb/concurrent_unordered_map.h> 30 #include <tbb/concurrent_unordered_set.h> 31 #include <tbb/concurrent_vector.h> 37 PXR_NAMESPACE_OPEN_SCOPE
78 virtual void _DidObjectsChanged(
95 const UsdStageConstPtr &stage,
114 const UsdStageConstPtr &stage);
121 const UsdStageConstPtr &stage,
129 const UsdStageConstPtr &stage,
133 const UsdStageConstPtr &_GetStage()
const {
return _stage; }
135 const SdfPathVector &_GetOutgoingConnections(
138 SdfPathVector _GetIncomingConnections(
141 void _PopulateConnectionTables();
152 struct _PathRangeLessThan
154 using is_transparent = void;
160 bool operator()(
const SdfPath &lhs,
const _PathPrefix& rhs)
const {
161 return lhs < rhs.prefix || lhs.
HasPrefix(rhs.prefix);
166 using _OutgoingPathTable =
167 tbb::concurrent_map<SdfPath, SdfPathVector, _PathRangeLessThan>;
170 using _IncomingPathTable =
171 tbb::concurrent_unordered_map<
178 void _GetChangedConnectionTargets(
181 SdfPathVector *newConnections,
182 SdfPathVector *addedTargetPaths,
183 SdfPathVector *removedTargetPaths)
const;
191 void _UpdateForChangedAttributeConnections(
198 void _UpdateForResync(
209 void _UpdateForChangedPrim(
211 _IncomingPathTable *incomingToRemove,
218 void _UpdateForRemovedAttributes(
220 _IncomingPathTable *incomingToRemove,
221 tbb::concurrent_vector<SdfPath> *ownerAttrsToRemove)
const;
224 void _RemoveIncomingTableEntries(
225 const _IncomingPathTable &incomingToRemove);
233 const UsdStageConstPtr _stage;
236 class _NoticeListener;
237 const std::unique_ptr<_NoticeListener> _noticeListener;
240 std::vector<const ListenerBase *> _listeners;
241 mutable std::mutex _listenersMutex;
243 _OutgoingPathTable _outgoing;
245 _IncomingPathTable _incoming;
248 PXR_NAMESPACE_CLOSE_SCOPE
The base class for listeners defined by clients in order to be notified of scene changes.
ESFUSD_API void Unregister(const ListenerBase *listener)
Notifies that listener no longer needs to be informed of changes.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Standard pointer typedefs.
Class that holds data that is cached per-stage.
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
SDF_API bool HasPrefix(const SdfPath &prefix) const
Return true if both this path and prefix are not the empty path and this path has prefix as a prefix.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
A user-extensible hashing mechanism for use with runtime hash tables.
static ESFUSD_API EsfUsdStageData & GetStageData(const UsdStageConstPtr &stage)
Get the cached stage data for stage.
Notice sent in response to authored changes that affect UsdObjects.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
static ESFUSD_API const SdfPathVector & GetOutgoingConnections(const UsdStageConstPtr &stage, const SdfPath &attrPath)
Returns the paths of all objects that are targets of connections owned by the attribute at attrPath.
tbb::concurrent_unordered_set< SdfPath, TfHash > ChangedPathSet
A concurrent set of paths, used to indicate the set of targets for which incoming connections have ch...
A path value used to locate objects in layers or scenegraphs.
static ESFUSD_API std::shared_ptr< EsfUsdStageData > RegisterStage(const UsdStageConstPtr &stage, const ListenerBase *listener)
Registers stage as a stage for which cached data should be held, returning a strong reference the cli...
static ESFUSD_API SdfPathVector GetIncomingConnections(const UsdStageConstPtr &stage, const SdfPath &targetPath)
Returns the paths of all attributes that own connections that target the object at targetPath.