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 /* ** This file is generated by a script. Do not edit directly. Edit ** */
28 /* ** defs.py or the (*)Schema.template.h files to make changes. ** */
29 /* ************************************************************************** */
30 
31 #ifndef PXR_IMAGING_HD_SCENE_GLOBALS_SCHEMA_H
32 #define PXR_IMAGING_HD_SCENE_GLOBALS_SCHEMA_H
33 
34 #include "pxr/imaging/hd/api.h"
35 
36 #include "pxr/imaging/hd/schema.h"
37 
38 
39 #include "pxr/usd/sdf/path.h"
41 
43 
44 //-----------------------------------------------------------------------------
45 
46 #define HDSCENEGLOBALS_SCHEMA_TOKENS \
47  (sceneGlobals) \
48  (activeRenderSettingsPrim) \
49 
50 TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API,
52 
53 //-----------------------------------------------------------------------------
54 
55 /// The HdSceneGlobalsSchema encapsulates "global" state to orchestrate a
56 /// render. It currently houses the active render settings prim path that
57 /// describes the information necessary to generate images from a single
58 /// invocation of a renderer.
59 ///
60 /// We shall use the convention of a container data source at the root prim
61 /// of the scene index that is populated with this global state.
62 /// The renderer and downstream scene indices can query it to configure their
63 /// behavior as necessary.
64 ///
65 
67 {
68 public:
69  HdSceneGlobalsSchema(HdContainerDataSourceHandle container)
70  : HdSchema(container) {}
71 
72  //ACCESSORS
73 
74  HD_API
76 
77  // RETRIEVING AND CONSTRUCTING
78 
79  /// Builds a container data source which includes the provided child data
80  /// sources. Parameters with nullptr values are excluded. This is a
81  /// low-level interface. For cases in which it's desired to define
82  /// the container with a sparse set of child fields, the Builder class
83  /// is often more convenient and readable.
84  HD_API
85  static HdContainerDataSourceHandle
87  const HdPathDataSourceHandle &activeRenderSettingsPrim
88  );
89 
90  /// \class HdSceneGlobalsSchema::Builder
91  ///
92  /// Utility class for setting sparse sets of child data source fields to be
93  /// filled as arguments into BuildRetained. Because all setter methods
94  /// return a reference to the instance, this can be used in the "builder
95  /// pattern" form.
96  class Builder
97  {
98  public:
99  HD_API
101  const HdPathDataSourceHandle &activeRenderSettingsPrim);
102 
103  /// Returns a container data source containing the members set thus far.
104  HD_API
105  HdContainerDataSourceHandle Build();
106 
107  private:
108  HdPathDataSourceHandle _activeRenderSettingsPrim;
109  };
110 
111  /// Constructs and returns a HdSceneGlobalsSchema from the root prim in the
112  /// scene index. Since the root prim might not have a data source for this
113  /// schema, the result should be checked with IsDefined() or a bool
114  /// conversion before use.
115  ///
116  /// \note This API is preferable to GetFromParent(container).
117  HD_API
118  static HdSceneGlobalsSchema
120  const HdSceneIndexBaseRefPtr &si);
121 
122  /// Utility method to concretize the convention of parking the
123  /// "sceneGlobals" container at the root prim of the scene index.
124  static const SdfPath&
126  return SdfPath::AbsoluteRootPath();
127  }
128 
129 
130  /// Retrieves a container data source with the schema's default name token
131  /// "sceneGlobals" from the parent container and constructs a
132  /// HdSceneGlobalsSchema instance.
133  /// Because the requested container data source may not exist, the result
134  /// should be checked with IsDefined() or a bool comparison before use.
135  HD_API
137  const HdContainerDataSourceHandle &fromParentContainer);
138 
139  /// Returns a token where the container representing this schema is found in
140  /// a container by default.
141  HD_API
142  static const TfToken &GetSchemaToken();
143 
144  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
145  /// where the container representing this schema is found by default.
146  HD_API
147  static const HdDataSourceLocator &GetDefaultLocator();
148 
149 
150  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
151  /// where the activerendersettingsprim data source can be found.
152  /// This is often useful for checking intersection against the
153  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
154  HD_API
156 
157 };
158 
160 
161 #endif
static SDF_API const SdfPath & AbsoluteRootPath()
static HD_API const HdDataSourceLocator & GetActiveRenderSettingsPrimLocator()
#define HD_API
Definition: api.h:40
Definition: token.h:87
#define HDSCENEGLOBALS_SCHEMA_TOKENS
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:291
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
static HD_API HdSceneGlobalsSchema GetFromSceneIndex(const HdSceneIndexBaseRefPtr &si)
TF_DECLARE_PUBLIC_TOKENS(HdSceneGlobalsSchemaTokens, HD_API, HDSCENEGLOBALS_SCHEMA_TOKENS)
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