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 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
49 {
50 public:
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 
58  virtual TfTokenVector GetAuthoredNodeParameterNames(
59  const TfToken &nodeName) const = 0;
60 
61  virtual VtValue GetNodeParameterValue(
62  const TfToken &nodeName,
63  const TfToken &paramName) const = 0;
64 
65  virtual TfTokenVector GetNodeInputConnectionNames(
66  const TfToken &nodeName) const = 0;
67 
68  struct InputConnection
69  {
70  TfToken upstreamNodeName;
71  TfToken upstreamOutputName;
72  };
74 
75  virtual InputConnectionVector GetNodeInputConnection(
76  const TfToken &nodeName,
77  const TfToken &inputName) const = 0;
78 
79  virtual void DeleteNode(const TfToken &nodeName) = 0;
80 
81  virtual void SetNodeType(
82  const TfToken &nodeName,
83  const TfToken &nodeType) = 0;
84 
85  virtual void SetNodeParameterValue(
86  const TfToken &nodeName,
87  const TfToken &paramName,
88  const VtValue &value) = 0;
89 
90  virtual void DeleteNodeParameter(
91  const TfToken &nodeName,
92  const TfToken &paramName) = 0;
93 
94  virtual void SetNodeInputConnection(
95  const TfToken &nodeName,
96  const TfToken &inputName,
97  const InputConnectionVector &connections) = 0;
98 
99  virtual void DeleteNodeInputConnection(
100  const TfToken &nodeName,
101  const TfToken &inputName) = 0;
102 
105  virtual TfTokenVector GetTerminalNames() const = 0;
106 
107  using InputConnectionResult = std::pair<bool, InputConnection>;
108  virtual InputConnectionResult GetTerminalConnection(
109  const TfToken &terminalName) const = 0;
110 
111  virtual void DeleteTerminal(
112  const TfToken &terminalName) = 0;
113 
114  virtual void SetTerminalConnection(
115  const TfToken &terminalName,
116  const InputConnection &connection) = 0;
117 };
118 
119 
120 PXR_NAMESPACE_CLOSE_SCOPE
121 
122 #endif // PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
Abstract interface for querying and mutating a material network.
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:177
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
virtual TfTokenVector GetTerminalNames() const =0
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...