Loading...
Searching...
No Matches
hermiteCurves.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_HERMITECURVES_H
8#define USDGEOM_GENERATED_HERMITECURVES_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdGeom/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
18
19#include "pxr/base/vt/value.h"
20
21#include "pxr/base/gf/vec3d.h"
22#include "pxr/base/gf/vec3f.h"
24
25#include "pxr/base/tf/token.h"
26#include "pxr/base/tf/type.h"
27
28PXR_NAMESPACE_OPEN_SCOPE
29
30class SdfAssetPath;
31
32// -------------------------------------------------------------------------- //
33// HERMITECURVES //
34// -------------------------------------------------------------------------- //
35
70{
71public:
75 static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
76
81 explicit UsdGeomHermiteCurves(const UsdPrim& prim=UsdPrim())
82 : UsdGeomCurves(prim)
83 {
84 }
85
89 explicit UsdGeomHermiteCurves(const UsdSchemaBase& schemaObj)
90 : UsdGeomCurves(schemaObj)
91 {
92 }
93
95 USDGEOM_API
97
101 USDGEOM_API
102 static const TfTokenVector &
103 GetSchemaAttributeNames(bool includeInherited=true);
104
114 USDGEOM_API
116 Get(const UsdStagePtr &stage, const SdfPath &path);
117
140 USDGEOM_API
142 Define(const UsdStagePtr &stage, const SdfPath &path);
143
144protected:
148 USDGEOM_API
150
151private:
152 // needs to invoke _GetStaticTfType.
153 friend class UsdSchemaRegistry;
154 USDGEOM_API
155 static const TfType &_GetStaticTfType();
156
157 static bool _IsTypedSchema();
158
159 // override SchemaBase virtuals.
160 USDGEOM_API
161 const TfType &_GetTfType() const override;
162
163public:
164 // --------------------------------------------------------------------- //
165 // TANGENTS
166 // --------------------------------------------------------------------- //
175 USDGEOM_API
177
183 USDGEOM_API
184 UsdAttribute CreateTangentsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
185
186public:
187 // ===================================================================== //
188 // Feel free to add custom code below this line, it will be preserved by
189 // the code generator.
190 //
191 // Just remember to:
192 // - Close the class declaration with };
193 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
194 // - Close the include guard with #endif
195 // ===================================================================== //
196 // --(BEGIN CUSTOM CODE)--
197
202 VtArray<GfVec3f> _points;
203 VtArray<GfVec3f> _tangents;
204
205 explicit PointAndTangentArrays(const VtVec3fArray& interleaved);
206
207 public:
208
214 default;
215 PointAndTangentArrays& operator=(PointAndTangentArrays&&) = default;
216
221 PointAndTangentArrays(const VtVec3fArray& points,
222 const VtVec3fArray& tangents)
223 : _points(points), _tangents(tangents) {
224 if (_points.size() != _tangents.size()) {
225 TF_RUNTIME_ERROR("Points and tangents must be the same size.");
226 _points.clear();
227 _tangents.clear();
228 }
229 }
230
233 USDGEOM_API static PointAndTangentArrays Separate(const VtVec3fArray& interleaved) {
234 return PointAndTangentArrays(interleaved);
235 }
236
239 USDGEOM_API VtVec3fArray Interleave() const;
240
242 bool IsEmpty() const {
243 // we only need to check the points, as we've verified on
244 // construction that _points and _tangents have the same size
245 return _points.empty();
246 }
247
249 explicit operator bool() const { return !IsEmpty(); }
250
252 const VtVec3fArray& GetPoints() const { return _points; }
253
255 const VtVec3fArray& GetTangents() const { return _tangents; }
256
257 bool operator==(const PointAndTangentArrays& other) {
258 return (GetPoints() == other.GetPoints()) &&
259 (GetTangents() == other.GetTangents());
260 }
261 bool operator!=(const PointAndTangentArrays& other) {
262 return !((*this) == other);
263 }
264 };
265};
266
267PXR_NAMESPACE_CLOSE_SCOPE
268
269#endif
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:78
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
TfType represents a dynamic runtime type.
Definition: type.h:48
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:183
Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and UsdGeomHermiteCurves.
Definition: curves.h:59
Represents points and tangents of the same size.
PointAndTangentArrays()=default
Construct empty points and tangents arrays.
bool IsEmpty() const
Returns true if the containers are empty.
const VtVec3fArray & GetPoints() const
Get separated points array.
static USDGEOM_API PointAndTangentArrays Separate(const VtVec3fArray &interleaved)
Given an interleaved points and tangents arrays (P0, T0, ..., Pn, Tn), separates them into two arrays...
USDGEOM_API VtVec3fArray Interleave() const
Interleaves points (P0, ..., Pn) and tangents (T0, ..., Tn) into one array (P0, T0,...
PointAndTangentArrays(const VtVec3fArray &points, const VtVec3fArray &tangents)
Initializes points and tangents if they are the same size.
const VtVec3fArray & GetTangents() const
Get separated tangents array.
This schema specifies a cubic hermite interpolated curve batch as sometimes used for defining guides ...
Definition: hermiteCurves.h:70
UsdGeomHermiteCurves(const UsdSchemaBase &schemaObj)
Construct a UsdGeomHermiteCurves on the prim held by schemaObj .
Definition: hermiteCurves.h:89
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: hermiteCurves.h:75
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
UsdGeomHermiteCurves(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomHermiteCurves on UsdPrim prim .
Definition: hermiteCurves.h:81
virtual USDGEOM_API ~UsdGeomHermiteCurves()
Destructor.
static USDGEOM_API UsdGeomHermiteCurves Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomHermiteCurves holding the prim adhering to this schema at path on stage.
USDGEOM_API UsdAttribute GetTangentsAttr() const
Defines the outgoing trajectory tangent for each point.
USDGEOM_API UsdAttribute CreateTangentsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetTangentsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDGEOM_API UsdGeomHermiteCurves Define(const UsdStagePtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefin...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
The base class for all schema types in Usd.
Definition: schemaBase.h:39
Singleton registry that provides access to schema type information and the prim definitions for regis...
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:213
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
size_t size() const
Return the total number of elements in this array.
Definition: array.h:474
bool empty() const
Return true if this array contains no elements, false otherwise.
Definition: array.h:502
void clear()
Equivalent to resize(0).
Definition: array.h:630
#define TF_RUNTIME_ERROR(fmt, args)
Issue a generic runtime error, but continue execution.
Definition: diagnostic.h:83
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440