HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cylinder_1.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USDGEOM_GENERATED_CYLINDER_1_H
8 #define USDGEOM_GENERATED_CYLINDER_1_H
9 
10 /// \file usdGeom/cylinder_1.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdGeom/api.h"
14 #include "pxr/usd/usdGeom/gprim.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "pxr/usd/usdGeom/tokens.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // CYLINDER_1 //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdGeomCylinder_1
37 ///
38 /// Defines a primitive cylinder with closed ends, centered at the
39 /// origin, whose spine is along the specified \em axis, with a pair of radii
40 /// describing the size of the end points.
41 ///
42 /// The fallback values for Cube, Sphere, Cone, and Cylinder are set so that
43 /// they all pack into the same volume/bounds.
44 ///
45 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
46 /// that are text/tokens, the actual token is published and defined in \ref UsdGeomTokens.
47 /// So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded
48 /// as the value.
49 ///
51 {
52 public:
53  /// Compile time constant representing what kind of schema this class is.
54  ///
55  /// \sa UsdSchemaKind
57 
58  /// Construct a UsdGeomCylinder_1 on UsdPrim \p prim .
59  /// Equivalent to UsdGeomCylinder_1::Get(prim.GetStage(), prim.GetPath())
60  /// for a \em valid \p prim, but will not immediately throw an error for
61  /// an invalid \p prim
62  explicit UsdGeomCylinder_1(const UsdPrim& prim=UsdPrim())
63  : UsdGeomGprim(prim)
64  {
65  }
66 
67  /// Construct a UsdGeomCylinder_1 on the prim held by \p schemaObj .
68  /// Should be preferred over UsdGeomCylinder_1(schemaObj.GetPrim()),
69  /// as it preserves SchemaBase state.
70  explicit UsdGeomCylinder_1(const UsdSchemaBase& schemaObj)
71  : UsdGeomGprim(schemaObj)
72  {
73  }
74 
75  /// Destructor.
77  virtual ~UsdGeomCylinder_1();
78 
79  /// Return a vector of names of all pre-declared attributes for this schema
80  /// class and all its ancestor classes. Does not include attributes that
81  /// may be authored by custom/extended methods of the schemas involved.
83  static const TfTokenVector &
84  GetSchemaAttributeNames(bool includeInherited=true);
85 
86  /// Return a UsdGeomCylinder_1 holding the prim adhering to this
87  /// schema at \p path on \p stage. If no prim exists at \p path on
88  /// \p stage, or if the prim at that path does not adhere to this schema,
89  /// return an invalid schema object. This is shorthand for the following:
90  ///
91  /// \code
92  /// UsdGeomCylinder_1(stage->GetPrimAtPath(path));
93  /// \endcode
94  ///
96  static UsdGeomCylinder_1
97  Get(const UsdStagePtr &stage, const SdfPath &path);
98 
99  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
100  /// is defined (according to UsdPrim::IsDefined()) on this stage.
101  ///
102  /// If a prim adhering to this schema at \p path is already defined on this
103  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
104  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
105  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
106  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
107  /// current EditTarget for any nonexistent, or existing but not \a Defined
108  /// ancestors.
109  ///
110  /// The given \a path must be an absolute prim path that does not contain
111  /// any variant selections.
112  ///
113  /// If it is impossible to author any of the necessary PrimSpecs, (for
114  /// example, in case \a path cannot map to the current UsdEditTarget's
115  /// namespace) issue an error and return an invalid \a UsdPrim.
116  ///
117  /// Note that this method may return a defined prim whose typeName does not
118  /// specify this schema class, in case a stronger typeName opinion overrides
119  /// the opinion at the current EditTarget.
120  ///
122  static UsdGeomCylinder_1
123  Define(const UsdStagePtr &stage, const SdfPath &path);
124 
125 protected:
126  /// Returns the kind of schema this class belongs to.
127  ///
128  /// \sa UsdSchemaKind
130  UsdSchemaKind _GetSchemaKind() const override;
131 
132 private:
133  // needs to invoke _GetStaticTfType.
134  friend class UsdSchemaRegistry;
136  static const TfType &_GetStaticTfType();
137 
138  static bool _IsTypedSchema();
139 
140  // override SchemaBase virtuals.
142  const TfType &_GetTfType() const override;
143 
144 public:
145  // --------------------------------------------------------------------- //
146  // HEIGHT
147  // --------------------------------------------------------------------- //
148  /// The length of the cylinder's spine along the specified
149  /// \em axis. If you author \em height you must also author \em extent.
150  ///
151  /// \sa GetExtentAttr()
152  ///
153  /// | ||
154  /// | -- | -- |
155  /// | Declaration | `double height = 2` |
156  /// | C++ Type | double |
157  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
159  UsdAttribute GetHeightAttr() const;
160 
161  /// See GetHeightAttr(), and also
162  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
163  /// If specified, author \p defaultValue as the attribute's default,
164  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
165  /// the default for \p writeSparsely is \c false.
167  UsdAttribute CreateHeightAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
168 
169 public:
170  // --------------------------------------------------------------------- //
171  // RADIUSTOP
172  // --------------------------------------------------------------------- //
173  /// The radius of the top of the cylinder - i.e. the face located
174  /// along the positive \em axis. If you author \em radiusTop you must also
175  /// author \em extent.
176  ///
177  /// \sa GetExtentAttr()
178  ///
179  /// | ||
180  /// | -- | -- |
181  /// | Declaration | `double radiusTop = 1` |
182  /// | C++ Type | double |
183  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
186 
187  /// See GetRadiusTopAttr(), and also
188  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
189  /// If specified, author \p defaultValue as the attribute's default,
190  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
191  /// the default for \p writeSparsely is \c false.
193  UsdAttribute CreateRadiusTopAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
194 
195 public:
196  // --------------------------------------------------------------------- //
197  // RADIUSBOTTOM
198  // --------------------------------------------------------------------- //
199  /// The radius of the bottom of the cylinder - i.e. the face
200  /// point located along the negative \em axis. If you author
201  /// \em radiusBottom you must also author \em extent.
202  ///
203  /// \sa GetExtentAttr()
204  ///
205  /// | ||
206  /// | -- | -- |
207  /// | Declaration | `double radiusBottom = 1` |
208  /// | C++ Type | double |
209  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
212 
213  /// See GetRadiusBottomAttr(), and also
214  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
215  /// If specified, author \p defaultValue as the attribute's default,
216  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
217  /// the default for \p writeSparsely is \c false.
219  UsdAttribute CreateRadiusBottomAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
220 
221 public:
222  // --------------------------------------------------------------------- //
223  // AXIS
224  // --------------------------------------------------------------------- //
225  /// The axis along which the spine of the cylinder is aligned
226  ///
227  /// | ||
228  /// | -- | -- |
229  /// | Declaration | `uniform token axis = "Z"` |
230  /// | C++ Type | TfToken |
231  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
232  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
233  /// | \ref UsdGeomTokens "Allowed Values" | X, Y, Z |
235  UsdAttribute GetAxisAttr() const;
236 
237  /// See GetAxisAttr(), and also
238  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
239  /// If specified, author \p defaultValue as the attribute's default,
240  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
241  /// the default for \p writeSparsely is \c false.
243  UsdAttribute CreateAxisAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
244 
245 public:
246  // --------------------------------------------------------------------- //
247  // EXTENT
248  // --------------------------------------------------------------------- //
249  /// Extent is re-defined on Cylinder only to provide a fallback
250  /// value. \sa UsdGeomGprim::GetExtentAttr().
251  ///
252  /// | ||
253  /// | -- | -- |
254  /// | Declaration | `float3[] extent = [(-1, -1, -1), (1, 1, 1)]` |
255  /// | C++ Type | VtArray<GfVec3f> |
256  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float3Array |
258  UsdAttribute GetExtentAttr() const;
259 
260  /// See GetExtentAttr(), and also
261  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
262  /// If specified, author \p defaultValue as the attribute's default,
263  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
264  /// the default for \p writeSparsely is \c false.
266  UsdAttribute CreateExtentAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
267 
268 public:
269  // ===================================================================== //
270  // Feel free to add custom code below this line, it will be preserved by
271  // the code generator.
272  //
273  // Just remember to:
274  // - Close the class declaration with };
275  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
276  // - Close the include guard with #endif
277  // ===================================================================== //
278  // --(BEGIN CUSTOM CODE)--
279 
280  /// Compute the extent for the cylinder defined by the height, radiusTop,
281  /// radiusBottom, and axis.
282  ///
283  /// \return true upon success, false if unable to calculate extent.
284  ///
285  /// On success, extent will contain an approximate axis-aligned bounding
286  /// box of the cylinder defined by the height, radiusTop and radiusBottom,
287  /// and axis.
288  ///
289  /// This function is to provide easy authoring of extent for usd authoring
290  /// tools, hence it is static and acts outside a specific prim (as in
291  /// attribute based methods).
293  static bool ComputeExtent(double height, double radiusTop,
294  double radiusBottom, const TfToken& axis, VtVec3fArray* extent);
295 
296  /// \overload
297  /// Computes the extent as if the matrix \p transform was first applied.
299  static bool ComputeExtent(double height, double radiusTop,
300  double radiusBottom, const TfToken& axis,
301  const GfMatrix4d& transform, VtVec3fArray* extent);
302 };
303 
305 
306 #endif
static USDGEOM_API bool ComputeExtent(double height, double radiusTop, double radiusBottom, const TfToken &axis, VtVec3fArray *extent)
USDGEOM_API UsdAttribute GetRadiusBottomAttr() const
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDGEOM_API UsdAttribute GetHeightAttr() const
USDGEOM_API UsdAttribute CreateRadiusBottomAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdGeomCylinder_1(const UsdPrim &prim=UsdPrim())
Definition: cylinder_1.h:62
USDGEOM_API UsdAttribute GetAxisAttr() const
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
static USDGEOM_API UsdGeomCylinder_1 Define(const UsdStagePtr &stage, const SdfPath &path)
Definition: token.h:70
Represents a concrete typed schema.
USDGEOM_API UsdAttribute GetExtentAttr() const
USDGEOM_API UsdAttribute CreateRadiusTopAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
static USDGEOM_API UsdGeomCylinder_1 Get(const UsdStagePtr &stage, const SdfPath &path)
Definition: path.h:273
GA_API const UT_StringHolder transform
USDGEOM_API UsdAttribute CreateHeightAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual USDGEOM_API ~UsdGeomCylinder_1()
Destructor.
UsdSchemaKind
Definition: common.h:112
static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDGEOM_API UsdAttribute CreateExtentAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static const UsdSchemaKind schemaKind
Definition: cylinder_1.h:56
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
#define USDGEOM_API
Definition: api.h:23
UsdGeomCylinder_1(const UsdSchemaBase &schemaObj)
Definition: cylinder_1.h:70
USDGEOM_API UsdAttribute GetRadiusTopAttr() const
Definition: value.h:146
USDGEOM_API UsdAttribute CreateAxisAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const