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
51 ///
52 class HdMeshSchema : public HdSchema
53 {
54 public:
55  /// \name Schema retrieval
56  /// @{
57 
58  HdMeshSchema(HdContainerDataSourceHandle container)
59  : HdSchema(container) {}
60 
61  /// Retrieves a container data source with the schema's default name token
62  /// "mesh" from the parent container and constructs a
63  /// HdMeshSchema 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  HD_API
68  const HdContainerDataSourceHandle &fromParentContainer);
69 
70  /// @}
71 
72 // --(BEGIN CUSTOM CODE: Schema Methods)--
73 // --(END CUSTOM CODE: Schema Methods)--
74 
75  /// \name Member accessor
76  /// @{
77 
78  HD_API
80 
81  HD_API
83 
84  HD_API
86 
87  HD_API
89 
90  /// @}
91 
92  /// \name Schema location
93  /// @{
94 
95  /// Returns a token where the container representing this schema is found in
96  /// a container by default.
97  HD_API
98  static const TfToken &GetSchemaToken();
99 
100  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
101  /// where the container representing this schema is found by default.
102  HD_API
103  static const HdDataSourceLocator &GetDefaultLocator();
104 
105  /// @}
106 
107  /// \name Data source locators for members
108  ///
109  /// The following methods return an HdDataSourceLocator (relative to the
110  /// prim-level data source) where the data source for a member can be found.
111  ///
112  /// This is often useful for checking intersection against the
113  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
114  /// @{
115 
116  /// Prim-level relative data source locator to locate topology.
117  HD_API
118  static const HdDataSourceLocator &GetTopologyLocator();
119 
120  /// Prim-level relative data source locator to locate subdivisionScheme.
121  HD_API
123 
124  /// Prim-level relative data source locator to locate subdivisionTags.
125  HD_API
127 
128  /// Prim-level relative data source locator to locate doubleSided.
129  HD_API
131  /// @}
132 
133  /// \name Schema construction
134  /// @{
135 
136  /// \deprecated Use Builder instead.
137  ///
138  /// Builds a container data source which includes the provided child data
139  /// sources. Parameters with nullptr values are excluded. This is a
140  /// low-level interface. For cases in which it's desired to define
141  /// the container with a sparse set of child fields, the Builder class
142  /// is often more convenient and readable.
143  HD_API
144  static HdContainerDataSourceHandle
146  const HdContainerDataSourceHandle &topology,
147  const HdTokenDataSourceHandle &subdivisionScheme,
148  const HdContainerDataSourceHandle &subdivisionTags,
149  const HdBoolDataSourceHandle &doubleSided
150  );
151 
152  /// \class HdMeshSchema::Builder
153  ///
154  /// Utility class for setting sparse sets of child data source fields to be
155  /// filled as arguments into BuildRetained. Because all setter methods
156  /// return a reference to the instance, this can be used in the "builder
157  /// pattern" form.
158  class Builder
159  {
160  public:
161  HD_API
163  const HdContainerDataSourceHandle &topology);
164  HD_API
166  const HdTokenDataSourceHandle &subdivisionScheme);
167  HD_API
169  const HdContainerDataSourceHandle &subdivisionTags);
170  HD_API
172  const HdBoolDataSourceHandle &doubleSided);
173 
174  /// Returns a container data source containing the members set thus far.
175  HD_API
176  HdContainerDataSourceHandle Build();
177 
178  private:
179  HdContainerDataSourceHandle _topology;
180  HdTokenDataSourceHandle _subdivisionScheme;
181  HdContainerDataSourceHandle _subdivisionTags;
182  HdBoolDataSourceHandle _doubleSided;
183 
184  };
185 
186  /// @}
187 };
188 
190 
191 #endif
static HD_API const HdDataSourceLocator & GetSubdivisionTagsLocator()
Prim-level relative data source locator to locate subdivisionTags.
HdMeshSchema(HdContainerDataSourceHandle container)
Definition: meshSchema.h:58
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
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)
#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