HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sceneIndexPrimAdapter.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_IMAGING_USD_IMAGING_SCENE_INDEX_PRIM_ADAPTER_H
8 #define PXR_USD_IMAGING_USD_IMAGING_SCENE_INDEX_PRIM_ADAPTER_H
9 
10 #include "pxr/pxr.h"
13 
15 
16 /// \class UsdImagingSceneIndexPrimAdapter
17 ///
18 /// The base class prim adapter for scene index support. Note that while the
19 /// plugin system uses UsdImagingPrimAdapter, that class is overloaded with
20 /// functionality for both UsdImagingStageSceneIndex and UsdImagingDelegate,
21 /// and (e.g.) has a bunch of pure virtual functions that are only relevant
22 /// to UsdImagingDelegate.
23 ///
24 /// Pure scene index prim types should consider this the base class, and only
25 /// use API defined here.
26 ///
28 {
29 public:
31 
34 
37 
38  // ---------------------------------------------------------------------- //
39  /// \name Scene Index Support
40  // ---------------------------------------------------------------------- //
41 
42  TfTokenVector GetImagingSubprims(UsdPrim const &prim) override = 0;
43 
45  UsdPrim const &prim, TfToken const& subprim) override = 0;
46 
47  HdContainerDataSourceHandle GetImagingSubprimData(
48  UsdPrim const& prim,
49  TfToken const& subprim,
50  const UsdImagingDataSourceStageGlobals &stageGlobals) override = 0;
51 
53  UsdPrim const& prim,
54  TfToken const& subprim,
55  TfTokenVector const& properties,
56  UsdImagingPropertyInvalidationType invalidationType) override = 0;
57 
58  /*
59  * A simple prim could implement this as:
60  * GetImagingSubprims() = { "" }
61  * GetImagingSubprimType("") = "Sphere"
62  * GetImagingSubprimData("") = SphereDataSource(prim, globals)
63  * ... while a more complicated prim could implement this as:
64  * GetImagingSubprims() = { "", "guide" }
65  * GetImagingSubprimType("") = "Light"
66  * GetImagingSubprimType("guide") = "Mesh"
67  * ... etc. Typically the main prim is named "" (empty token).
68  */
69 
70  // ---------------------------------------------------------------------- //
71  /// \name Legacy
72  ///
73  /// Implementation of deprecated pure-virtuals; these functions
74  /// don't participate in the stage scene index.
75  // ---------------------------------------------------------------------- //
76 
78  SdfPath Populate(UsdPrim const& prim,
81  instancerContext = nullptr) override final;
82 
84  void TrackVariability(UsdPrim const& prim,
85  SdfPath const& cachePath,
86  HdDirtyBits* timeVaryingBits,
88  instancerContext = nullptr) const override final;
89 
91  void UpdateForTime(UsdPrim const& prim,
92  SdfPath const& cachePath,
94  HdDirtyBits requestedBits,
96  instancerContext = nullptr) const override final;
97 
100  UsdPrim const& prim,
101  SdfPath const& cachePath,
102  TfToken const& propertyName) override final;
103 
105  void MarkDirty(UsdPrim const& prim,
106  SdfPath const& cachePath,
107  HdDirtyBits dirty,
108  UsdImagingIndexProxy* index) override final;
109 
111  void _RemovePrim(SdfPath const& cachePath,
112  UsdImagingIndexProxy* index) override final;
113 };
114 
116 
117 #endif // PXR_USD_IMAGING_USD_IMAGING_PRIM_DATASOURCE_ADAPTER_H
#define USDIMAGING_API
Definition: api.h:23
GT_API const UT_StringHolder time
uint32_t HdDirtyBits
Definition: types.h:143
TfTokenVector GetImagingSubprims(UsdPrim const &prim) override=0
USDIMAGING_API void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=nullptr) const overridefinal
USDIMAGING_API void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=nullptr) const overridefinal
TfToken GetImagingSubprimType(UsdPrim const &prim, TfToken const &subprim) override=0
USDIMAGING_API HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName) overridefinal
HdDataSourceLocatorSet InvalidateImagingSubprim(UsdPrim const &prim, TfToken const &subprim, TfTokenVector const &properties, UsdImagingPropertyInvalidationType invalidationType) override=0
Definition: token.h:70
USDIMAGING_API void MarkDirty(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits dirty, UsdImagingIndexProxy *index) overridefinal
USDIMAGING_API ~UsdImagingSceneIndexPrimAdapter() override
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
GLuint index
Definition: glcorearb.h:786
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDIMAGING_API UsdImagingSceneIndexPrimAdapter()
HdContainerDataSourceHandle GetImagingSubprimData(UsdPrim const &prim, TfToken const &subprim, const UsdImagingDataSourceStageGlobals &stageGlobals) override=0
UsdImagingPropertyInvalidationType
Definition: types.h:17
USDIMAGING_API SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) overridefinal
USDIMAGING_API void _RemovePrim(SdfPath const &cachePath, UsdImagingIndexProxy *index) overridefinal
Returns whether custom shading of prims is enabled.