HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialInterfaceParameterSchema.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_INTERFACE_PARAMETER_SCHEMA_H
19 #define PXR_IMAGING_HD_MATERIAL_INTERFACE_PARAMETER_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_INTERFACE_PARAMETER_SCHEMA_TOKENS \
37  (displayGroup) \
38  (displayName) \
39  (mappings) \
40 
41 TF_DECLARE_PUBLIC_TOKENS(HdMaterialInterfaceParameterSchemaTokens, HD_API,
43 
44 //-----------------------------------------------------------------------------
45 
46 
47 /// \class HdMaterialInterfaceParameterSchema
48 ///
49 /// The MaterialInterfaceParameter schema describes a single interface
50 /// parameter (public UI parameter).
51 ///
52 /// An interface parameter defines a vector of mappings to material node
53 /// parameters. These mappings indicate which material node parameters should
54 /// be overridden when a value is set on the interface parameter.
55 ///
56 /// For example, the following data sources define a public UI "globalVal" that
57 /// maps to two different node parameters:
58 ///
59 /// ds at: material/<renderContext>/interface/parameters/globalVal/
60 /// mappings/[0]/nodePath = Color_Manipulate
61 ///
62 /// ds at: material/<renderContext>/interface/parameters/globalVal/
63 /// mappings/[0]/inputName = adjustVal
64 ///
65 /// ds at: material/<renderContext>/interface/parameters/globalVal/
66 /// mappings/[1]/nodePath = Color_RetargetLayer
67 ///
68 /// ds at: material/<renderContext>/interface/parameters/globalVal/
69 /// mappings/[1]/inputName = valRemapAmount
70 ///
71 /// The above means that the "globalVal" public UI name maps to the following
72 /// parameter data sources at:
73 ///
74 /// ds at: material/<renderContext>/nodes/Color_Manipulate/parameters/
75 /// adjustVal
76 ///
77 /// ds at: material/<renderContext>/nodes/Color_RetargetLayer/
78 /// parameters/valRemapAmount
79 ///
81 {
82 public:
83  /// \name Schema retrieval
84  /// @{
85 
86  HdMaterialInterfaceParameterSchema(HdContainerDataSourceHandle container)
87  : HdSchema(container) {}
88 
89  /// @}
90 
91 // --(BEGIN CUSTOM CODE: Schema Methods)--
92 // --(END CUSTOM CODE: Schema Methods)--
93 
94  /// \name Member accessor
95  /// @{
96 
97  /// Optional displayGroup. Intended for GUI organization.
98  HD_API
100 
101  /// Optional displayName. Intended for GUI organization.
102  HD_API
104 
105  /// Maps this singular interface parameter to a vector of target node
106  /// parameters. Each mapping target is defined by the InterfaceMappings
107  /// schema.
108  HD_API
110 
111  /// @}
112 
113  /// \name Schema construction
114  /// @{
115 
116  /// \deprecated Use Builder instead.
117  ///
118  /// Builds a container data source which includes the provided child data
119  /// sources. Parameters with nullptr values are excluded. This is a
120  /// low-level interface. For cases in which it's desired to define
121  /// the container with a sparse set of child fields, the Builder class
122  /// is often more convenient and readable.
123  HD_API
124  static HdContainerDataSourceHandle
126  const HdTokenDataSourceHandle &displayGroup,
127  const HdTokenDataSourceHandle &displayName,
128  const HdVectorDataSourceHandle &mappings
129  );
130 
131  /// \class HdMaterialInterfaceParameterSchema::Builder
132  ///
133  /// Utility class for setting sparse sets of child data source fields to be
134  /// filled as arguments into BuildRetained. Because all setter methods
135  /// return a reference to the instance, this can be used in the "builder
136  /// pattern" form.
137  class Builder
138  {
139  public:
140  HD_API
142  const HdTokenDataSourceHandle &displayGroup);
143  HD_API
145  const HdTokenDataSourceHandle &displayName);
146  HD_API
148  const HdVectorDataSourceHandle &mappings);
149 
150  /// Returns a container data source containing the members set thus far.
151  HD_API
152  HdContainerDataSourceHandle Build();
153 
154  private:
155  HdTokenDataSourceHandle _displayGroup;
156  HdTokenDataSourceHandle _displayName;
157  HdVectorDataSourceHandle _mappings;
158 
159  };
160 
161  /// @}
162 };
163 
165 
166 #endif
HD_API Builder & SetDisplayName(const HdTokenDataSourceHandle &displayName)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
#define HD_API
Definition: api.h:23
HD_API Builder & SetDisplayGroup(const HdTokenDataSourceHandle &displayGroup)
HD_API HdTokenDataSourceHandle GetDisplayGroup() const
Optional displayGroup. Intended for GUI organization.
TF_DECLARE_PUBLIC_TOKENS(HdMaterialInterfaceParameterSchemaTokens, HD_API, HD_MATERIAL_INTERFACE_PARAMETER_SCHEMA_TOKENS)
HD_API HdTokenDataSourceHandle GetDisplayName() const
Optional displayName. Intended for GUI organization.
HdMaterialInterfaceParameterSchema(HdContainerDataSourceHandle container)
HD_API HdMaterialInterfaceMappingVectorSchema GetMappings() const
static HD_API HdContainerDataSourceHandle BuildRetained(const HdTokenDataSourceHandle &displayGroup, const HdTokenDataSourceHandle &displayName, const HdVectorDataSourceHandle &mappings)
#define HD_MATERIAL_INTERFACE_PARAMETER_SCHEMA_TOKENS
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API Builder & SetMappings(const HdVectorDataSourceHandle &mappings)
HdTokenDataSource::Handle HdTokenDataSourceHandle