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
55 virtual TfTokenVector GetNodeNames() const = 0;
56 virtual TfToken GetNodeType(const TfToken &nodeName) const = 0;
57
63 virtual TfTokenVector
64 GetNodeTypeInfoKeys(const TfToken& nodeName) const = 0;
65 virtual VtValue
66 GetNodeTypeInfoValue(const TfToken& nodeName, const TfToken& key) const = 0;
67
68 virtual TfTokenVector GetAuthoredNodeParameterNames(
69 const TfToken &nodeName) const = 0;
70
71 virtual VtValue GetNodeParameterValue(
72 const TfToken &nodeName,
73 const TfToken &paramName) const = 0;
74
75 virtual TfTokenVector GetNodeInputConnectionNames(
76 const TfToken &nodeName) const = 0;
77
78 struct InputConnection
79 {
80 TfToken upstreamNodeName;
81 TfToken upstreamOutputName;
82 };
83 using InputConnectionVector = TfSmallVector<InputConnection, 4>;
84
85 virtual InputConnectionVector GetNodeInputConnection(
86 const TfToken &nodeName,
87 const TfToken &inputName) const = 0;
88
89 virtual void DeleteNode(const TfToken &nodeName) = 0;
90
91 virtual void SetNodeType(
92 const TfToken &nodeName,
93 const TfToken &nodeType) = 0;
94
95 virtual void SetNodeParameterValue(
96 const TfToken &nodeName,
97 const TfToken &paramName,
98 const VtValue &value) = 0;
99
100 virtual void DeleteNodeParameter(
101 const TfToken &nodeName,
102 const TfToken &paramName) = 0;
103
104 virtual void SetNodeInputConnection(
105 const TfToken &nodeName,
106 const TfToken &inputName,
107 const InputConnectionVector &connections) = 0;
108
109 virtual void DeleteNodeInputConnection(
110 const TfToken &nodeName,
111 const TfToken &inputName) = 0;
112
115 virtual TfTokenVector GetTerminalNames() const = 0;
116
117 using InputConnectionResult = std::pair<bool, InputConnection>;
118 virtual InputConnectionResult GetTerminalConnection(
119 const TfToken &terminalName) const = 0;
120
121 virtual void DeleteTerminal(
122 const TfToken &terminalName) = 0;
123
124 virtual void SetTerminalConnection(
125 const TfToken &terminalName,
126 const InputConnection &connection) = 0;
127};
128
129
130PXR_NAMESPACE_CLOSE_SCOPE
131
132#endif // PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
Abstract interface for querying and mutating a material network.
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:292
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:168
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:442