Loading...
Searching...
No Matches
materialNetwork2Interface.h
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"
29#include "pxr/imaging/hd/material.h"
30#include "pxr/imaging/hd/materialNetworkInterface.h"
31
32PXR_NAMESPACE_OPEN_SCOPE
33
41{
42public:
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
72 VtValue GetNodeTypeInfoValue(
73 const TfToken& nodeName, const TfToken& key) const override;
74
75 HD_API
76 TfTokenVector GetAuthoredNodeParameterNames(
77 const TfToken &nodeName) const override;
78
79 HD_API
80 VtValue GetNodeParameterValue(
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
90 TfTokenVector GetNodeInputConnectionNames(
91 const TfToken &nodeName) const override;
92
93 HD_API
94 InputConnectionVector GetNodeInputConnection(
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
107 void SetNodeParameterValue(
108 const TfToken &nodeName,
109 const TfToken &paramName,
110 const VtValue &value) override;
111
112 HD_API
113 void SetNodeParameterData(
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
124 void SetNodeInputConnection(
125 const TfToken &nodeName,
126 const TfToken &inputName,
127 const InputConnectionVector &connections) override;
128
129 HD_API
130 void DeleteNodeInputConnection(
131 const TfToken &nodeName,
132 const TfToken &inputName) override;
133
134 HD_API
136
137 HD_API
138 InputConnectionResult GetTerminalConnection(
139 const TfToken &terminalName) const override;
140
141 HD_API
142 void DeleteTerminal(const TfToken &terminalName) override;
143
144 HD_API
145 void SetTerminalConnection(
146 const TfToken &terminalName,
147 const InputConnection &connection) override;
148
149private:
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
162PXR_NAMESPACE_CLOSE_SCOPE
163
164#endif //HD_MATERIAL_NETWORK_2_INTERFACE_H
Implements HdMaterialNetworkInterface interface backed by an HdMaterialNetwork2 – which is useful for...
HD_API TfTokenVector GetTerminalNames() const override
HD_API std::string GetModelAssetName() const override
Returns the nearest enclosing model asset name, as described by the model schema, or empty string if ...
HD_API TfTokenVector GetNodeTypeInfoKeys(const TfToken &nodeName) const override
Node type info is a collection of data related to the node type, often used to determine the node typ...
Abstract interface for querying and mutating a material network.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:179
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:165
Container of nodes and top-level terminal connections.
Definition: material.h:178
Describes an instance of a node within a network A node contains a (shader) type identifier,...
Definition: material.h:166
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457