Loading...
Searching...
No Matches
splineAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef USDRI_GENERATED_SPLINEAPI_H
25#define USDRI_GENERATED_SPLINEAPI_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usdRi/api.h"
32#include "pxr/usd/usd/prim.h"
33#include "pxr/usd/usd/stage.h"
34
35#include "pxr/base/vt/value.h"
36
37#include "pxr/base/gf/vec3d.h"
38#include "pxr/base/gf/vec3f.h"
40
41#include "pxr/base/tf/token.h"
42#include "pxr/base/tf/type.h"
43
44PXR_NAMESPACE_OPEN_SCOPE
45
46class SdfAssetPath;
47
48// -------------------------------------------------------------------------- //
49// RISPLINEAPI //
50// -------------------------------------------------------------------------- //
51
75{
76public:
80 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
81
86 explicit UsdRiSplineAPI(const UsdPrim& prim=UsdPrim())
87 : UsdAPISchemaBase(prim)
88 {
89 }
90
94 explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj)
95 : UsdAPISchemaBase(schemaObj)
96 {
97 }
98
100 USDRI_API
102
106 USDRI_API
107 static const TfTokenVector &
108 GetSchemaAttributeNames(bool includeInherited=true);
109
119 USDRI_API
120 static UsdRiSplineAPI
121 Get(const UsdStagePtr &stage, const SdfPath &path);
122
123
140 USDRI_API
141 static bool
142 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
143
159 USDRI_API
160 static UsdRiSplineAPI
161 Apply(const UsdPrim &prim);
162
163protected:
167 USDRI_API
169
170private:
171 // needs to invoke _GetStaticTfType.
172 friend class UsdSchemaRegistry;
173 USDRI_API
174 static const TfType &_GetStaticTfType();
175
176 static bool _IsTypedSchema();
177
178 // override SchemaBase virtuals.
179 USDRI_API
180 const TfType &_GetTfType() const override;
181
182public:
183 // ===================================================================== //
184 // Feel free to add custom code below this line, it will be preserved by
185 // the code generator.
186 //
187 // Just remember to:
188 // - Close the class declaration with };
189 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
190 // - Close the include guard with #endif
191 // ===================================================================== //
192 // --(BEGIN CUSTOM CODE)--
193
196 explicit UsdRiSplineAPI(const UsdPrim& prim, const TfToken &splineName,
197 const SdfValueTypeName &valuesTypeName,
198 bool doesDuplicateBSplineEndpoints)
199 : UsdAPISchemaBase(prim)
200 , _splineName(splineName)
201 , _valuesTypeName(valuesTypeName)
202 , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
203 {
204 }
205
208 explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj,
209 const TfToken &splineName,
210 const SdfValueTypeName &valuesTypeName,
211 bool doesDuplicateBSplineEndpoints)
212 : UsdAPISchemaBase(schemaObj.GetPrim())
213 , _splineName(splineName)
214 , _valuesTypeName(valuesTypeName)
215 , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
216 {
217 }
218
224 USDRI_API
226 return _duplicateBSplineEndpoints;
227 }
228
230 USDRI_API
232 return _valuesTypeName;
233 }
234
235 // --------------------------------------------------------------------- //
236 // INTERPOLATION
237 // --------------------------------------------------------------------- //
245 USDRI_API
247
253 USDRI_API
254 UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
255
256 // --------------------------------------------------------------------- //
257 // POSITIONS
258 // --------------------------------------------------------------------- //
265 USDRI_API
267
273 USDRI_API
274 UsdAttribute CreatePositionsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
275
276 // --------------------------------------------------------------------- //
277 // VALUES
278 // --------------------------------------------------------------------- //
285 USDRI_API
287
293 USDRI_API
294 UsdAttribute CreateValuesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
295
302
316 USDRI_API
317 bool Validate(std::string *reason) const;
318
320
321private:
324 TfToken _GetScopedPropertyName(const TfToken &baseName) const;
325
326private:
327 const TfToken _splineName;
328 const SdfValueTypeName _valuesTypeName;
329 bool _duplicateBSplineEndpoints;
330};
331
332PXR_NAMESPACE_CLOSE_SCOPE
333
334#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Represents a value type name, i.e.
Definition: valueTypeName.h:88
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
TfType represents a dynamic runtime type.
Definition: type.h:65
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
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:196
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:80
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:208
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:231
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:86
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:225
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:94
The base class for all schema types in Usd.
Definition: schemaBase.h:56
UsdPrim GetPrim() const
Return this schema object's held prim.
Definition: schemaBase.h:120
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:164
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:129
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:457