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 // The HdLegacyTaskSchema specifies a Hydra task by providing a task factory
63 // and data.
64 //
65 
67 {
68 public:
69  /// \name Schema retrieval
70  /// @{
71 
72  HdLegacyTaskSchema(HdContainerDataSourceHandle container)
73  : HdSchema(container) {}
74 
75  /// Retrieves a container data source with the schema's default name token
76  /// "task" from the parent container and constructs a
77  /// HdLegacyTaskSchema instance.
78  /// Because the requested container data source may not exist, the result
79  /// should be checked with IsDefined() or a bool comparison before use.
80  HD_API
82  const HdContainerDataSourceHandle &fromParentContainer);
83 
84  /// @}
85 
86 // --(BEGIN CUSTOM CODE: Schema Methods)--
87 // --(END CUSTOM CODE: Schema Methods)--
88 
89  /// \name Member accessor
90  /// @{
91 
92  HD_API
94 
95  /// Parameters for task. Type depends on task type. E.g.
96  /// HdxRenderTaskParams if the factory produces HdxRenderTask instances.
97  HD_API
98  HdSampledDataSourceHandle GetParameters() const;
99 
100  HD_API
102 
103  HD_API
105 
106  /// @}
107 
108  /// \name Schema location
109  /// @{
110 
111  /// Returns a token where the container representing this schema is found in
112  /// a container by default.
113  HD_API
114  static const TfToken &GetSchemaToken();
115 
116  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
117  /// where the container representing this schema is found by default.
118  HD_API
119  static const HdDataSourceLocator &GetDefaultLocator();
120 
121  /// @}
122 
123  /// \name Data source locators for members
124  ///
125  /// The following methods return an HdDataSourceLocator (relative to the
126  /// prim-level data source) where the data source for a member can be found.
127  ///
128  /// This is often useful for checking intersection against the
129  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
130  /// @{
131 
132  /// Prim-level relative data source locator to locate factory.
133  HD_API
134  static const HdDataSourceLocator &GetFactoryLocator();
135 
136  /// Prim-level relative data source locator to locate parameters.
137  HD_API
139 
140  /// Prim-level relative data source locator to locate collection.
141  HD_API
143 
144  /// Prim-level relative data source locator to locate renderTags.
145  HD_API
147  /// @}
148 
149  /// \name Schema construction
150  /// @{
151 
152  /// \deprecated Use Builder instead.
153  ///
154  /// Builds a container data source which includes the provided child data
155  /// sources. Parameters with nullptr values are excluded. This is a
156  /// low-level interface. For cases in which it's desired to define
157  /// the container with a sparse set of child fields, the Builder class
158  /// is often more convenient and readable.
159  HD_API
160  static HdContainerDataSourceHandle
163  const HdSampledDataSourceHandle &parameters,
164  const HdRprimCollectionDataSourceHandle &collection,
165  const HdTokenVectorDataSourceHandle &renderTags
166  );
167 
168  /// \class HdLegacyTaskSchema::Builder
169  ///
170  /// Utility class for setting sparse sets of child data source fields to be
171  /// filled as arguments into BuildRetained. Because all setter methods
172  /// return a reference to the instance, this can be used in the "builder
173  /// pattern" form.
174  class Builder
175  {
176  public:
177  HD_API
179  const HdLegacyTaskFactoryDataSourceHandle &factory);
180  HD_API
182  const HdSampledDataSourceHandle &parameters);
183  HD_API
185  const HdRprimCollectionDataSourceHandle &collection);
186  HD_API
188  const HdTokenVectorDataSourceHandle &renderTags);
189 
190  /// Returns a container data source containing the members set thus far.
191  HD_API
192  HdContainerDataSourceHandle Build();
193 
194  private:
196  HdSampledDataSourceHandle _parameters;
198  HdTokenVectorDataSourceHandle _renderTags;
199 
200  };
201 
202  /// @}
203 };
204 
206 
207 #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
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.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
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