Loading...
Searching...
No Matches
materialOverrideResolvingSceneIndex.h
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
11#include "pxr/imaging/hd/filteringSceneIndex.h"
12#include "pxr/imaging/hdsi/api.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
16TF_DECLARE_WEAK_AND_REF_PTRS(HdsiMaterialOverrideResolvingSceneIndex);
17
18/*
19HdsiMaterialOverrideResolvingSceneIndex applies material overrides if both
20overrides and interface mappings are found.
21
22The overrides for a particular 'publicUIName' are specified at path like this:
23
24materialOverride.interfaceValues.<publicUIName>.value
25 -> overrideValueDataSource
26
27The 'overrideValueDataSource' is copied over a network node parameter's original
28'valueDataSource' at paths like this:
29
30material.<renderContext>.nodes.<nodePath>.parameters.<inputName>.value
31 -> valueDataSource
32
33The scene index identifies which network node parameter to override by using
34the 'interfaceMappings' which are defined at paths like this:
35
36material.<renderContext>.interfaceMappings.<publicUIName>
37 -> [(nodePath, inputName), (nodePath, inputName), ...]
38
39Below is a diagram of the expected attributes needed for material overrides
40on a scene index prim of type 'material':
41
42MaterialPrim
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
112class HdsiMaterialOverrideResolvingSceneIndex final :
114{
115public:
116 static HdsiMaterialOverrideResolvingSceneIndexRefPtr New(
117 const HdSceneIndexBaseRefPtr &inputScene)
118 {
119 return TfCreateRefPtr(
120 new HdsiMaterialOverrideResolvingSceneIndex(inputScene));
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
130protected:
131
132 HDSI_API
133 HdsiMaterialOverrideResolvingSceneIndex(
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
150PXR_NAMESPACE_CLOSE_SCOPE
151
152#endif // PXR_IMAGING_HDSI_MATERIAL_OVERRIDE_RESOLVING_SCENE_INDEX_H
Abstract interface to scene data.
Definition: sceneIndex.h:48
virtual SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const =0
Returns the paths of all scene index prims located immediately below primPath.
virtual HdSceneIndexPrim GetPrim(const SdfPath &primPath) const =0
Returns a pair of (prim type, datasource) for the object at primPath.
An abstract base class for a filtering scene index that observes a single input scene index.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35