HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
systemSchema.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_SYSTEM_SCHEMA_H
19 #define PXR_IMAGING_HD_SYSTEM_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)--
35 // --(END CUSTOM CODE: Declares)--
36 
37 #define HD_SYSTEM_SCHEMA_TOKENS \
38  (system) \
39 
40 TF_DECLARE_PUBLIC_TOKENS(HdSystemSchemaTokens, HD_API,
42 
43 //-----------------------------------------------------------------------------
44 
45 
46 /// \class HdSystemSchema
47 ///
48 /// The HdSystemSchema specifies a container that will hold "system" data. Each
49 /// piece of system data is identified by a key within the container. A piece
50 /// of system data is evaluated at a given location by walking up the namespace
51 /// looking for a system container that contains the corresponding key.
52 ///
53 class HdSystemSchema : public HdSchema
54 {
55 public:
56  /// \name Schema retrieval
57  /// @{
58 
59  HdSystemSchema(HdContainerDataSourceHandle container)
60  : HdSchema(container) {}
61 
62  /// Retrieves a container data source with the schema's default name token
63  /// "system" from the parent container and constructs a
64  /// HdSystemSchema instance.
65  /// Because the requested container data source may not exist, the result
66  /// should be checked with IsDefined() or a bool comparison before use.
67  HD_API
69  const HdContainerDataSourceHandle &fromParentContainer);
70 
71  /// @}
72 
73 // --(BEGIN CUSTOM CODE: Schema Methods)--
74 
75  /// Evaluates the \p key at \p fromPath. If \p key is found, the return
76  /// value will be non-null and \p foundAtPath will contain the path at
77  /// which the non-null result was found. Otherwise, this returns null.
78  ///
79  /// This operation will be linear in the length of \p fromPath.
80  HD_API
81  static HdDataSourceBaseHandle GetFromPath(
82  HdSceneIndexBaseRefPtr const &inputScene,
83  SdfPath const &fromPath,
84  TfToken const &key,
85  SdfPath *foundAtPath);
86 
87  /// Composes the system container in at \p fromPath by walking up the
88  /// prim.dataSources in \p inputScene and composing any system containers
89  /// it encounters.
90  ///
91  /// If no system containers were found, this returns null.
92  /// Otherwise, this will return a container data source with the composed
93  /// system data sources. If non-null, \p foundAtPath will be the last prim
94  /// at which system data was found.
95  HD_API
96  static HdContainerDataSourceHandle Compose(
97  HdSceneIndexBaseRefPtr const &inputScene,
98  SdfPath const &fromPath,
99  SdfPath *foundAtPath);
100 
101  /// Similar to `Compose` but this return value would be suitable for using
102  /// with HdOverlayContainerDataSource for a prim's dataSource:
103  /// ```
104  /// prim.dataSource = HdOverlayContainerDataSource::New(
105  /// HdSystemSchema::ComposeAsPrimDataSource(...),
106  /// prim.dataSource);
107  /// ```
108  HD_API
109  static HdContainerDataSourceHandle ComposeAsPrimDataSource(
110  HdSceneIndexBaseRefPtr const &inputScene,
111  SdfPath const &fromPath,
112  SdfPath *foundAtPath);
113 
114 // --(END CUSTOM CODE: Schema Methods)--
115 
116  /// \name Member accessor
117  /// @{
118 
119  /// @}
120 
121  /// \name Schema location
122  /// @{
123 
124  /// Returns a token where the container representing this schema is found in
125  /// a container by default.
126  HD_API
127  static const TfToken &GetSchemaToken();
128 
129  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
130  /// where the container representing this schema is found by default.
131  HD_API
132  static const HdDataSourceLocator &GetDefaultLocator();
133 
134  /// @}
135 
136  /// \name Schema construction
137  /// @{
138 
139  /// @}
140 };
141 
143 
144 #endif
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_REF_PTRS(HdSceneIndexBase)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
#define HD_API
Definition: api.h:23
static HD_API HdContainerDataSourceHandle Compose(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, SdfPath *foundAtPath)
Definition: token.h:70
static HD_API HdSystemSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
Definition: path.h:280
HdSystemSchema(HdContainerDataSourceHandle container)
Definition: systemSchema.h:59
static HD_API HdContainerDataSourceHandle ComposeAsPrimDataSource(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, SdfPath *foundAtPath)
static HD_API const TfToken & GetSchemaToken()
static HD_API HdDataSourceBaseHandle GetFromPath(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, TfToken const &key, SdfPath *foundAtPath)
#define HD_SYSTEM_SCHEMA_TOKENS
Definition: systemSchema.h:37
TF_DECLARE_PUBLIC_TOKENS(HdSystemSchemaTokens, HD_API, HD_SYSTEM_SCHEMA_TOKENS)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const HdDataSourceLocator & GetDefaultLocator()