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 
54 /// \class HdSceneGlobalsSchema
55 ///
56 /// The HdSceneGlobalsSchema encapsulates "global" state to orchestrate a
57 /// render. It currently houses the active render settings and pass prim paths
58 /// that describe the information necessary to generate images from a single
59 /// invocation of a renderer, the active time sample range and current frame
60 /// number that may be relevant to downstream scene indices (e.g. procedural
61 /// evaluation), the time codes per second (sometimes informally referred to as
62 /// FPS), and the primary camera.
63 ///
64 /// We shall use the convention of a container data source at the root prim of
65 /// the scene index that is populated with this global state. The renderer and
66 /// downstream scene indices can query it to configure their behavior as
67 /// necessary.
68 ///
70 {
71 public:
72  /// \name Schema retrieval
73  /// @{
74 
75  HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
76  : HdSchema(container) {}
77 
78  /// Retrieves a container data source with the schema's default name token
79  /// "sceneGlobals" from the parent container and constructs a
80  /// HdSceneGlobalsSchema instance.
81  /// Because the requested container data source may not exist, the result
82  /// should be checked with IsDefined() or a bool comparison before use.
83  HD_API
85  const HdContainerDataSourceHandle &fromParentContainer);
86 
87  /// @}
88 
89 // --(BEGIN CUSTOM CODE: Schema Methods)--
90 
91  /// Constructs and returns a HdSceneGlobalsSchema from the root prim in the
92  /// scene index. Since the root prim might not have a data source for this
93  /// schema, the result should be checked with IsDefined() or a bool
94  /// conversion before use.
95  ///
96  /// \note This API is preferable to GetFromParent(container).
97  HD_API
100  const HdSceneIndexBaseRefPtr &si);
101 
102  /// Utility method to concretize the convention of parking the
103  /// "sceneGlobals" container at the root prim of the scene index.
104  static const SdfPath&
106  return SdfPath::AbsoluteRootPath();
107  }
108 
109 // --(END CUSTOM CODE: Schema Methods)--
110 
111  /// \name Member accessor
112  /// @{
113 
114  HD_API
116 
117  HD_API
119 
120  HD_API
122 
123  HD_API
125 
126  HD_API
128 
129  HD_API
131 
132  HD_API
134 
135  HD_API
137 
138  /// @}
139 
140  /// \name Schema location
141  /// @{
142 
143  /// Returns a token where the container representing this schema is found in
144  /// a container by default.
145  HD_API
146  static const TfToken &GetSchemaToken();
147 
148  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
149  /// where the container representing this schema is found by default.
150  HD_API
151  static const HdDataSourceLocator &GetDefaultLocator();
152 
153  /// @}
154 
155  /// \name Data source locators for members
156  ///
157  /// The following methods return an HdDataSourceLocator (relative to the
158  /// prim-level data source) where the data source for a member can be found.
159  ///
160  /// This is often useful for checking intersection against the
161  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
162  /// @{
163 
164  /// Prim-level relative data source locator to locate primaryCameraPrim.
165  HD_API
167 
168  /// Prim-level relative data source locator to locate activeRenderPassPrim.
169  HD_API
171 
172  /// Prim-level relative data source locator to locate activeRenderSettingsPrim.
173  HD_API
175 
176  /// Prim-level relative data source locator to locate startTimeCode.
177  HD_API
179 
180  /// Prim-level relative data source locator to locate endTimeCode.
181  HD_API
183 
184  /// Prim-level relative data source locator to locate timeCodesPerSecond.
185  HD_API
187 
188  /// Prim-level relative data source locator to locate currentFrame.
189  HD_API
191 
192  /// Prim-level relative data source locator to locate sceneStateId.
193  HD_API
195  /// @}
196 
197  /// \name Schema construction
198  /// @{
199 
200  /// \deprecated Use Builder instead.
201  ///
202  /// Builds a container data source which includes the provided child data
203  /// sources. Parameters with nullptr values are excluded. This is a
204  /// low-level interface. For cases in which it's desired to define
205  /// the container with a sparse set of child fields, the Builder class
206  /// is often more convenient and readable.
207  HD_API
208  static HdContainerDataSourceHandle
210  const HdPathDataSourceHandle &primaryCameraPrim,
211  const HdPathDataSourceHandle &activeRenderPassPrim,
212  const HdPathDataSourceHandle &activeRenderSettingsPrim,
213  const HdDoubleDataSourceHandle &startTimeCode,
214  const HdDoubleDataSourceHandle &endTimeCode,
215  const HdDoubleDataSourceHandle &timeCodesPerSecond,
216  const HdDoubleDataSourceHandle &currentFrame,
217  const HdIntDataSourceHandle &sceneStateId
218  );
219 
220  /// \class HdSceneGlobalsSchema::Builder
221  ///
222  /// Utility class for setting sparse sets of child data source fields to be
223  /// filled as arguments into BuildRetained. Because all setter methods
224  /// return a reference to the instance, this can be used in the "builder
225  /// pattern" form.
226  class Builder
227  {
228  public:
229  HD_API
231  const HdPathDataSourceHandle &primaryCameraPrim);
232  HD_API
234  const HdPathDataSourceHandle &activeRenderPassPrim);
235  HD_API
237  const HdPathDataSourceHandle &activeRenderSettingsPrim);
238  HD_API
240  const HdDoubleDataSourceHandle &startTimeCode);
241  HD_API
243  const HdDoubleDataSourceHandle &endTimeCode);
244  HD_API
246  const HdDoubleDataSourceHandle &timeCodesPerSecond);
247  HD_API
249  const HdDoubleDataSourceHandle &currentFrame);
250  HD_API
252  const HdIntDataSourceHandle &sceneStateId);
253 
254  /// Returns a container data source containing the members set thus far.
255  HD_API
256  HdContainerDataSourceHandle Build();
257 
258  private:
259  HdPathDataSourceHandle _primaryCameraPrim;
260  HdPathDataSourceHandle _activeRenderPassPrim;
261  HdPathDataSourceHandle _activeRenderSettingsPrim;
262  HdDoubleDataSourceHandle _startTimeCode;
263  HdDoubleDataSourceHandle _endTimeCode;
264  HdDoubleDataSourceHandle _timeCodesPerSecond;
265  HdDoubleDataSourceHandle _currentFrame;
266  HdIntDataSourceHandle _sceneStateId;
267 
268  };
269 
270  /// @}
271 };
272 
274 
275 #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)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
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:280
#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)
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)