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