HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
modelSchema.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_USD_IMAGING_USD_IMAGING_MODEL_SCHEMA_H
19 #define PXR_USD_IMAGING_USD_IMAGING_MODEL_SCHEMA_H
20 
21 /// \file
22 
24 
25 #include "pxr/imaging/hd/schema.h"
26 
27 // --(BEGIN CUSTOM CODE: Includes)--
28 // --(END CUSTOM CODE: Includes)--
29 
31 
32 // --(BEGIN CUSTOM CODE: Declares)--
33 // --(END CUSTOM CODE: Declares)--
34 
35 #define USD_IMAGING_MODEL_SCHEMA_TOKENS \
36  (model) \
37  (modelPath) \
38  (assetIdentifier) \
39  (assetName) \
40  (assetVersion) \
41 
42 TF_DECLARE_PUBLIC_TOKENS(UsdImagingModelSchemaTokens, USDIMAGING_API,
44 
45 //-----------------------------------------------------------------------------
46 
47 
49 {
50 public:
51  /// \name Schema retrieval
52  /// @{
53 
54  UsdImagingModelSchema(HdContainerDataSourceHandle container)
55  : HdSchema(container) {}
56 
57  /// Retrieves a container data source with the schema's default name token
58  /// "model" from the parent container and constructs a
59  /// UsdImagingModelSchema instance.
60  /// Because the requested container data source may not exist, the result
61  /// should be checked with IsDefined() or a bool comparison before use.
64  const HdContainerDataSourceHandle &fromParentContainer);
65 
66  /// @}
67 
68 // --(BEGIN CUSTOM CODE: Schema Methods)--
69 // --(END CUSTOM CODE: Schema Methods)--
70 
71  /// \name Member accessor
72  /// @{
73 
76 
79 
82 
85 
86  /// @}
87 
88  /// \name Schema location
89  /// @{
90 
91  /// Returns a token where the container representing this schema is found in
92  /// a container by default.
94  static const TfToken &GetSchemaToken();
95 
96  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
97  /// where the container representing this schema is found by default.
99  static const HdDataSourceLocator &GetDefaultLocator();
100 
101  /// @}
102 
103  /// \name Schema construction
104  /// @{
105 
106  /// \deprecated Use Builder instead.
107  ///
108  /// Builds a container data source which includes the provided child data
109  /// sources. Parameters with nullptr values are excluded. This is a
110  /// low-level interface. For cases in which it's desired to define
111  /// the container with a sparse set of child fields, the Builder class
112  /// is often more convenient and readable.
114  static HdContainerDataSourceHandle
116  const HdPathDataSourceHandle &modelPath,
117  const HdAssetPathDataSourceHandle &assetIdentifier,
118  const HdStringDataSourceHandle &assetName,
119  const HdStringDataSourceHandle &assetVersion
120  );
121 
122  /// \class UsdImagingModelSchema::Builder
123  ///
124  /// Utility class for setting sparse sets of child data source fields to be
125  /// filled as arguments into BuildRetained. Because all setter methods
126  /// return a reference to the instance, this can be used in the "builder
127  /// pattern" form.
128  class Builder
129  {
130  public:
133  const HdPathDataSourceHandle &modelPath);
136  const HdAssetPathDataSourceHandle &assetIdentifier);
139  const HdStringDataSourceHandle &assetName);
142  const HdStringDataSourceHandle &assetVersion);
143 
144  /// Returns a container data source containing the members set thus far.
146  HdContainerDataSourceHandle Build();
147 
148  private:
149  HdPathDataSourceHandle _modelPath;
150  HdAssetPathDataSourceHandle _assetIdentifier;
151  HdStringDataSourceHandle _assetName;
152  HdStringDataSourceHandle _assetVersion;
153 
154  };
155 
156  /// @}
157 };
158 
160 
161 #endif
#define USDIMAGING_API
Definition: api.h:23
static USDIMAGING_API HdContainerDataSourceHandle BuildRetained(const HdPathDataSourceHandle &modelPath, const HdAssetPathDataSourceHandle &assetIdentifier, const HdStringDataSourceHandle &assetName, const HdStringDataSourceHandle &assetVersion)
HdStringDataSource::Handle HdStringDataSourceHandle
static USDIMAGING_API UsdImagingModelSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static USDIMAGING_API const TfToken & GetSchemaToken()
HdAssetPathDataSource::Handle HdAssetPathDataSourceHandle
USDIMAGING_API HdStringDataSourceHandle GetAssetVersion() const
USDIMAGING_API HdPathDataSourceHandle GetModelPath() const
Definition: token.h:70
#define USD_IMAGING_MODEL_SCHEMA_TOKENS
Definition: modelSchema.h:35
USDIMAGING_API Builder & SetAssetName(const HdStringDataSourceHandle &assetName)
USDIMAGING_API Builder & SetAssetVersion(const HdStringDataSourceHandle &assetVersion)
USDIMAGING_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
USDIMAGING_API Builder & SetModelPath(const HdPathDataSourceHandle &modelPath)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
TF_DECLARE_PUBLIC_TOKENS(UsdImagingModelSchemaTokens, USDIMAGING_API, USD_IMAGING_MODEL_SCHEMA_TOKENS)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
UsdImagingModelSchema(HdContainerDataSourceHandle container)
Definition: modelSchema.h:54
USDIMAGING_API Builder & SetAssetIdentifier(const HdAssetPathDataSourceHandle &assetIdentifier)
static USDIMAGING_API const HdDataSourceLocator & GetDefaultLocator()
USDIMAGING_API HdStringDataSourceHandle GetAssetName() const
USDIMAGING_API HdAssetPathDataSourceHandle GetAssetIdentifier() const
HdPathDataSource::Handle HdPathDataSourceHandle