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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 /* ************************************************************************** */
27 /* ** ** */
28 /* ** This file is generated by a script. ** */
29 /* ** ** */
30 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
31 /* ** Edit hdGen/schema.py instead to make changes. ** */
32 /* ** ** */
33 /* ************************************************************************** */
34 
35 #ifndef PXR_IMAGING_HD_SCENE_GLOBALS_SCHEMA_H
36 #define PXR_IMAGING_HD_SCENE_GLOBALS_SCHEMA_H
37 
38 #include "pxr/imaging/hd/api.h"
39 
40 #include "pxr/imaging/hd/schema.h"
41 
42 // --(BEGIN CUSTOM CODE: Includes)--
43 #include "pxr/usd/sdf/path.h"
45 // --(END CUSTOM CODE: Includes)--
46 
48 
49 //-----------------------------------------------------------------------------
50 
51 // --(BEGIN CUSTOM CODE: Declares)--
52 // --(END CUSTOM CODE: Declares)--
53 
54 //-----------------------------------------------------------------------------
55 
56 #define HD_SCENE_GLOBALS_SCHEMA_TOKENS \
57  (sceneGlobals) \
58  (activeRenderSettingsPrim) \
59 
60 TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API,
62 
63 //-----------------------------------------------------------------------------
64 // The HdSceneGlobalsSchema encapsulates "global" state to orchestrate a
65 // render. It currently houses the active render settings prim path that
66 // describes the information necessary to generate images from a single
67 // invocation of a renderer.
68 //
69 // We shall use the convention of a container data source at the root prim of
70 // the scene index that is populated with this global state. The renderer and
71 // downstream scene indices can query it to configure their behavior as
72 // necessary.
73 //
75 {
76 public:
77  HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
78  : HdSchema(container) {}
79 
80 // --(BEGIN CUSTOM CODE: Schema Methods)--
81 
82  /// Constructs and returns a HdSceneGlobalsSchema from the root prim in the
83  /// scene index. Since the root prim might not have a data source for this
84  /// schema, the result should be checked with IsDefined() or a bool
85  /// conversion before use.
86  ///
87  /// \note This API is preferable to GetFromParent(container).
88  HD_API
91  const HdSceneIndexBaseRefPtr &si);
92 
93  /// Utility method to concretize the convention of parking the
94  /// "sceneGlobals" container at the root prim of the scene index.
95  static const SdfPath&
98  }
99 
100 // --(END CUSTOM CODE: Schema Methods)--
101 
102  //ACCESSORS
103 
104 
105  HD_API
107 
108  // RETRIEVING AND CONSTRUCTING
109 
110  /// Builds a container data source which includes the provided child data
111  /// sources. Parameters with nullptr values are excluded. This is a
112  /// low-level interface. For cases in which it's desired to define
113  /// the container with a sparse set of child fields, the Builder class
114  /// is often more convenient and readable.
115  HD_API
116  static HdContainerDataSourceHandle
118  const HdPathDataSourceHandle &activeRenderSettingsPrim
119  );
120 
121  /// \class HdSceneGlobalsSchema::Builder
122  ///
123  /// Utility class for setting sparse sets of child data source fields to be
124  /// filled as arguments into BuildRetained. Because all setter methods
125  /// return a reference to the instance, this can be used in the "builder
126  /// pattern" form.
127  class Builder
128  {
129  public:
130  HD_API
132  const HdPathDataSourceHandle &activeRenderSettingsPrim);
133 
134  /// Returns a container data source containing the members set thus far.
135  HD_API
136  HdContainerDataSourceHandle Build();
137 
138  private:
139  HdPathDataSourceHandle _activeRenderSettingsPrim;
140  };
141 
142  /// Retrieves a container data source with the schema's default name token
143  /// "sceneGlobals" from the parent container and constructs a
144  /// HdSceneGlobalsSchema instance.
145  /// Because the requested container data source may not exist, the result
146  /// should be checked with IsDefined() or a bool comparison before use.
147  HD_API
149  const HdContainerDataSourceHandle &fromParentContainer);
150 
151  /// Returns a token where the container representing this schema is found in
152  /// a container by default.
153  HD_API
154  static const TfToken &GetSchemaToken();
155 
156  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
157  /// where the container representing this schema is found by default.
158  HD_API
159  static const HdDataSourceLocator &GetDefaultLocator();
160 
161  // DATA SOURCE LOCATORS FOR MEMBERS
162  //
163  // The following methods return an HdDataSourceLocator (relative to the
164  // prim-level data source) where the data source for a member can be found.
165  //
166  // This is often useful for checking intersection against the
167  // HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
168 
169 
170  /// Prim-level relative data source locator to locate activeRenderSettingsPrim.
171  HD_API
173 
174 
175 };
176 
178 
179 #endif
static SDF_API const SdfPath & AbsoluteRootPath()
static HD_API const HdDataSourceLocator & GetActiveRenderSettingsPrimLocator()
Prim-level relative data source locator to locate activeRenderSettingsPrim.
#define HD_API
Definition: api.h:40
Definition: token.h:87
static HD_API HdSceneGlobalsSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HD_API HdContainerDataSourceHandle BuildRetained(const HdPathDataSourceHandle &activeRenderSettingsPrim)
static HD_API const HdDataSourceLocator & GetDefaultLocator()
HD_API Builder & SetActiveRenderSettingsPrim(const HdPathDataSourceHandle &activeRenderSettingsPrim)
static const SdfPath & GetDefaultPrimPath()
Definition: path.h:290
#define HD_SCENE_GLOBALS_SCHEMA_TOKENS
TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API, HD_SCENE_GLOBALS_SCHEMA_TOKENS)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
static HD_API HdSceneGlobalsSchema GetFromSceneIndex(const HdSceneIndexBaseRefPtr &si)
HD_API HdPathDataSourceHandle GetActiveRenderSettingsPrim()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
static HD_API const TfToken & GetSchemaToken()
HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HdPathDataSource::Handle HdPathDataSourceHandle