HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialOverrideResolvingSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 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_IMAGING_HDSI_MATERIAL_OVERRIDE_RESOLVING_SCENE_INDEX_H
8 #define PXR_IMAGING_HDSI_MATERIAL_OVERRIDE_RESOLVING_SCENE_INDEX_H
9 
12 #include "pxr/imaging/hdsi/api.h"
13 
15 
17 
18 /*
19 HdsiMaterialOverrideResolvingSceneIndex applies material overrides if both
20 overrides and interface mappings are found.
21 
22 The overrides for a particular 'publicUIName' are specified at path like this:
23 
24 materialOverride.interfaceValues.<publicUIName>.value
25  -> overrideValueDataSource
26 
27 The 'overrideValueDataSource' is copied over a network node parameter's original
28 'valueDataSource' at paths like this:
29 
30 material.<renderContext>.nodes.<nodePath>.parameters.<inputName>.value
31  -> valueDataSource
32 
33 The scene index identifies which network node parameter to override by using
34 the 'interfaceMappings' which are defined at paths like this:
35 
36 material.<renderContext>.interfaceMappings.<publicUIName>
37  -> [(nodePath, inputName), (nodePath, inputName), ...]
38 
39 Below is a diagram of the expected attributes needed for material overrides
40 on a scene index prim of type 'material':
41 
42 MaterialPrim
43 |
44 +------materialOverride
45 | |
46 | +----interfaceValues
47 | |
48 | +-publicUIName
49 | | |
50 | | +---value -> overrideValueDataSource
51 | |
52 | +-publicUIName
53 | | |
54 | | +---value -> overrideValueDataSource
55 | |
56 | +-...
57 |
58 +------material
59  |
60  +----ri
61  |
62  +--nodes
63  | |
64  | +-nodePath
65  | | |
66  | | +-parameters
67  | | |
68  | | +-inputName
69  | | | |
70  | | | +-value -> valueDataSource
71  | | |
72  | | +-inputName
73  | | |
74  | | +-value -> valueDataSource
75  | |
76  | +-nodePath
77  | |
78  | +-parameters
79  | |
80  | +-...
81  |
82  +--interfaceMappings
83  | |
84  | +-publicUIName
85  | | |
86  | | +-i0
87  | | | |
88  | | | +----nodePath
89  | | | |
90  | | | +----inputName
91  | | |
92  | | +-i1
93  | | | |
94  | | | +----nodePath
95  | | | |
96  | | | +----inputName
97  | | |
98  | | +-...
99  | |
100  | +-publicUIName
101  | | |
102  | | +-i0
103  | | |
104  | | | ...
105  | | |
106  | | +-...
107  | |
108  | +-...
109  |
110 */
111 
114 {
115 public:
116  static HdsiMaterialOverrideResolvingSceneIndexRefPtr New(
117  const HdSceneIndexBaseRefPtr &inputScene)
118  {
119  return TfCreateRefPtr(
121  }
122 
123  // HdSceneIndexBase overrides
124  HDSI_API
125  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
126 
127  HDSI_API
128  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
129 
130 protected:
131 
132  HDSI_API
134  const HdSceneIndexBaseRefPtr &inputScene);
135 
136  // HdSingleInputFilteringSceneIndexBase overrides
137  void _PrimsAdded(
138  const HdSceneIndexBase &sender,
139  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
140 
141  void _PrimsRemoved(
142  const HdSceneIndexBase &sender,
143  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
144 
145  void _PrimsDirtied(
146  const HdSceneIndexBase &sender,
147  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
148 };
149 
151 
152 #endif // PXR_IMAGING_HDSI_MATERIAL_OVERRIDE_RESOLVING_SCENE_INDEX_H
TfRefPtr< T > TfCreateRefPtr(T *ptr)
Definition: refPtr.h:1190
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(HdsiMaterialOverrideResolvingSceneIndex)
void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
std::vector< class SdfPath > SdfPathVector
static HdsiMaterialOverrideResolvingSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputScene)
HDSI_API HdsiMaterialOverrideResolvingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene)
Definition: path.h:273
#define HDSI_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override