Loading...
Searching...
No Matches
materialNetworkInterface.h
1//
2// Copyright 2021 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
8#define PXR_IMAGING_HD_MATERIAL_NETWORK_INTERFACE_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/sdf/path.h"
12#include "pxr/base/vt/value.h"
14#include "pxr/base/tf/token.h"
15
16PXR_NAMESPACE_OPEN_SCOPE
17
32{
33public:
34 virtual ~HdMaterialNetworkInterface() = default;
35
36 virtual SdfPath GetMaterialPrimPath() const = 0;
37
44 virtual VtValue GetMaterialConfigValue(const TfToken& key) const = 0;
45
48 virtual std::string GetModelAssetName() const = 0;
49
50 virtual TfTokenVector GetNodeNames() const = 0;
51 virtual TfToken GetNodeType(const TfToken &nodeName) const = 0;
52
56 virtual TfTokenVector
57 GetNodeTypeInfoKeys(const TfToken& nodeName) const = 0;
58 virtual VtValue
59 GetNodeTypeInfoValue(const TfToken& nodeName, const TfToken& key) const = 0;
60
61 virtual TfTokenVector GetAuthoredNodeParameterNames(
62 const TfToken &nodeName) const = 0;
63
64 virtual VtValue GetNodeParameterValue(
65 const TfToken &nodeName,
66 const TfToken &paramName) const = 0;
67
68 struct NodeParamData
69 {
70 VtValue value;
71 TfToken colorSpace;
72 TfToken typeName;
73 };
74
75 virtual NodeParamData GetNodeParameterData(
76 const TfToken &nodeName,
77 const TfToken &paramName) const = 0;
78
79 virtual TfTokenVector GetNodeInputConnectionNames(
80 const TfToken &nodeName) const = 0;
81
82 struct InputConnection
83 {
84 TfToken upstreamNodeName;
85 TfToken upstreamOutputName;
86 };
87 using InputConnectionVector = TfSmallVector<InputConnection, 4>;
88
89 virtual InputConnectionVector GetNodeInputConnection(
90 const TfToken &nodeName,
91 const TfToken &inputName) const = 0;
92
93 virtual void DeleteNode(const TfToken &nodeName) = 0;
94
95 virtual void SetNodeType(
96 const TfToken &nodeName,
97 const TfToken &nodeType) = 0;
98
99 virtual void SetNodeTypeInfoValue(
100 const TfToken &nodeName,
101 const TfToken &key,
102 const VtValue &value
103 ) = 0;
104
105 virtual void SetNodeParameterValue(
106 const TfToken &nodeName,
107 const TfToken &paramName,
108 const VtValue &value) = 0;
109
110 virtual void SetNodeParameterData(
111 const TfToken &nodeName,
112 const TfToken &paramName,
113 const NodeParamData &paramData) = 0;
114
115 virtual void DeleteNodeParameter(
116 const TfToken &nodeName,
117 const TfToken &paramName) = 0;
118
119 virtual void SetNodeInputConnection(
120 const TfToken &nodeName,
121 const TfToken &inputName,
122 const InputConnectionVector &connections) = 0;
123
124 virtual void DeleteNodeInputConnection(
125 const TfToken &nodeName,
126 const TfToken &inputName) = 0;
127
130 virtual TfTokenVector GetTerminalNames() const = 0;
131
132 using InputConnectionResult = std::pair<bool, InputConnection>;
133 virtual InputConnectionResult GetTerminalConnection(
134 const TfToken &terminalName) const = 0;
135
136 virtual void DeleteTerminal(
137 const TfToken &terminalName) = 0;
138
139 virtual void SetTerminalConnection(
140 const TfToken &terminalName,
141 const InputConnection &connection) = 0;
142};
143
144
145PXR_NAMESPACE_CLOSE_SCOPE
146
147#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 GetMaterialConfigKeys() const =0
Material config is a collection of data related to the entire material, e.g.
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:274
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:157
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152
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:440