24 #ifndef PXR_USD_IMAGING_USD_IMAGING_STAGE_SCENE_INDEX_H 25 #define PXR_USD_IMAGING_USD_IMAGING_STAGE_SCENE_INDEX_H 29 #include "pxr/usdImaging/usdImaging/api.h" 30 #include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h" 32 #include "pxr/imaging/hd/sceneIndex.h" 34 #include "pxr/usd/usd/notice.h" 37 #include <tbb/concurrent_hash_map.h> 38 #include <tbb/concurrent_unordered_map.h> 40 PXR_NAMESPACE_OPEN_SCOPE
43 using UsdImagingPrimAdapterSharedPtr = std::shared_ptr<UsdImagingPrimAdapter>;
46 using UsdImagingAPISchemaAdapterSharedPtr =
47 std::shared_ptr<UsdImagingAPISchemaAdapter>;
50 class UsdImagingStageSceneIndex;
57 static UsdImagingStageSceneIndexRefPtr New() {
58 return TfCreateRefPtr(
new UsdImagingStageSceneIndex());
62 ~UsdImagingStageSceneIndex();
79 void SetStage(UsdStageRefPtr stage);
99 void ApplyPendingUpdates();
103 UsdImagingStageSceneIndex();
105 Usd_PrimFlagsConjunction _GetTraversalPredicate()
const;
107 using _APISchemaEntry =
108 std::pair<UsdImagingAPISchemaAdapterSharedPtr, TfToken>;
113 _APISchemaAdapters _AdapterSetLookup(
UsdPrim prim,
116 UsdImagingPrimAdapterSharedPtr *outputPrimAdapter=
nullptr)
const;
118 UsdImagingAPISchemaAdapterSharedPtr _APIAdapterLookup(
119 const TfToken &adapterKey)
const;
121 UsdImagingPrimAdapterSharedPtr _PrimAdapterLookup(
122 const TfToken &adapterKey)
const;
125 UsdPrim const& prim,
const _APISchemaAdapters &adapters)
const;
127 TfToken _GetImagingSubprimType(
128 const _APISchemaAdapters &adapters,
132 HdContainerDataSourceHandle _GetImagingSubprimData(
133 const _APISchemaAdapters &adapters,
137 const _APISchemaAdapters &adapters,
141 void _ApplyPendingResyncs();
147 void FlagAsTimeVarying(
159 struct _PathHashCompare {
163 static size_t hash(
const SdfPath &p) {
167 using _VariabilityMap = tbb::concurrent_hash_map<
SdfPath,
169 mutable _VariabilityMap _timeVaryingLocators;
174 UsdStageRefPtr _stage;
175 _StageGlobals _stageGlobals;
178 void _Populate(
UsdPrim subtreeRoot);
182 UsdStageWeakPtr
const& sender);
186 SdfPathVector _usdPrimsToResync;
188 std::map<SdfPath, TfTokenVector> _usdPropertiesToUpdate;
193 using _PrimAdapterMap = tbb::concurrent_unordered_map<
196 mutable _PrimAdapterMap _primAdapterMap;
198 using _ApiAdapterMap = tbb::concurrent_unordered_map<
201 mutable _ApiAdapterMap _apiAdapterMap;
203 struct _AdapterSetEntry
206 _APISchemaAdapters allAdapters;
209 UsdImagingPrimAdapterSharedPtr primAdapter;
214 using _AdapterSetMap = tbb::concurrent_unordered_map<
217 mutable _AdapterSetMap _adapterSetMap;
220 using _PrimAdapterPair = std::pair<UsdPrim, UsdImagingPrimAdapterSharedPtr>;
221 _PrimAdapterPair _FindResponsibleAncestor(
const UsdPrim &prim);
225 PXR_NAMESPACE_CLOSE_SCOPE
Handle-object returned by TfNotice::Register().
virtual HdSceneIndexPrim GetPrim(const SdfPath &primPath) const =0
Returns a pair of (prim type, datasource) for the object at primPath.
Base class for all API schema adapters.
A user-extensible hashing mechanism for use with runtime hash tables.
Small struct representing a 'prim' in the Hydra scene index.
Token for efficient comparison, assignment, and hashing of known strings.
virtual SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const =0
Returns the paths of all scene index prims located immediately below primPath.
Represents an object that can identify the location of a data source.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
This class is used as a context object with global stage information, that gets passed down to dataso...
Base class for all PrimAdapters.
Notice sent in response to authored changes that affect UsdObjects.
Abstract interface to scene data.
Represents a set of data source locators closed under descendancy.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
std::vector< TfToken > TfTokenVector
Convenience types.
A path value used to locate objects in layers or scenegraphs.
Class that holds the full type information for a prim.
size_t hash_value(const half h)
Overload hash_value for half.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.