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 
49 /// \class HdMaterialNodeSchema
50 ///
51 /// The MaterialNode schema is a container schema that defines a particular
52 /// node in a material network.
53 ///
54 /// A material node defines its connections to other nodes via the
55 /// "inputConnections" member. For example, "albedo" would define that it
56 /// receives its value from its connection to the node "Color_UnPreMult" and
57 /// the output "resultRGB" with the following data sources:
58 ///
59 /// ds at: material/<renderContext>/nodes/MaterialLayer/inputConnections
60 /// /albedo/[0]/upstreamNodePath = Color_UnPreMult
61 ///
62 /// ds at: material/<renderContext>/nodes/MaterialLayer/inputConnections
63 /// /albedo/[0]/upstreamNodeOutputName = resultRGB
64 ///
66 {
67 public:
68  /// \name Schema retrieval
69  /// @{
70 
71  HdMaterialNodeSchema(HdContainerDataSourceHandle container)
72  : HdSchema(container) {}
73 
74  /// @}
75 
76 // --(BEGIN CUSTOM CODE: Schema Methods)--
77 // --(END CUSTOM CODE: Schema Methods)--
78 
79  /// \name Member accessor
80  /// @{
81 
82  /// Maps parameter names to node parameters. Each node parameter is a
83  /// container that is defined by the MaterialNodeParameter schema. Note
84  /// that parameters are inputs that supply their value directly.
85  HD_API
87 
88  /// Maps input names to vectors of connections. Each connection is defined
89  /// by the MaterialConnection schema. Note that inputConnections are
90  /// inputs that get their value from data flow over the connection.
91  HD_API
93 
94  /// This identifies the shader the node represents. The
95  /// renderContextNodeIdentifier container can store alternative values for
96  /// this. A consumer which is interested in a specific render context
97  /// should check for that token within renderContextNodeIdentifiers and
98  /// fall back on this value in its absence.
99  HD_API
101 
102  /// A shading node can hold a nodeIdentifier value for multiple render
103  /// contexts at once. This allows multiple renderer target representations
104  /// to coexist in the same renderable scene. The contents of this
105  /// container are alternate possible values for nodeIdentifier. A consumer
106  /// which is interested in a specific render context should check for that
107  /// token within this container and fall back on nodeIdentifier in its
108  /// absence.
109  HD_API
110  HdContainerDataSourceHandle GetRenderContextNodeIdentifiers() const;
111 
112  /// Rather than having an identifier, a shader can be specified by other
113  /// information.
114  HD_API
115  HdContainerDataSourceHandle GetNodeTypeInfo() const;
116 
117  /// @}
118 
119  /// \name Schema construction
120  /// @{
121 
122  /// \deprecated Use Builder instead.
123  ///
124  /// Builds a container data source which includes the provided child data
125  /// sources. Parameters with nullptr values are excluded. This is a
126  /// low-level interface. For cases in which it's desired to define
127  /// the container with a sparse set of child fields, the Builder class
128  /// is often more convenient and readable.
129  HD_API
130  static HdContainerDataSourceHandle
132  const HdContainerDataSourceHandle &parameters,
133  const HdContainerDataSourceHandle &inputConnections,
134  const HdTokenDataSourceHandle &nodeIdentifier,
135  const HdContainerDataSourceHandle &renderContextNodeIdentifiers,
136  const HdContainerDataSourceHandle &nodeTypeInfo
137  );
138 
139  /// \class HdMaterialNodeSchema::Builder
140  ///
141  /// Utility class for setting sparse sets of child data source fields to be
142  /// filled as arguments into BuildRetained. Because all setter methods
143  /// return a reference to the instance, this can be used in the "builder
144  /// pattern" form.
145  class Builder
146  {
147  public:
148  HD_API
150  const HdContainerDataSourceHandle &parameters);
151  HD_API
153  const HdContainerDataSourceHandle &inputConnections);
154  HD_API
156  const HdTokenDataSourceHandle &nodeIdentifier);
157  HD_API
159  const HdContainerDataSourceHandle &renderContextNodeIdentifiers);
160  HD_API
162  const HdContainerDataSourceHandle &nodeTypeInfo);
163 
164  /// Returns a container data source containing the members set thus far.
165  HD_API
166  HdContainerDataSourceHandle Build();
167 
168  private:
169  HdContainerDataSourceHandle _parameters;
170  HdContainerDataSourceHandle _inputConnections;
171  HdTokenDataSourceHandle _nodeIdentifier;
172  HdContainerDataSourceHandle _renderContextNodeIdentifiers;
173  HdContainerDataSourceHandle _nodeTypeInfo;
174 
175  };
176 
177  /// @}
178 };
179 
181 
182 #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)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
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
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)