HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialNetwork2Interface.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef HD_MATERIAL_NETWORK_2_INTERFACE_H
25 #define HD_MATERIAL_NETWORK_2_INTERFACE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
31 
33 
34 /// \class HdMaterialNetwork2Interface
35 ///
36 /// Implements HdMaterialNetworkInterface interface backed by an
37 /// HdMaterialNetwork2 -- which is useful for implementing material
38 /// filtering functions without being tied to the legacy data model
41 {
42 public:
43 
45  const SdfPath &materialPrimPath,
46  HdMaterialNetwork2 *materialNetwork)
47  : _materialPrimPath(materialPrimPath)
48  , _materialNetwork(materialNetwork)
49  , _lastAccessedNode(nullptr)
50  {}
51 
52  HD_API
53  SdfPath GetMaterialPrimPath() const override {
54  return _materialPrimPath;
55  }
56 
57  HD_API
58  std::string GetModelAssetName() const override {
59  return std::string();
60  }
61 
62  HD_API
63  TfTokenVector GetNodeNames() const override;
64 
65  HD_API
66  TfToken GetNodeType(const TfToken &nodeName) const override;
67 
68  HD_API
69  TfTokenVector GetNodeTypeInfoKeys(const TfToken& nodeName) const override;
70 
71  HD_API
73  const TfToken& nodeName, const TfToken& key) const override;
74 
75  HD_API
77  const TfToken &nodeName) const override;
78 
79  HD_API
81  const TfToken &nodeName,
82  const TfToken &paramName) const override;
83 
84  HD_API
85  NodeParamData GetNodeParameterData(
86  const TfToken &nodeName,
87  const TfToken &paramName) const override;
88 
89  HD_API
91  const TfToken &nodeName) const override;
92 
93  HD_API
95  const TfToken &nodeName,
96  const TfToken &inputName) const override;
97 
98  HD_API
99  void DeleteNode(const TfToken &nodeName) override;
100 
101  HD_API
102  void SetNodeType(
103  const TfToken &nodeName,
104  const TfToken &nodeType) override;
105 
106  HD_API
108  const TfToken &nodeName,
109  const TfToken &paramName,
110  const VtValue &value) override;
111 
112  HD_API
114  const TfToken &nodeName,
115  const TfToken &paramName,
116  const NodeParamData &paramData) override;
117 
118  HD_API
119  void DeleteNodeParameter(
120  const TfToken &nodeName,
121  const TfToken &paramName) override;
122 
123  HD_API
125  const TfToken &nodeName,
126  const TfToken &inputName,
127  const InputConnectionVector &connections) override;
128 
129  HD_API
131  const TfToken &nodeName,
132  const TfToken &inputName) override;
133 
134  HD_API
135  TfTokenVector GetTerminalNames() const override;
136 
137  HD_API
139  const TfToken &terminalName) const override;
140 
141  HD_API
142  void DeleteTerminal(const TfToken &terminalName) override;
143 
144  HD_API
146  const TfToken &terminalName,
147  const InputConnection &connection) override;
148 
149 private:
150  SdfPath _materialPrimPath;
151  HdMaterialNetwork2 *_materialNetwork;
152  mutable TfToken _lastAccessedNodeName;
153  mutable HdMaterialNode2 *_lastAccessedNode;
154 
155  HdMaterialNode2 *_GetNode(const TfToken &nodeName) const;
156  HdMaterialNode2 *_GetOrCreateNode(const TfToken &nodeName) const;
157 
158 };
159 
160 
161 
163 
164 #endif //HD_MATERIAL_NETWORK_2_INTERFACE_H
HD_API TfTokenVector GetTerminalNames() const override
HD_API void SetNodeParameterValue(const TfToken &nodeName, const TfToken &paramName, const VtValue &value) override
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
HD_API NodeParamData GetNodeParameterData(const TfToken &nodeName, const TfToken &paramName) const override
#define HD_API
Definition: api.h:40
HD_API void DeleteTerminal(const TfToken &terminalName) override
HD_API void DeleteNode(const TfToken &nodeName) override
HD_API std::string GetModelAssetName() const override
Definition: token.h:87
HD_API VtValue GetNodeParameterValue(const TfToken &nodeName, const TfToken &paramName) const override
HD_API InputConnectionResult GetTerminalConnection(const TfToken &terminalName) const override
HD_API TfTokenVector GetNodeInputConnectionNames(const TfToken &nodeName) const override
HD_API void DeleteNodeParameter(const TfToken &nodeName, const TfToken &paramName) override
HD_API void SetNodeParameterData(const TfToken &nodeName, const TfToken &paramName, const NodeParamData &paramData) override
HD_API TfToken GetNodeType(const TfToken &nodeName) const override
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457
Definition: path.h:290
HdMaterialNetwork2Interface(const SdfPath &materialPrimPath, HdMaterialNetwork2 *materialNetwork)
HD_API void DeleteNodeInputConnection(const TfToken &nodeName, const TfToken &inputName) override
HD_API VtValue GetNodeTypeInfoValue(const TfToken &nodeName, const TfToken &key) const override
HD_API TfTokenVector GetNodeTypeInfoKeys(const TfToken &nodeName) const override
TfSmallVector< InputConnection, 4 > InputConnectionVector
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
HD_API void SetTerminalConnection(const TfToken &terminalName, const InputConnection &connection) override
HD_API InputConnectionVector GetNodeInputConnection(const TfToken &nodeName, const TfToken &inputName) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HD_API void SetNodeInputConnection(const TfToken &nodeName, const TfToken &inputName, const InputConnectionVector &connections) override
Definition: core.h:1131
HD_API SdfPath GetMaterialPrimPath() const override
HD_API TfTokenVector GetAuthoredNodeParameterNames(const TfToken &nodeName) const override
std::pair< bool, InputConnection > InputConnectionResult
Definition: value.h:164
HD_API TfTokenVector GetNodeNames() const override
HD_API void SetNodeType(const TfToken &nodeName, const TfToken &nodeType) override