HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialInterfaceSchema.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_SCHEMA_H
19 #define PXR_IMAGING_HD_MATERIAL_INTERFACE_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 
30 #include <unordered_map>
31 
32 // --(END CUSTOM CODE: Includes)--
33 
35 
36 // --(BEGIN CUSTOM CODE: Declares)--
37 
38 using TfTokenMap = std::unordered_map<TfToken, TfToken, TfToken::HashFunctor>;
39 using NestedTfTokenMap =
40  std::unordered_map<TfToken, TfTokenMap, TfToken::HashFunctor>;
41 
42 // --(END CUSTOM CODE: Declares)--
43 
44 #define HD_MATERIAL_INTERFACE_SCHEMA_TOKENS \
45  (parameters) \
46  (parameterOrder) \
47 
48 TF_DECLARE_PUBLIC_TOKENS(HdMaterialInterfaceSchemaTokens, HD_API,
50 
51 //-----------------------------------------------------------------------------
52 
53 
54 /// \class HdMaterialInterfaceSchema
55 ///
56 /// The MaterialInterface schema describes a material's interface parameters,
57 /// also known as public UI parameters.
58 ///
60 {
61 public:
62  /// \name Schema retrieval
63  /// @{
64 
65  HdMaterialInterfaceSchema(HdContainerDataSourceHandle container)
66  : HdSchema(container) {}
67 
68  /// @}
69 
70 // --(BEGIN CUSTOM CODE: Schema Methods)--
71 
72  /// Builds and returns a map of reversed interface mappings. If no
73  /// interface mappings were found, returns an empty map.
74  ///
75  /// Interface mappings are mapped like this:
76  /// publicUIName -> [(nodePath, inputName),...]
77  ///
78  /// The returned map of reversed interface mappings is mapped like this:
79  /// nodePath -> (inputName -> publicUIName)
80  HD_API
82 
83 // --(END CUSTOM CODE: Schema Methods)--
84 
85  /// \name Member accessor
86  /// @{
87 
88  /// A container for all the material's interface parameters.
89  HD_API
91 
92  /// Provides the intended order of the interface parameters for UI
93  /// purposes. Any member of 'parameters' that is not found in this list
94  /// can come after all listed members. The order of display groups is
95  /// implicitly encoded. As this list is traversed, display groups are
96  /// ordered by first encounter.
97  HD_API
99 
100  /// @}
101 
102  /// \name Schema construction
103  /// @{
104 
105  /// \deprecated Use Builder instead.
106  ///
107  /// Builds a container data source which includes the provided child data
108  /// sources. Parameters with nullptr values are excluded. This is a
109  /// low-level interface. For cases in which it's desired to define
110  /// the container with a sparse set of child fields, the Builder class
111  /// is often more convenient and readable.
112  HD_API
113  static HdContainerDataSourceHandle
115  const HdContainerDataSourceHandle &parameters,
116  const HdTokenArrayDataSourceHandle &parameterOrder
117  );
118 
119  /// \class HdMaterialInterfaceSchema::Builder
120  ///
121  /// Utility class for setting sparse sets of child data source fields to be
122  /// filled as arguments into BuildRetained. Because all setter methods
123  /// return a reference to the instance, this can be used in the "builder
124  /// pattern" form.
125  class Builder
126  {
127  public:
128  HD_API
130  const HdContainerDataSourceHandle &parameters);
131  HD_API
133  const HdTokenArrayDataSourceHandle &parameterOrder);
134 
135  /// Returns a container data source containing the members set thus far.
136  HD_API
137  HdContainerDataSourceHandle Build();
138 
139  private:
140  HdContainerDataSourceHandle _parameters;
141  HdTokenArrayDataSourceHandle _parameterOrder;
142 
143  };
144 
145  /// @}
146 };
147 
149 
150 #endif
HD_API Builder & SetParameters(const HdContainerDataSourceHandle &parameters)
std::unordered_map< TfToken, TfTokenMap, TfToken::HashFunctor > NestedTfTokenMap
#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 HdTokenArrayDataSourceHandle GetParameterOrder() const
#define HD_MATERIAL_INTERFACE_SCHEMA_TOKENS
HD_API Builder & SetParameterOrder(const HdTokenArrayDataSourceHandle &parameterOrder)
HdTokenArrayDataSource::Handle HdTokenArrayDataSourceHandle
TF_DECLARE_PUBLIC_TOKENS(HdMaterialInterfaceSchemaTokens, HD_API, HD_MATERIAL_INTERFACE_SCHEMA_TOKENS)
HdMaterialInterfaceSchema(HdContainerDataSourceHandle container)
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &parameters, const HdTokenArrayDataSourceHandle &parameterOrder)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API HdMaterialInterfaceParameterContainerSchema GetParameters() const
A container for all the material's interface parameters.
std::unordered_map< TfToken, TfToken, TfToken::HashFunctor > TfTokenMap
HD_API NestedTfTokenMap GetReverseInterfaceMappings() const