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_HDAR_SYSTEM_SCHEMA_H
19 #define PXR_IMAGING_HDAR_SYSTEM_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hdar/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 HDAR_SYSTEM_SCHEMA_TOKENS \
38  (assetResolution) \
39  (resolverContext) \
40 
41 TF_DECLARE_PUBLIC_TOKENS(HdarSystemSchemaTokens, HDAR_API,
43 
44 //-----------------------------------------------------------------------------
45 
46 
47 /// \class HdarSystemSchema
48 ///
49 /// The HdarSystemSchema specifies a container that will hold "system" data
50 /// that is relevant to asset resolution.
51 ///
52 class HdarSystemSchema : public HdSchema
53 {
54 public:
55  /// \name Schema retrieval
56  /// @{
57 
58  HdarSystemSchema(HdContainerDataSourceHandle container)
59  : HdSchema(container) {}
60 
61  /// Retrieves a container data source with the schema's default name token
62  /// "assetResolution" from the parent container and constructs a
63  /// HdarSystemSchema instance.
64  /// Because the requested container data source may not exist, the result
65  /// should be checked with IsDefined() or a bool comparison before use.
66  HDAR_API
68  const HdContainerDataSourceHandle &fromParentContainer);
69 
70  /// @}
71 
72 // --(BEGIN CUSTOM CODE: Schema Methods)--
73 
74  /// Evaluates the asset resolution "system" data source for \p fromPath.
75  ///
76  /// If found, the return value will be non-null and \p foundAtPath
77  /// will contain the path at which the non-null result was found.
78  /// Otherwise, this returns null.
79  ///
80  /// This operation will be linear in the length of \p fromPath.
81  HDAR_API
82  static HdContainerDataSourceHandle GetFromPath(
83  HdSceneIndexBaseRefPtr const &inputScene,
84  SdfPath const &fromPath,
85  SdfPath *foundAtPath);
86 
87 // --(END CUSTOM CODE: Schema Methods)--
88 
89  /// \name Member accessor
90  /// @{
91 
92  HDAR_API
94 
95  /// @}
96 
97  /// \name Schema location
98  /// @{
99 
100  /// Returns a token where the container representing this schema is found in
101  /// a container by default.
102  HDAR_API
103  static const TfToken &GetSchemaToken();
104 
105  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
106  /// where the container representing this schema is found by default.
107  HDAR_API
108  static const HdDataSourceLocator &GetDefaultLocator();
109 
110  /// @}
111 
112  /// \name Schema construction
113  /// @{
114 
115  /// \deprecated Use Builder instead.
116  ///
117  /// Builds a container data source which includes the provided child data
118  /// sources. Parameters with nullptr values are excluded. This is a
119  /// low-level interface. For cases in which it's desired to define
120  /// the container with a sparse set of child fields, the Builder class
121  /// is often more convenient and readable.
122  HDAR_API
123  static HdContainerDataSourceHandle
125  const HdResolverContextDataSourceHandle &resolverContext
126  );
127 
128  /// \class HdarSystemSchema::Builder
129  ///
130  /// Utility class for setting sparse sets of child data source fields to be
131  /// filled as arguments into BuildRetained. Because all setter methods
132  /// return a reference to the instance, this can be used in the "builder
133  /// pattern" form.
134  class Builder
135  {
136  public:
137  HDAR_API
139  const HdResolverContextDataSourceHandle &resolverContext);
140 
141  /// Returns a container data source containing the members set thus far.
142  HDAR_API
143  HdContainerDataSourceHandle Build();
144 
145  private:
146  HdResolverContextDataSourceHandle _resolverContext;
147 
148  };
149 
150  /// @}
151 };
152 
154 
155 #endif
HDAR_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_REF_PTRS(HdSceneIndexBase)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static HDAR_API const TfToken & GetSchemaToken()
static HDAR_API HdarSystemSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HDAR_API HdContainerDataSourceHandle BuildRetained(const HdResolverContextDataSourceHandle &resolverContext)
Definition: token.h:70
Definition: path.h:280
HdResolverContextDataSource::Handle HdResolverContextDataSourceHandle
#define HDAR_SYSTEM_SCHEMA_TOKENS
Definition: systemSchema.h:37
static HDAR_API HdContainerDataSourceHandle GetFromPath(HdSceneIndexBaseRefPtr const &inputScene, SdfPath const &fromPath, SdfPath *foundAtPath)
HdarSystemSchema(HdContainerDataSourceHandle container)
Definition: systemSchema.h:58
TF_DECLARE_PUBLIC_TOKENS(HdSystemSchemaTokens, HD_API, HD_SYSTEM_SCHEMA_TOKENS)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDAR_API HdResolverContextDataSourceHandle GetResolverContext() const
HDAR_API Builder & SetResolverContext(const HdResolverContextDataSourceHandle &resolverContext)
static HDAR_API const HdDataSourceLocator & GetDefaultLocator()
#define HDAR_API
Definition: api.h:23