Loading...
Searching...
No Matches
materialNetworkInterface.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 PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
25#define PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/sdf/path.h"
29#include "pxr/base/vt/value.h"
31#include "pxr/base/tf/token.h"
32
33PXR_NAMESPACE_OPEN_SCOPE
34
49{
50public:
51 virtual ~HdMaterialNetworkInterface() = default;
52
53 virtual SdfPath GetMaterialPrimPath() const = 0;
54
57 virtual std::string GetModelAssetName() const = 0;
58
59 virtual TfTokenVector GetNodeNames() const = 0;
60 virtual TfToken GetNodeType(const TfToken &nodeName) const = 0;
61
67 virtual TfTokenVector
68 GetNodeTypeInfoKeys(const TfToken& nodeName) const = 0;
69 virtual VtValue
70 GetNodeTypeInfoValue(const TfToken& nodeName, const TfToken& key) const = 0;
71
72 virtual TfTokenVector GetAuthoredNodeParameterNames(
73 const TfToken &nodeName) const = 0;
74
75 virtual VtValue GetNodeParameterValue(
76 const TfToken &nodeName,
77 const TfToken &paramName) const = 0;
78
79 struct NodeParamData
80 {
81 VtValue value;
82 TfToken colorSpace;
83 };
84
85 virtual NodeParamData GetNodeParameterData(
86 const TfToken &nodeName,
87 const TfToken &paramName) const = 0;
88
89 virtual TfTokenVector GetNodeInputConnectionNames(
90 const TfToken &nodeName) const = 0;
91
92 struct InputConnection
93 {
94 TfToken upstreamNodeName;
95 TfToken upstreamOutputName;
96 };
97 using InputConnectionVector = TfSmallVector<InputConnection, 4>;
98
99 virtual InputConnectionVector GetNodeInputConnection(
100 const TfToken &nodeName,
101 const TfToken &inputName) const = 0;
102
103 virtual void DeleteNode(const TfToken &nodeName) = 0;
104
105 virtual void SetNodeType(
106 const TfToken &nodeName,
107 const TfToken &nodeType) = 0;
108
109 virtual void SetNodeParameterValue(
110 const TfToken &nodeName,
111 const TfToken &paramName,
112 const VtValue &value) = 0;
113
114 virtual void SetNodeParameterData(
115 const TfToken &nodeName,
116 const TfToken &paramName,
117 const NodeParamData &paramData) = 0;
118
119 virtual void DeleteNodeParameter(
120 const TfToken &nodeName,
121 const TfToken &paramName) = 0;
122
123 virtual void SetNodeInputConnection(
124 const TfToken &nodeName,
125 const TfToken &inputName,
126 const InputConnectionVector &connections) = 0;
127
128 virtual void DeleteNodeInputConnection(
129 const TfToken &nodeName,
130 const TfToken &inputName) = 0;
131
134 virtual TfTokenVector GetTerminalNames() const = 0;
135
136 using InputConnectionResult = std::pair<bool, InputConnection>;
137 virtual InputConnectionResult GetTerminalConnection(
138 const TfToken &terminalName) const = 0;
139
140 virtual void DeleteTerminal(
141 const TfToken &terminalName) = 0;
142
143 virtual void SetTerminalConnection(
144 const TfToken &terminalName,
145 const InputConnection &connection) = 0;
146};
147
148
149PXR_NAMESPACE_CLOSE_SCOPE
150
151#endif // PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
Abstract interface for querying and mutating a material network.
virtual std::string GetModelAssetName() const =0
Returns the nearest enclosing model asset name, as described by the model schema, or empty string if ...
virtual TfTokenVector GetTerminalNames() const =0
virtual TfTokenVector GetNodeTypeInfoKeys(const TfToken &nodeName) const =0
Node type info is a collection of data related to the node type, often used to determine the node typ...
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
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:164
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457