HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialNetworkSchema.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_NETWORK_SCHEMA_H
19 #define PXR_IMAGING_HD_MATERIAL_NETWORK_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_NETWORK_SCHEMA_TOKENS \
37  (nodes) \
38  (terminals) \
39  (interfaceMappings) \
40  (config) \
41 
42 TF_DECLARE_PUBLIC_TOKENS(HdMaterialNetworkSchemaTokens, HD_API,
44 
45 //-----------------------------------------------------------------------------
46 
47 // The MaterialNetwork schema is a container schema that defines a material
48 // for a specific render context. A network is composed of nodes, terminals,
49 // and interface mappings.
50 //
51 // Interface mappings define the material's public UI. For example, the
52 // following data sources define a public UI "globalVal" that maps to two
53 // different node parameters:
54 //
55 // ds at: material/<renderContext>/interfaceMappings/globalVal/[0]/ nodePath =
56 // Color_Manipulate
57 //
58 // ds at: material/<renderContext>/interfaceMappings/globalVal/[0]/ inputName
59 // = adjustVal
60 //
61 // ds at: material/<renderContext>/interfaceMappings/globalVal/[1]/ nodePath =
62 // Color_RetargetLayer
63 //
64 // ds at: material/<renderContext>/interfaceMappings/globalVal/[1]/ inputName
65 // = valRemapAmount
66 //
67 // The above means that the "globalVal" public UI name maps to the following
68 // parameter data sources at:
69 //
70 // ds at: material/<renderContext>/nodes/Color_Manipulate/parameters/
71 // adjustVal
72 //
73 // ds at: material/<renderContext>/nodes/Color_RetargetLayer/
74 // parameters/valRemapAmount
75 //
76 // See also the Material schema documentation for ASCII art diagram.
77 //
78 
80 {
81 public:
82  /// \name Schema retrieval
83  /// @{
84 
85  HdMaterialNetworkSchema(HdContainerDataSourceHandle container)
86  : HdSchema(container) {}
87 
88  /// @}
89 
90 // --(BEGIN CUSTOM CODE: Schema Methods)--
91 // --(END CUSTOM CODE: Schema Methods)--
92 
93  /// \name Member accessor
94  /// @{
95 
96  /// Maps node names to material nodes. Each material node is a container
97  /// that is defined by the MaterialNode schema. The topology of the
98  /// network is expressed by the connections found on each material node.
99  HD_API
101 
102  /// Maps terminal names to material connections. Each connection is a
103  /// container defined by the MaterialConnection schema.
104  HD_API
106 
107  /// Maps interface names (public UI names) to vectors of material node
108  /// parameters. Each mapped material node parameter is a container defined
109  /// by the InterfaceMappings schema.
110  HD_API
112 
113  HD_API
115 
116  /// @}
117 
118  /// \name Schema construction
119  /// @{
120 
121  /// \deprecated Use Builder instead.
122  ///
123  /// Builds a container data source which includes the provided child data
124  /// sources. Parameters with nullptr values are excluded. This is a
125  /// low-level interface. For cases in which it's desired to define
126  /// the container with a sparse set of child fields, the Builder class
127  /// is often more convenient and readable.
128  HD_API
129  static HdContainerDataSourceHandle
131  const HdContainerDataSourceHandle &nodes,
132  const HdContainerDataSourceHandle &terminals,
133  const HdContainerDataSourceHandle &interfaceMappings,
134  const HdContainerDataSourceHandle &config
135  );
136 
137  /// \class HdMaterialNetworkSchema::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
147  Builder &SetNodes(
148  const HdContainerDataSourceHandle &nodes);
149  HD_API
151  const HdContainerDataSourceHandle &terminals);
152  HD_API
154  const HdContainerDataSourceHandle &interfaceMappings);
155  HD_API
157  const HdContainerDataSourceHandle &config);
158 
159  /// Returns a container data source containing the members set thus far.
160  HD_API
161  HdContainerDataSourceHandle Build();
162 
163  private:
164  HdContainerDataSourceHandle _nodes;
165  HdContainerDataSourceHandle _terminals;
166  HdContainerDataSourceHandle _interfaceMappings;
167  HdContainerDataSourceHandle _config;
168 
169  };
170 
171  /// @}
172 };
173 
175 
176 #endif
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &nodes, const HdContainerDataSourceHandle &terminals, const HdContainerDataSourceHandle &interfaceMappings, const HdContainerDataSourceHandle &config)
#define HD_API
Definition: api.h:23
HD_API HdMaterialNodeContainerSchema GetNodes() const
HD_API HdSampledDataSourceContainerSchema GetConfig() const
HD_API Builder & SetNodes(const HdContainerDataSourceHandle &nodes)
TF_DECLARE_PUBLIC_TOKENS(HdMaterialNetworkSchemaTokens, HD_API, HD_MATERIAL_NETWORK_SCHEMA_TOKENS)
#define HD_MATERIAL_NETWORK_SCHEMA_TOKENS
HD_API Builder & SetTerminals(const HdContainerDataSourceHandle &terminals)
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API Builder & SetConfig(const HdContainerDataSourceHandle &config)
HdMaterialNetworkSchema(HdContainerDataSourceHandle container)
HD_API HdMaterialConnectionContainerSchema GetTerminals() const
HD_API Builder & SetInterfaceMappings(const HdContainerDataSourceHandle &interfaceMappings)
HD_API HdMaterialInterfaceMappingsContainerSchema GetInterfaceMappings() const