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 
50 {
51 public:
52  /// \name Schema retrieval
53  /// @{
54 
55  HdRenderVarSchema(HdContainerDataSourceHandle container)
56  : HdSchema(container) {}
57 
58  /// Retrieves a container data source with the schema's default name token
59  /// "renderVar" from the parent container and constructs a
60  /// HdRenderVarSchema instance.
61  /// Because the requested container data source may not exist, the result
62  /// should be checked with IsDefined() or a bool comparison before use.
63  HD_API
65  const HdContainerDataSourceHandle &fromParentContainer);
66 
67  /// @}
68 
69 // --(BEGIN CUSTOM CODE: Schema Methods)--
70 // --(END CUSTOM CODE: Schema Methods)--
71 
72  /// \name Member accessor
73  /// @{
74 
75  HD_API
77 
78  HD_API
80 
81  HD_API
83 
84  HD_API
86 
87  HD_API
88  HdContainerDataSourceHandle GetNamespacedSettings() const;
89 
90  /// @}
91 
92  /// \name Schema location
93  /// @{
94 
95  /// Returns a token where the container representing this schema is found in
96  /// a container by default.
97  HD_API
98  static const TfToken &GetSchemaToken();
99 
100  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
101  /// where the container representing this schema is found by default.
102  HD_API
103  static const HdDataSourceLocator &GetDefaultLocator();
104 
105  /// @}
106 
107  /// \name Data source locators for members
108  ///
109  /// The following methods return an HdDataSourceLocator (relative to the
110  /// prim-level data source) where the data source for a member can be found.
111  ///
112  /// This is often useful for checking intersection against the
113  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
114  /// @{
115 
116  /// Prim-level relative data source locator to locate namespacedSettings.
117  HD_API
119  /// @}
120 
121  /// \name Schema construction
122  /// @{
123 
124  /// \deprecated Use Builder instead.
125  ///
126  /// Builds a container data source which includes the provided child data
127  /// sources. Parameters with nullptr values are excluded. This is a
128  /// low-level interface. For cases in which it's desired to define
129  /// the container with a sparse set of child fields, the Builder class
130  /// is often more convenient and readable.
131  HD_API
132  static HdContainerDataSourceHandle
136  const HdTokenDataSourceHandle &sourceName,
137  const HdTokenDataSourceHandle &sourceType,
138  const HdContainerDataSourceHandle &namespacedSettings
139  );
140 
141  /// \class HdRenderVarSchema::Builder
142  ///
143  /// Utility class for setting sparse sets of child data source fields to be
144  /// filled as arguments into BuildRetained. Because all setter methods
145  /// return a reference to the instance, this can be used in the "builder
146  /// pattern" form.
147  class Builder
148  {
149  public:
150  HD_API
151  Builder &SetPath(
153  HD_API
156  HD_API
158  const HdTokenDataSourceHandle &sourceName);
159  HD_API
161  const HdTokenDataSourceHandle &sourceType);
162  HD_API
164  const HdContainerDataSourceHandle &namespacedSettings);
165 
166  /// Returns a container data source containing the members set thus far.
167  HD_API
168  HdContainerDataSourceHandle Build();
169 
170  private:
172  HdTokenDataSourceHandle _dataType;
173  HdTokenDataSourceHandle _sourceName;
174  HdTokenDataSourceHandle _sourceType;
175  HdContainerDataSourceHandle _namespacedSettings;
176 
177  };
178 
179  /// @}
180 };
181 
183 
184 #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)
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
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
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