HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sceneGlobalsSchema.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_SCENE_GLOBALS_SCHEMA_H
19 #define PXR_IMAGING_HD_SCENE_GLOBALS_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 #include "pxr/usd/sdf/path.h"
30 // --(END CUSTOM CODE: Includes)--
31 
33 
34 // --(BEGIN CUSTOM CODE: Declares)--
35 // --(END CUSTOM CODE: Declares)--
36 
37 #define HD_SCENE_GLOBALS_SCHEMA_TOKENS \
38  (sceneGlobals) \
39  (primaryCameraPrim) \
40  (activeRenderPassPrim) \
41  (activeRenderSettingsPrim) \
42  (startTimeCode) \
43  (endTimeCode) \
44  (timeCodesPerSecond) \
45  (currentFrame) \
46  (sceneStateId) \
47 
48 TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API,
50 
51 //-----------------------------------------------------------------------------
52 
53 // The HdSceneGlobalsSchema encapsulates "global" state to orchestrate a
54 // render. It currently houses the active render settings and pass prim paths
55 // that describe the information necessary to generate images from a single
56 // invocation of a renderer, the active time sample range and current frame
57 // number that may be relevant to downstream scene indices (e.g. procedural
58 // evaluation), the time codes per second (sometimes informally referred to as
59 // FPS), and the primary camera.
60 //
61 // We shall use the convention of a container data source at the root prim of
62 // the scene index that is populated with this global state. The renderer and
63 // downstream scene indices can query it to configure their behavior as
64 // necessary.
65 //
66 
68 {
69 public:
70  /// \name Schema retrieval
71  /// @{
72 
73  HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
74  : HdSchema(container) {}
75 
76  /// Retrieves a container data source with the schema's default name token
77  /// "sceneGlobals" from the parent container and constructs a
78  /// HdSceneGlobalsSchema instance.
79  /// Because the requested container data source may not exist, the result
80  /// should be checked with IsDefined() or a bool comparison before use.
81  HD_API
83  const HdContainerDataSourceHandle &fromParentContainer);
84 
85  /// @}
86 
87 // --(BEGIN CUSTOM CODE: Schema Methods)--
88 
89  /// Constructs and returns a HdSceneGlobalsSchema from the root prim in the
90  /// scene index. Since the root prim might not have a data source for this
91  /// schema, the result should be checked with IsDefined() or a bool
92  /// conversion before use.
93  ///
94  /// \note This API is preferable to GetFromParent(container).
95  HD_API
98  const HdSceneIndexBaseRefPtr &si);
99 
100  /// Utility method to concretize the convention of parking the
101  /// "sceneGlobals" container at the root prim of the scene index.
102  static const SdfPath&
104  return SdfPath::AbsoluteRootPath();
105  }
106 
107 // --(END CUSTOM CODE: Schema Methods)--
108 
109  /// \name Member accessor
110  /// @{
111 
112  HD_API
114 
115  HD_API
117 
118  HD_API
120 
121  HD_API
123 
124  HD_API
126 
127  HD_API
129 
130  HD_API
132 
133  HD_API
135 
136  /// @}
137 
138  /// \name Schema location
139  /// @{
140 
141  /// Returns a token where the container representing this schema is found in
142  /// a container by default.
143  HD_API
144  static const TfToken &GetSchemaToken();
145 
146  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
147  /// where the container representing this schema is found by default.
148  HD_API
149  static const HdDataSourceLocator &GetDefaultLocator();
150 
151  /// @}
152 
153  /// \name Data source locators for members
154  ///
155  /// The following methods return an HdDataSourceLocator (relative to the
156  /// prim-level data source) where the data source for a member can be found.
157  ///
158  /// This is often useful for checking intersection against the
159  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
160  /// @{
161 
162  /// Prim-level relative data source locator to locate primaryCameraPrim.
163  HD_API
165 
166  /// Prim-level relative data source locator to locate activeRenderPassPrim.
167  HD_API
169 
170  /// Prim-level relative data source locator to locate activeRenderSettingsPrim.
171  HD_API
173 
174  /// Prim-level relative data source locator to locate startTimeCode.
175  HD_API
177 
178  /// Prim-level relative data source locator to locate endTimeCode.
179  HD_API
181 
182  /// Prim-level relative data source locator to locate timeCodesPerSecond.
183  HD_API
185 
186  /// Prim-level relative data source locator to locate currentFrame.
187  HD_API
189 
190  /// Prim-level relative data source locator to locate sceneStateId.
191  HD_API
193  /// @}
194 
195  /// \name Schema construction
196  /// @{
197 
198  /// \deprecated Use Builder instead.
199  ///
200  /// Builds a container data source which includes the provided child data
201  /// sources. Parameters with nullptr values are excluded. This is a
202  /// low-level interface. For cases in which it's desired to define
203  /// the container with a sparse set of child fields, the Builder class
204  /// is often more convenient and readable.
205  HD_API
206  static HdContainerDataSourceHandle
208  const HdPathDataSourceHandle &primaryCameraPrim,
209  const HdPathDataSourceHandle &activeRenderPassPrim,
210  const HdPathDataSourceHandle &activeRenderSettingsPrim,
211  const HdDoubleDataSourceHandle &startTimeCode,
212  const HdDoubleDataSourceHandle &endTimeCode,
213  const HdDoubleDataSourceHandle &timeCodesPerSecond,
214  const HdDoubleDataSourceHandle &currentFrame,
215  const HdIntDataSourceHandle &sceneStateId
216  );
217 
218  /// \class HdSceneGlobalsSchema::Builder
219  ///
220  /// Utility class for setting sparse sets of child data source fields to be
221  /// filled as arguments into BuildRetained. Because all setter methods
222  /// return a reference to the instance, this can be used in the "builder
223  /// pattern" form.
224  class Builder
225  {
226  public:
227  HD_API
229  const HdPathDataSourceHandle &primaryCameraPrim);
230  HD_API
232  const HdPathDataSourceHandle &activeRenderPassPrim);
233  HD_API
235  const HdPathDataSourceHandle &activeRenderSettingsPrim);
236  HD_API
238  const HdDoubleDataSourceHandle &startTimeCode);
239  HD_API
241  const HdDoubleDataSourceHandle &endTimeCode);
242  HD_API
244  const HdDoubleDataSourceHandle &timeCodesPerSecond);
245  HD_API
247  const HdDoubleDataSourceHandle &currentFrame);
248  HD_API
250  const HdIntDataSourceHandle &sceneStateId);
251 
252  /// Returns a container data source containing the members set thus far.
253  HD_API
254  HdContainerDataSourceHandle Build();
255 
256  private:
257  HdPathDataSourceHandle _primaryCameraPrim;
258  HdPathDataSourceHandle _activeRenderPassPrim;
259  HdPathDataSourceHandle _activeRenderSettingsPrim;
260  HdDoubleDataSourceHandle _startTimeCode;
261  HdDoubleDataSourceHandle _endTimeCode;
262  HdDoubleDataSourceHandle _timeCodesPerSecond;
263  HdDoubleDataSourceHandle _currentFrame;
264  HdIntDataSourceHandle _sceneStateId;
265 
266  };
267 
268  /// @}
269 };
270 
272 
273 #endif
HdDoubleDataSource::Handle HdDoubleDataSourceHandle
static SDF_API const SdfPath & AbsoluteRootPath()
HD_API Builder & SetCurrentFrame(const HdDoubleDataSourceHandle &currentFrame)
static HD_API const HdDataSourceLocator & GetTimeCodesPerSecondLocator()
Prim-level relative data source locator to locate timeCodesPerSecond.
HD_API Builder & SetTimeCodesPerSecond(const HdDoubleDataSourceHandle &timeCodesPerSecond)
static HD_API const HdDataSourceLocator & GetActiveRenderSettingsPrimLocator()
Prim-level relative data source locator to locate activeRenderSettingsPrim.
#define HD_API
Definition: api.h:23
HD_API HdPathDataSourceHandle GetPrimaryCameraPrim() const
HD_API HdDoubleDataSourceHandle GetStartTimeCode() const
static HD_API const HdDataSourceLocator & GetSceneStateIdLocator()
Prim-level relative data source locator to locate sceneStateId.
Definition: token.h:70
HD_API HdIntDataSourceHandle GetSceneStateId() const
HD_API HdPathDataSourceHandle GetActiveRenderPassPrim() const
static HD_API HdSceneGlobalsSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HD_API const HdDataSourceLocator & GetPrimaryCameraPrimLocator()
Prim-level relative data source locator to locate primaryCameraPrim.
static HD_API const HdDataSourceLocator & GetDefaultLocator()
HD_API Builder & SetActiveRenderSettingsPrim(const HdPathDataSourceHandle &activeRenderSettingsPrim)
HD_API HdDoubleDataSourceHandle GetCurrentFrame() const
HD_API Builder & SetPrimaryCameraPrim(const HdPathDataSourceHandle &primaryCameraPrim)
static const SdfPath & GetDefaultPrimPath()
Definition: path.h:273
#define HD_SCENE_GLOBALS_SCHEMA_TOKENS
static HD_API HdContainerDataSourceHandle BuildRetained(const HdPathDataSourceHandle &primaryCameraPrim, const HdPathDataSourceHandle &activeRenderPassPrim, const HdPathDataSourceHandle &activeRenderSettingsPrim, const HdDoubleDataSourceHandle &startTimeCode, const HdDoubleDataSourceHandle &endTimeCode, const HdDoubleDataSourceHandle &timeCodesPerSecond, const HdDoubleDataSourceHandle &currentFrame, const HdIntDataSourceHandle &sceneStateId)
HD_API HdPathDataSourceHandle GetActiveRenderSettingsPrim() const
static HD_API const HdDataSourceLocator & GetCurrentFrameLocator()
Prim-level relative data source locator to locate currentFrame.
HD_API HdDoubleDataSourceHandle GetEndTimeCode() const
HD_API Builder & SetActiveRenderPassPrim(const HdPathDataSourceHandle &activeRenderPassPrim)
HD_API Builder & SetSceneStateId(const HdIntDataSourceHandle &sceneStateId)
static HD_API const HdDataSourceLocator & GetStartTimeCodeLocator()
Prim-level relative data source locator to locate startTimeCode.
TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API, HD_SCENE_GLOBALS_SCHEMA_TOKENS)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HD_API Builder & SetStartTimeCode(const HdDoubleDataSourceHandle &startTimeCode)
HD_API HdDoubleDataSourceHandle GetTimeCodesPerSecond() const
static HD_API HdSceneGlobalsSchema GetFromSceneIndex(const HdSceneIndexBaseRefPtr &si)
static HD_API const HdDataSourceLocator & GetEndTimeCodeLocator()
Prim-level relative data source locator to locate endTimeCode.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const TfToken & GetSchemaToken()
HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
HdIntDataSource::Handle HdIntDataSourceHandle
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HdPathDataSource::Handle HdPathDataSourceHandle
static HD_API const HdDataSourceLocator & GetActiveRenderPassPrimLocator()
Prim-level relative data source locator to locate activeRenderPassPrim.
HD_API Builder & SetEndTimeCode(const HdDoubleDataSourceHandle &endTimeCode)