HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
meshSchema.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_MESH_SCHEMA_H
19 #define PXR_IMAGING_HD_MESH_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
26 
27 #include "pxr/imaging/hd/schema.h"
28 
29 // --(BEGIN CUSTOM CODE: Includes)--
30 // --(END CUSTOM CODE: Includes)--
31 
33 
34 // --(BEGIN CUSTOM CODE: Declares)--
35 // --(END CUSTOM CODE: Declares)--
36 
37 #define HD_MESH_SCHEMA_TOKENS \
38  (mesh) \
39  (topology) \
40  (subdivisionScheme) \
41  (subdivisionTags) \
42  (doubleSided) \
43 
44 TF_DECLARE_PUBLIC_TOKENS(HdMeshSchemaTokens, HD_API,
46 
47 //-----------------------------------------------------------------------------
48 
49 
50 class HdMeshSchema : public HdSchema
51 {
52 public:
53  /// \name Schema retrieval
54  /// @{
55 
56  HdMeshSchema(HdContainerDataSourceHandle container)
57  : HdSchema(container) {}
58 
59  /// Retrieves a container data source with the schema's default name token
60  /// "mesh" from the parent container and constructs a
61  /// HdMeshSchema instance.
62  /// Because the requested container data source may not exist, the result
63  /// should be checked with IsDefined() or a bool comparison before use.
64  HD_API
66  const HdContainerDataSourceHandle &fromParentContainer);
67 
68  /// @}
69 
70 // --(BEGIN CUSTOM CODE: Schema Methods)--
71 // --(END CUSTOM CODE: Schema Methods)--
72 
73  /// \name Member accessor
74  /// @{
75 
76  HD_API
78 
79  HD_API
81 
82  HD_API
84 
85  HD_API
87 
88  /// @}
89 
90  /// \name Schema location
91  /// @{
92 
93  /// Returns a token where the container representing this schema is found in
94  /// a container by default.
95  HD_API
96  static const TfToken &GetSchemaToken();
97 
98  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
99  /// where the container representing this schema is found by default.
100  HD_API
101  static const HdDataSourceLocator &GetDefaultLocator();
102 
103  /// @}
104 
105  /// \name Data source locators for members
106  ///
107  /// The following methods return an HdDataSourceLocator (relative to the
108  /// prim-level data source) where the data source for a member can be found.
109  ///
110  /// This is often useful for checking intersection against the
111  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
112  /// @{
113 
114  /// Prim-level relative data source locator to locate topology.
115  HD_API
116  static const HdDataSourceLocator &GetTopologyLocator();
117 
118  /// Prim-level relative data source locator to locate subdivisionScheme.
119  HD_API
121 
122  /// Prim-level relative data source locator to locate subdivisionTags.
123  HD_API
125 
126  /// Prim-level relative data source locator to locate doubleSided.
127  HD_API
129  /// @}
130 
131  /// \name Schema construction
132  /// @{
133 
134  /// \deprecated Use Builder instead.
135  ///
136  /// Builds a container data source which includes the provided child data
137  /// sources. Parameters with nullptr values are excluded. This is a
138  /// low-level interface. For cases in which it's desired to define
139  /// the container with a sparse set of child fields, the Builder class
140  /// is often more convenient and readable.
141  HD_API
142  static HdContainerDataSourceHandle
144  const HdContainerDataSourceHandle &topology,
145  const HdTokenDataSourceHandle &subdivisionScheme,
146  const HdContainerDataSourceHandle &subdivisionTags,
147  const HdBoolDataSourceHandle &doubleSided
148  );
149 
150  /// \class HdMeshSchema::Builder
151  ///
152  /// Utility class for setting sparse sets of child data source fields to be
153  /// filled as arguments into BuildRetained. Because all setter methods
154  /// return a reference to the instance, this can be used in the "builder
155  /// pattern" form.
156  class Builder
157  {
158  public:
159  HD_API
161  const HdContainerDataSourceHandle &topology);
162  HD_API
164  const HdTokenDataSourceHandle &subdivisionScheme);
165  HD_API
167  const HdContainerDataSourceHandle &subdivisionTags);
168  HD_API
170  const HdBoolDataSourceHandle &doubleSided);
171 
172  /// Returns a container data source containing the members set thus far.
173  HD_API
174  HdContainerDataSourceHandle Build();
175 
176  private:
177  HdContainerDataSourceHandle _topology;
178  HdTokenDataSourceHandle _subdivisionScheme;
179  HdContainerDataSourceHandle _subdivisionTags;
180  HdBoolDataSourceHandle _doubleSided;
181 
182  };
183 
184  /// @}
185 };
186 
188 
189 #endif
static HD_API const HdDataSourceLocator & GetSubdivisionTagsLocator()
Prim-level relative data source locator to locate subdivisionTags.
HdMeshSchema(HdContainerDataSourceHandle container)
Definition: meshSchema.h:56
HD_API Builder & SetSubdivisionTags(const HdContainerDataSourceHandle &subdivisionTags)
#define HD_API
Definition: api.h:23
HD_API HdBoolDataSourceHandle GetDoubleSided() const
HD_API HdSubdivisionTagsSchema GetSubdivisionTags() const
HD_API Builder & SetSubdivisionScheme(const HdTokenDataSourceHandle &subdivisionScheme)
Definition: token.h:70
GT_API const UT_StringHolder topology
HdBoolDataSource::Handle HdBoolDataSourceHandle
HD_API Builder & SetDoubleSided(const HdBoolDataSourceHandle &doubleSided)
static HD_API const TfToken & GetSchemaToken()
static HD_API const HdDataSourceLocator & GetDoubleSidedLocator()
Prim-level relative data source locator to locate doubleSided.
static HD_API const HdDataSourceLocator & GetDefaultLocator()
static HD_API HdMeshSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &topology, const HdTokenDataSourceHandle &subdivisionScheme, const HdContainerDataSourceHandle &subdivisionTags, const HdBoolDataSourceHandle &doubleSided)
HD_API HdTokenDataSourceHandle GetSubdivisionScheme() const
TF_DECLARE_PUBLIC_TOKENS(HdMeshSchemaTokens, HD_API, HD_MESH_SCHEMA_TOKENS)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const HdDataSourceLocator & GetSubdivisionSchemeLocator()
Prim-level relative data source locator to locate subdivisionScheme.
HD_API Builder & SetTopology(const HdContainerDataSourceHandle &topology)
#define HD_MESH_SCHEMA_TOKENS
Definition: meshSchema.h:37
HdTokenDataSource::Handle HdTokenDataSourceHandle
static HD_API const HdDataSourceLocator & GetTopologyLocator()
Prim-level relative data source locator to locate topology.
HD_API HdMeshTopologySchema GetTopology() const