Loading...
Searching...
No Matches
splineAPI.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 USDRI_GENERATED_SPLINEAPI_H
8#define USDRI_GENERATED_SPLINEAPI_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdRi/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
17
18#include "pxr/base/vt/value.h"
19
20#include "pxr/base/gf/vec3d.h"
21#include "pxr/base/gf/vec3f.h"
23
24#include "pxr/base/tf/token.h"
25#include "pxr/base/tf/type.h"
26
27PXR_NAMESPACE_OPEN_SCOPE
28
29class SdfAssetPath;
30
31// -------------------------------------------------------------------------- //
32// RISPLINEAPI //
33// -------------------------------------------------------------------------- //
34
58{
59public:
63 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
64
69 explicit UsdRiSplineAPI(const UsdPrim& prim=UsdPrim())
70 : UsdAPISchemaBase(prim)
71 {
72 }
73
77 explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj)
78 : UsdAPISchemaBase(schemaObj)
79 {
80 }
81
83 USDRI_API
84 virtual ~UsdRiSplineAPI();
85
89 USDRI_API
90 static const TfTokenVector &
91 GetSchemaAttributeNames(bool includeInherited=true);
92
102 USDRI_API
103 static UsdRiSplineAPI
104 Get(const UsdStagePtr &stage, const SdfPath &path);
105
106
123 USDRI_API
124 static bool
125 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
126
142 USDRI_API
143 static UsdRiSplineAPI
144 Apply(const UsdPrim &prim);
145
146protected:
150 USDRI_API
152
153private:
154 // needs to invoke _GetStaticTfType.
155 friend class UsdSchemaRegistry;
156 USDRI_API
157 static const TfType &_GetStaticTfType();
158
159 static bool _IsTypedSchema();
160
161 // override SchemaBase virtuals.
162 USDRI_API
163 const TfType &_GetTfType() const override;
164
165public:
166 // ===================================================================== //
167 // Feel free to add custom code below this line, it will be preserved by
168 // the code generator.
169 //
170 // Just remember to:
171 // - Close the class declaration with };
172 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
173 // - Close the include guard with #endif
174 // ===================================================================== //
175 // --(BEGIN CUSTOM CODE)--
176
179 explicit UsdRiSplineAPI(const UsdPrim& prim, const TfToken &splineName,
180 const SdfValueTypeName &valuesTypeName,
181 bool doesDuplicateBSplineEndpoints)
182 : UsdAPISchemaBase(prim)
183 , _splineName(splineName)
184 , _valuesTypeName(valuesTypeName)
185 , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
186 {
187 }
188
191 explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj,
192 const TfToken &splineName,
193 const SdfValueTypeName &valuesTypeName,
194 bool doesDuplicateBSplineEndpoints)
195 : UsdAPISchemaBase(schemaObj.GetPrim())
196 , _splineName(splineName)
197 , _valuesTypeName(valuesTypeName)
198 , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
199 {
200 }
201
207 USDRI_API
209 return _duplicateBSplineEndpoints;
210 }
211
213 USDRI_API
215 return _valuesTypeName;
216 }
217
218 // --------------------------------------------------------------------- //
219 // INTERPOLATION
220 // --------------------------------------------------------------------- //
228 USDRI_API
230
236 USDRI_API
237 UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
238
239 // --------------------------------------------------------------------- //
240 // POSITIONS
241 // --------------------------------------------------------------------- //
248 USDRI_API
250
256 USDRI_API
257 UsdAttribute CreatePositionsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
258
259 // --------------------------------------------------------------------- //
260 // VALUES
261 // --------------------------------------------------------------------- //
268 USDRI_API
270
276 USDRI_API
277 UsdAttribute CreateValuesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
278
285
299 USDRI_API
300 bool Validate(std::string *reason) const;
301
303
304private:
307 TfToken _GetScopedPropertyName(const TfToken &baseName) const;
308
309private:
310 const TfToken _splineName;
311 const SdfValueTypeName _valuesTypeName;
312 bool _duplicateBSplineEndpoints;
313};
314
315PXR_NAMESPACE_CLOSE_SCOPE
316
317#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
Represents a value type name, i.e.
Definition: valueTypeName.h:72
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
The base class for all API schemas.
Definition: apiSchemaBase.h:99
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:183
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
UsdRiSplineAPI(const UsdPrim &prim, const TfToken &splineName, const SdfValueTypeName &valuesTypeName, bool doesDuplicateBSplineEndpoints)
Construct a UsdRiSplineAPI with the given splineName on the UsdPrim prim .
Definition: splineAPI.h:179
USDRI_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: splineAPI.h:63
static USDRI_API UsdRiSplineAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdRiSplineAPI holding the prim adhering to this schema at path on stage.
static USDRI_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...
USDRI_API UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetInterpolationAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDRI_API UsdAttribute GetInterpolationAttr() const
Interpolation method for the spline.
UsdRiSplineAPI(const UsdSchemaBase &schemaObj, const TfToken &splineName, const SdfValueTypeName &valuesTypeName, bool doesDuplicateBSplineEndpoints)
Construct a UsdRiSplineAPI with the given splineName on the prim held by schemaObj .
Definition: splineAPI.h:191
static USDRI_API UsdRiSplineAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
USDRI_API SdfValueTypeName GetValuesTypeName() const
Returns the intended typename of the values attribute of the spline.
Definition: splineAPI.h:214
USDRI_API bool Validate(std::string *reason) const
Validates the attribute values belonging to the spline.
static USDRI_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
UsdRiSplineAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdRiSplineAPI on UsdPrim prim .
Definition: splineAPI.h:69
USDRI_API UsdAttribute CreatePositionsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetPositionsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDRI_API bool DoesDuplicateBSplineEndpoints() const
Returns true if this UsdRiSplineAPI is configured to ensure the endpoints are duplicated when using a...
Definition: splineAPI.h:208
virtual USDRI_API ~UsdRiSplineAPI()
Destructor.
USDRI_API UsdAttribute GetPositionsAttr() const
Positions of the knots.
USDRI_API UsdAttribute GetValuesAttr() const
Values of the knots.
USDRI_API UsdAttribute CreateValuesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetValuesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
UsdRiSplineAPI(const UsdSchemaBase &schemaObj)
Construct a UsdRiSplineAPI on the prim held by schemaObj .
Definition: splineAPI.h:77
The base class for all schema types in Usd.
Definition: schemaBase.h:39
UsdPrim GetPrim() const
Return this schema object's held prim.
Definition: schemaBase.h:103
Singleton registry that provides access to schema type information and the prim definitions for regis...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:90
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
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