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