HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
legacyTaskSchema.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_LEGACY_TASK_SCHEMA_H
19 #define PXR_IMAGING_HD_LEGACY_TASK_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)--
29 // --(END CUSTOM CODE: Includes)--
30 
32 
33 // --(BEGIN CUSTOM CODE: Declares)--
34 
37 
40 
41 using HdLegacyTaskFactorySharedPtr = std::shared_ptr<class HdLegacyTaskFactory>;
46 
47 
48 // --(END CUSTOM CODE: Declares)--
49 
50 #define HD_LEGACY_TASK_SCHEMA_TOKENS \
51  (task) \
52  (factory) \
53  (parameters) \
54  (collection) \
55  (renderTags) \
56 
57 TF_DECLARE_PUBLIC_TOKENS(HdLegacyTaskSchemaTokens, HD_API,
59 
60 //-----------------------------------------------------------------------------
61 
62 
63 /// \class HdLegacyTaskSchema
64 ///
65 /// The HdLegacyTaskSchema specifies a Hydra task by providing a task factory
66 /// and data.
67 ///
69 {
70 public:
71  /// \name Schema retrieval
72  /// @{
73 
74  HdLegacyTaskSchema(HdContainerDataSourceHandle container)
75  : HdSchema(container) {}
76 
77  /// Retrieves a container data source with the schema's default name token
78  /// "task" from the parent container and constructs a
79  /// HdLegacyTaskSchema instance.
80  /// Because the requested container data source may not exist, the result
81  /// should be checked with IsDefined() or a bool comparison before use.
82  HD_API
84  const HdContainerDataSourceHandle &fromParentContainer);
85 
86  /// @}
87 
88 // --(BEGIN CUSTOM CODE: Schema Methods)--
89 // --(END CUSTOM CODE: Schema Methods)--
90 
91  /// \name Member accessor
92  /// @{
93 
94  HD_API
96 
97  /// Parameters for task. Type depends on task type. E.g.
98  /// HdxRenderTaskParams if the factory produces HdxRenderTask instances.
99  HD_API
100  HdSampledDataSourceHandle GetParameters() const;
101 
102  HD_API
104 
105  HD_API
107 
108  /// @}
109 
110  /// \name Schema location
111  /// @{
112 
113  /// Returns a token where the container representing this schema is found in
114  /// a container by default.
115  HD_API
116  static const TfToken &GetSchemaToken();
117 
118  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
119  /// where the container representing this schema is found by default.
120  HD_API
121  static const HdDataSourceLocator &GetDefaultLocator();
122 
123  /// @}
124 
125  /// \name Data source locators for members
126  ///
127  /// The following methods return an HdDataSourceLocator (relative to the
128  /// prim-level data source) where the data source for a member can be found.
129  ///
130  /// This is often useful for checking intersection against the
131  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
132  /// @{
133 
134  /// Prim-level relative data source locator to locate factory.
135  HD_API
136  static const HdDataSourceLocator &GetFactoryLocator();
137 
138  /// Prim-level relative data source locator to locate parameters.
139  HD_API
141 
142  /// Prim-level relative data source locator to locate collection.
143  HD_API
145 
146  /// Prim-level relative data source locator to locate renderTags.
147  HD_API
149  /// @}
150 
151  /// \name Schema construction
152  /// @{
153 
154  /// \deprecated Use Builder instead.
155  ///
156  /// Builds a container data source which includes the provided child data
157  /// sources. Parameters with nullptr values are excluded. This is a
158  /// low-level interface. For cases in which it's desired to define
159  /// the container with a sparse set of child fields, the Builder class
160  /// is often more convenient and readable.
161  HD_API
162  static HdContainerDataSourceHandle
165  const HdSampledDataSourceHandle &parameters,
166  const HdRprimCollectionDataSourceHandle &collection,
167  const HdTokenVectorDataSourceHandle &renderTags
168  );
169 
170  /// \class HdLegacyTaskSchema::Builder
171  ///
172  /// Utility class for setting sparse sets of child data source fields to be
173  /// filled as arguments into BuildRetained. Because all setter methods
174  /// return a reference to the instance, this can be used in the "builder
175  /// pattern" form.
176  class Builder
177  {
178  public:
179  HD_API
181  const HdLegacyTaskFactoryDataSourceHandle &factory);
182  HD_API
184  const HdSampledDataSourceHandle &parameters);
185  HD_API
187  const HdRprimCollectionDataSourceHandle &collection);
188  HD_API
190  const HdTokenVectorDataSourceHandle &renderTags);
191 
192  /// Returns a container data source containing the members set thus far.
193  HD_API
194  HdContainerDataSourceHandle Build();
195 
196  private:
198  HdSampledDataSourceHandle _parameters;
200  HdTokenVectorDataSourceHandle _renderTags;
201 
202  };
203 
204  /// @}
205 };
206 
208 
209 #endif
HD_API HdTokenVectorDataSourceHandle GetRenderTags() const
TF_DECLARE_PUBLIC_TOKENS(HdLegacyTaskSchemaTokens, HD_API, HD_LEGACY_TASK_SCHEMA_TOKENS)
static HD_API const HdDataSourceLocator & GetDefaultLocator()
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HD_API HdRprimCollectionDataSourceHandle GetCollection() const
HdRprimCollectionDataSource::Handle HdRprimCollectionDataSourceHandle
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static HD_API const HdDataSourceLocator & GetCollectionLocator()
Prim-level relative data source locator to locate collection.
static HD_API const TfToken & GetSchemaToken()
#define HD_API
Definition: api.h:23
HD_API Builder & SetParameters(const HdSampledDataSourceHandle &parameters)
HdLegacyTaskFactoryDataSource::Handle HdLegacyTaskFactoryDataSourceHandle
Definition: token.h:70
HD_API Builder & SetRenderTags(const HdTokenVectorDataSourceHandle &renderTags)
static HD_API const HdDataSourceLocator & GetRenderTagsLocator()
Prim-level relative data source locator to locate renderTags.
HdTokenVectorDataSource::Handle HdTokenVectorDataSourceHandle
HD_API Builder & SetFactory(const HdLegacyTaskFactoryDataSourceHandle &factory)
HD_API Builder & SetCollection(const HdRprimCollectionDataSourceHandle &collection)
static HD_API HdLegacyTaskSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HD_API const HdDataSourceLocator & GetFactoryLocator()
Prim-level relative data source locator to locate factory.
HdLegacyTaskSchema(HdContainerDataSourceHandle container)
HD_API HdSampledDataSourceHandle GetParameters() const
#define HD_LEGACY_TASK_SCHEMA_TOKENS
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const HdDataSourceLocator & GetParametersLocator()
Prim-level relative data source locator to locate parameters.
static HD_API HdContainerDataSourceHandle BuildRetained(const HdLegacyTaskFactoryDataSourceHandle &factory, const HdSampledDataSourceHandle &parameters, const HdRprimCollectionDataSourceHandle &collection, const HdTokenVectorDataSourceHandle &renderTags)
std::shared_ptr< class HdLegacyTaskFactory > HdLegacyTaskFactorySharedPtr
HD_API HdLegacyTaskFactoryDataSourceHandle GetFactory() const
void * Handle
Definition: plugin.h:27