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  SdfPath GetMaterialPrimPath() const override {
53  return _materialPrimPath;
54  }
55 
56  HD_API
57  TfTokenVector GetNodeNames() const override;
58 
59  HD_API
60  TfToken GetNodeType(const TfToken &nodeName) const override;
61 
62  HD_API
63  TfTokenVector GetNodeTypeInfoKeys(const TfToken& nodeName) const override;
64 
65  HD_API
67  const TfToken& nodeName, const TfToken& key) const override;
68 
69  HD_API
71  const TfToken &nodeName) const override;
72 
73  HD_API
75  const TfToken &nodeName,
76  const TfToken &paramName) const override;
77 
78  HD_API
80  const TfToken &nodeName) const override;
81 
82  HD_API
84  const TfToken &nodeName,
85  const TfToken &inputName) const override;
86 
87  HD_API
88  void DeleteNode(const TfToken &nodeName) override;
89 
90  HD_API
91  void SetNodeType(
92  const TfToken &nodeName,
93  const TfToken &nodeType) override;
94 
95  HD_API
97  const TfToken &nodeName,
98  const TfToken &paramName,
99  const VtValue &value) override;
100 
101  HD_API
102  void DeleteNodeParameter(
103  const TfToken &nodeName,
104  const TfToken &paramName) override;
105 
106  HD_API
108  const TfToken &nodeName,
109  const TfToken &inputName,
110  const InputConnectionVector &connections) override;
111 
112  HD_API
114  const TfToken &nodeName,
115  const TfToken &inputName) override;
116 
117  HD_API
118  TfTokenVector GetTerminalNames() const override;
119 
120  HD_API
122  const TfToken &terminalName) const override;
123 
124  HD_API
125  void DeleteTerminal(const TfToken &terminalName) override;
126 
127  HD_API
129  const TfToken &terminalName,
130  const InputConnection &connection) override;
131 
132 private:
133  SdfPath _materialPrimPath;
134  HdMaterialNetwork2 *_materialNetwork;
135  mutable TfToken _lastAccessedNodeName;
136  mutable HdMaterialNode2 *_lastAccessedNode;
137 
138  HdMaterialNode2 *_GetNode(const TfToken &nodeName) const;
139  HdMaterialNode2 *_GetOrCreateNode(const TfToken &nodeName) const;
140 
141 };
142 
143 
144 
146 
147 #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
#define HD_API
Definition: api.h:40
HD_API void DeleteTerminal(const TfToken &terminalName) override
HD_API void DeleteNode(const TfToken &nodeName) 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 TfToken GetNodeType(const TfToken &nodeName) const override
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: path.h:291
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:1441
HD_API void SetTerminalConnection(const TfToken &terminalName, const InputConnection &connection) override
HD_API InputConnectionVector GetNodeInputConnection(const TfToken &nodeName, const TfToken &inputName) const override
SdfPath GetMaterialPrimPath() 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 TfTokenVector GetAuthoredNodeParameterNames(const TfToken &nodeName) const override
std::pair< bool, InputConnection > InputConnectionResult
Definition: value.h:167
HD_API TfTokenVector GetNodeNames() const override
HD_API void SetNodeType(const TfToken &nodeName, const TfToken &nodeType) override