HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderVarSchema.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_RENDER_VAR_SCHEMA_H
19 #define PXR_IMAGING_HD_RENDER_VAR_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
24 
25 #include "pxr/imaging/hd/schema.h"
26 
27 // --(BEGIN CUSTOM CODE: Includes)--
28 // --(END CUSTOM CODE: Includes)--
29 
31 
32 // --(BEGIN CUSTOM CODE: Declares)--
33 // --(END CUSTOM CODE: Declares)--
34 
35 #define HD_RENDER_VAR_SCHEMA_TOKENS \
36  (renderVar) \
37  (path) \
38  (dataType) \
39  (sourceName) \
40  (sourceType) \
41  (namespacedSettings) \
42 
43 TF_DECLARE_PUBLIC_TOKENS(HdRenderVarSchemaTokens, HD_API,
45 
46 //-----------------------------------------------------------------------------
47 
48 
49 /// \class HdRenderVarSchema
50 ///
52 {
53 public:
54  /// \name Schema retrieval
55  /// @{
56 
57  HdRenderVarSchema(HdContainerDataSourceHandle container)
58  : HdSchema(container) {}
59 
60  /// Retrieves a container data source with the schema's default name token
61  /// "renderVar" from the parent container and constructs a
62  /// HdRenderVarSchema instance.
63  /// Because the requested container data source may not exist, the result
64  /// should be checked with IsDefined() or a bool comparison before use.
65  HD_API
67  const HdContainerDataSourceHandle &fromParentContainer);
68 
69  /// @}
70 
71 // --(BEGIN CUSTOM CODE: Schema Methods)--
72 // --(END CUSTOM CODE: Schema Methods)--
73 
74  /// \name Member accessor
75  /// @{
76 
77  HD_API
79 
80  HD_API
82 
83  HD_API
85 
86  HD_API
88 
89  HD_API
90  HdContainerDataSourceHandle GetNamespacedSettings() const;
91 
92  /// @}
93 
94  /// \name Schema location
95  /// @{
96 
97  /// Returns a token where the container representing this schema is found in
98  /// a container by default.
99  HD_API
100  static const TfToken &GetSchemaToken();
101 
102  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
103  /// where the container representing this schema is found by default.
104  HD_API
105  static const HdDataSourceLocator &GetDefaultLocator();
106 
107  /// @}
108 
109  /// \name Data source locators for members
110  ///
111  /// The following methods return an HdDataSourceLocator (relative to the
112  /// prim-level data source) where the data source for a member can be found.
113  ///
114  /// This is often useful for checking intersection against the
115  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
116  /// @{
117 
118  /// Prim-level relative data source locator to locate namespacedSettings.
119  HD_API
121  /// @}
122 
123  /// \name Schema construction
124  /// @{
125 
126  /// \deprecated Use Builder instead.
127  ///
128  /// Builds a container data source which includes the provided child data
129  /// sources. Parameters with nullptr values are excluded. This is a
130  /// low-level interface. For cases in which it's desired to define
131  /// the container with a sparse set of child fields, the Builder class
132  /// is often more convenient and readable.
133  HD_API
134  static HdContainerDataSourceHandle
138  const HdTokenDataSourceHandle &sourceName,
139  const HdTokenDataSourceHandle &sourceType,
140  const HdContainerDataSourceHandle &namespacedSettings
141  );
142 
143  /// \class HdRenderVarSchema::Builder
144  ///
145  /// Utility class for setting sparse sets of child data source fields to be
146  /// filled as arguments into BuildRetained. Because all setter methods
147  /// return a reference to the instance, this can be used in the "builder
148  /// pattern" form.
149  class Builder
150  {
151  public:
152  HD_API
153  Builder &SetPath(
155  HD_API
158  HD_API
160  const HdTokenDataSourceHandle &sourceName);
161  HD_API
163  const HdTokenDataSourceHandle &sourceType);
164  HD_API
166  const HdContainerDataSourceHandle &namespacedSettings);
167 
168  /// Returns a container data source containing the members set thus far.
169  HD_API
170  HdContainerDataSourceHandle Build();
171 
172  private:
174  HdTokenDataSourceHandle _dataType;
175  HdTokenDataSourceHandle _sourceName;
176  HdTokenDataSourceHandle _sourceType;
177  HdContainerDataSourceHandle _namespacedSettings;
178 
179  };
180 
181  /// @}
182 };
183 
185 
186 #endif
static HD_API HdRenderVarSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
HD_API Builder & SetPath(const HdPathDataSourceHandle &path)
HD_API HdContainerDataSourceHandle GetNamespacedSettings() const
HD_API Builder & SetSourceName(const HdTokenDataSourceHandle &sourceName)
HD_API Builder & SetDataType(const HdTokenDataSourceHandle &dataType)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
#define HD_API
Definition: api.h:23
HdRenderVarSchema(HdContainerDataSourceHandle container)
static HD_API const HdDataSourceLocator & GetNamespacedSettingsLocator()
Prim-level relative data source locator to locate namespacedSettings.
Definition: token.h:70
HD_API Builder & SetNamespacedSettings(const HdContainerDataSourceHandle &namespacedSettings)
HD_API Builder & SetSourceType(const HdTokenDataSourceHandle &sourceType)
#define HD_RENDER_VAR_SCHEMA_TOKENS
static HD_API const TfToken & GetSchemaToken()
static HD_API const HdDataSourceLocator & GetDefaultLocator()
TF_DECLARE_PUBLIC_TOKENS(HdRenderVarSchemaTokens, HD_API, HD_RENDER_VAR_SCHEMA_TOKENS)
HD_API HdPathDataSourceHandle GetPath() const
HD_API HdTokenDataSourceHandle GetSourceName() const
HD_API HdTokenDataSourceHandle GetDataType() const
static HD_API HdContainerDataSourceHandle BuildRetained(const HdPathDataSourceHandle &path, const HdTokenDataSourceHandle &dataType, const HdTokenDataSourceHandle &sourceName, const HdTokenDataSourceHandle &sourceType, const HdContainerDataSourceHandle &namespacedSettings)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API HdTokenDataSourceHandle GetSourceType() const
HdPathDataSource::Handle HdPathDataSourceHandle
HUSD_API const char * dataType()
HdTokenDataSource::Handle HdTokenDataSourceHandle