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
40 virtual std::string GetModelAssetName() const = 0;
41
42 virtual TfTokenVector GetNodeNames() const = 0;
43 virtual TfToken GetNodeType(const TfToken &nodeName) const = 0;
44
50 virtual TfTokenVector
51 GetNodeTypeInfoKeys(const TfToken& nodeName) const = 0;
52 virtual VtValue
53 GetNodeTypeInfoValue(const TfToken& nodeName, const TfToken& key) const = 0;
54
55 virtual TfTokenVector GetAuthoredNodeParameterNames(
56 const TfToken &nodeName) const = 0;
57
58 virtual VtValue GetNodeParameterValue(
59 const TfToken &nodeName,
60 const TfToken &paramName) const = 0;
61
62 struct NodeParamData
63 {
64 VtValue value;
65 TfToken colorSpace;
66 };
67
68 virtual NodeParamData GetNodeParameterData(
69 const TfToken &nodeName,
70 const TfToken &paramName) const = 0;
71
72 virtual TfTokenVector GetNodeInputConnectionNames(
73 const TfToken &nodeName) const = 0;
74
75 struct InputConnection
76 {
77 TfToken upstreamNodeName;
78 TfToken upstreamOutputName;
79 };
80 using InputConnectionVector = TfSmallVector<InputConnection, 4>;
81
82 virtual InputConnectionVector GetNodeInputConnection(
83 const TfToken &nodeName,
84 const TfToken &inputName) const = 0;
85
86 virtual void DeleteNode(const TfToken &nodeName) = 0;
87
88 virtual void SetNodeType(
89 const TfToken &nodeName,
90 const TfToken &nodeType) = 0;
91
92 virtual void SetNodeParameterValue(
93 const TfToken &nodeName,
94 const TfToken &paramName,
95 const VtValue &value) = 0;
96
97 virtual void SetNodeParameterData(
98 const TfToken &nodeName,
99 const TfToken &paramName,
100 const NodeParamData &paramData) = 0;
101
102 virtual void DeleteNodeParameter(
103 const TfToken &nodeName,
104 const TfToken &paramName) = 0;
105
106 virtual void SetNodeInputConnection(
107 const TfToken &nodeName,
108 const TfToken &inputName,
109 const InputConnectionVector &connections) = 0;
110
111 virtual void DeleteNodeInputConnection(
112 const TfToken &nodeName,
113 const TfToken &inputName) = 0;
114
117 virtual TfTokenVector GetTerminalNames() const = 0;
118
119 using InputConnectionResult = std::pair<bool, InputConnection>;
120 virtual InputConnectionResult GetTerminalConnection(
121 const TfToken &terminalName) const = 0;
122
123 virtual void DeleteTerminal(
124 const TfToken &terminalName) = 0;
125
126 virtual void SetTerminalConnection(
127 const TfToken &terminalName,
128 const InputConnection &connection) = 0;
129};
130
131
132PXR_NAMESPACE_CLOSE_SCOPE
133
134#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:274
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:155
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:147
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