HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialNodeSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_IMAGING_HD_MATERIAL_NODE_SCHEMA_H
19 #define PXR_IMAGING_HD_MATERIAL_NODE_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
25 
26 #include "pxr/imaging/hd/schema.h"
27 
28 // --(BEGIN CUSTOM CODE: Includes)--
29 // --(END CUSTOM CODE: Includes)--
30 
32 
33 // --(BEGIN CUSTOM CODE: Declares)--
34 // --(END CUSTOM CODE: Declares)--
35 
36 #define HD_MATERIAL_NODE_SCHEMA_TOKENS \
37  (parameters) \
38  (inputConnections) \
39  (nodeIdentifier) \
40  (renderContextNodeIdentifiers) \
41  (nodeTypeInfo) \
42 
43 TF_DECLARE_PUBLIC_TOKENS(HdMaterialNodeSchemaTokens, HD_API,
45 
46 //-----------------------------------------------------------------------------
47 
48 // The MaterialNode schema is a container schema that defines a particular
49 // node in a material network.
50 //
51 // A material node defines its connections to other nodes via the
52 // "inputConnections" member. For example, "albedo" would define that it
53 // receives its value from its connection to the node "Color_UnPreMult" and
54 // the output "resultRGB" with the following data sources:
55 //
56 // ds at: material/<renderContext>/nodes/MaterialLayer/inputConnections
57 // /albedo/[0]/upstreamNodePath = Color_UnPreMult
58 //
59 // ds at: material/<renderContext>/nodes/MaterialLayer/inputConnections
60 // /albedo/[0]/upstreamNodeOutputName = resultRGB
61 //
62 
64 {
65 public:
66  /// \name Schema retrieval
67  /// @{
68 
69  HdMaterialNodeSchema(HdContainerDataSourceHandle container)
70  : HdSchema(container) {}
71 
72  /// @}
73 
74 // --(BEGIN CUSTOM CODE: Schema Methods)--
75 // --(END CUSTOM CODE: Schema Methods)--
76 
77  /// \name Member accessor
78  /// @{
79 
80  /// Maps parameter names to node parameters. Each node parameter is a
81  /// container that is defined by the MaterialNodeParameter schema. Note
82  /// that parameters are inputs that supply their value directly.
83  HD_API
85 
86  /// Maps input names to vectors of connections. Each connection is defined
87  /// by the MaterialConnection schema. Note that inputConnections are
88  /// inputs that get their value from data flow over the connection.
89  HD_API
91 
92  /// This identifies the shader the node represents. The
93  /// renderContextNodeIdentifier container can store alternative values for
94  /// this. A consumer which is interested in a specific render context
95  /// should check for that token within renderContextNodeIdentifiers and
96  /// fall back on this value in its absence.
97  HD_API
99 
100  /// A shading node can hold a nodeIdentifier value for multiple render
101  /// contexts at once. This allows multiple renderer target representations
102  /// to coexist in the same renderable scene. The contents of this
103  /// container are alternate possible values for nodeIdentifier. A consumer
104  /// which is interested in a specific render context should check for that
105  /// token within this container and fall back on nodeIdentifier in its
106  /// absence.
107  HD_API
108  HdContainerDataSourceHandle GetRenderContextNodeIdentifiers() const;
109 
110  /// Rather than having an identifier, a shader can be specified by other
111  /// information.
112  HD_API
113  HdContainerDataSourceHandle GetNodeTypeInfo() const;
114 
115  /// @}
116 
117  /// \name Schema construction
118  /// @{
119 
120  /// \deprecated Use Builder instead.
121  ///
122  /// Builds a container data source which includes the provided child data
123  /// sources. Parameters with nullptr values are excluded. This is a
124  /// low-level interface. For cases in which it's desired to define
125  /// the container with a sparse set of child fields, the Builder class
126  /// is often more convenient and readable.
127  HD_API
128  static HdContainerDataSourceHandle
130  const HdContainerDataSourceHandle &parameters,
131  const HdContainerDataSourceHandle &inputConnections,
132  const HdTokenDataSourceHandle &nodeIdentifier,
133  const HdContainerDataSourceHandle &renderContextNodeIdentifiers,
134  const HdContainerDataSourceHandle &nodeTypeInfo
135  );
136 
137  /// \class HdMaterialNodeSchema::Builder
138  ///
139  /// Utility class for setting sparse sets of child data source fields to be
140  /// filled as arguments into BuildRetained. Because all setter methods
141  /// return a reference to the instance, this can be used in the "builder
142  /// pattern" form.
143  class Builder
144  {
145  public:
146  HD_API
148  const HdContainerDataSourceHandle &parameters);
149  HD_API
151  const HdContainerDataSourceHandle &inputConnections);
152  HD_API
154  const HdTokenDataSourceHandle &nodeIdentifier);
155  HD_API
157  const HdContainerDataSourceHandle &renderContextNodeIdentifiers);
158  HD_API
160  const HdContainerDataSourceHandle &nodeTypeInfo);
161 
162  /// Returns a container data source containing the members set thus far.
163  HD_API
164  HdContainerDataSourceHandle Build();
165 
166  private:
167  HdContainerDataSourceHandle _parameters;
168  HdContainerDataSourceHandle _inputConnections;
169  HdTokenDataSourceHandle _nodeIdentifier;
170  HdContainerDataSourceHandle _renderContextNodeIdentifiers;
171  HdContainerDataSourceHandle _nodeTypeInfo;
172 
173  };
174 
175  /// @}
176 };
177 
179 
180 #endif
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
#define HD_MATERIAL_NODE_SCHEMA_TOKENS
HD_API Builder & SetNodeTypeInfo(const HdContainerDataSourceHandle &nodeTypeInfo)
HD_API Builder & SetNodeIdentifier(const HdTokenDataSourceHandle &nodeIdentifier)
HdMaterialNodeSchema(HdContainerDataSourceHandle container)
#define HD_API
Definition: api.h:23
HD_API HdMaterialNodeParameterContainerSchema GetParameters() const
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &parameters, const HdContainerDataSourceHandle &inputConnections, const HdTokenDataSourceHandle &nodeIdentifier, const HdContainerDataSourceHandle &renderContextNodeIdentifiers, const HdContainerDataSourceHandle &nodeTypeInfo)
HD_API HdContainerDataSourceHandle GetRenderContextNodeIdentifiers() const
HD_API HdTokenDataSourceHandle GetNodeIdentifier() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HD_API HdMaterialConnectionVectorContainerSchema GetInputConnections() const
HD_API HdContainerDataSourceHandle GetNodeTypeInfo() const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API Builder & SetParameters(const HdContainerDataSourceHandle &parameters)
HD_API Builder & SetRenderContextNodeIdentifiers(const HdContainerDataSourceHandle &renderContextNodeIdentifiers)
HdTokenDataSource::Handle HdTokenDataSourceHandle
HD_API Builder & SetInputConnections(const HdContainerDataSourceHandle &inputConnections)
TF_DECLARE_PUBLIC_TOKENS(HdMaterialNodeSchemaTokens, HD_API, HD_MATERIAL_NODE_SCHEMA_TOKENS)