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"
22 #include "pxr/base/gf/matrix4d.h"
23 
24 #include "pxr/base/tf/token.h"
25 #include "pxr/base/tf/type.h"
26 
27 PXR_NAMESPACE_OPEN_SCOPE
28 
29 class SdfAssetPath;
30 
31 // -------------------------------------------------------------------------- //
32 // RISPLINEAPI //
33 // -------------------------------------------------------------------------- //
34 
58 {
59 public:
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 
146 protected:
150  USDRI_API
151  UsdSchemaKind _GetSchemaKind() const override;
152 
153 private:
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 
165 public:
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
269  UsdAttribute GetValuesAttr() const;
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 
304 private:
307  TfToken _GetScopedPropertyName(const TfToken &baseName) const;
308 
309 private:
310  const TfToken _splineName;
311  const SdfValueTypeName _valuesTypeName;
312  bool _duplicateBSplineEndpoints;
313 };
314 
315 PXR_NAMESPACE_CLOSE_SCOPE
316 
317 #endif
USDRI_API SdfValueTypeName GetValuesTypeName() const
Returns the intended typename of the values attribute of the spline.
Definition: splineAPI.h:214
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.
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
UsdPrim GetPrim() const
Return this schema object's held prim.
Definition: schemaBase.h:103
UsdRiSplineAPI(const UsdSchemaBase &schemaObj)
Construct a UsdRiSplineAPI on the prim held by schemaObj .
Definition: splineAPI.h:77
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.
Represents a value type name, i.e.
Definition: valueTypeName.h:71
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: splineAPI.h:63
The base class for all API schemas.
Definition: apiSchemaBase.h:94
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:183
USDRI_API UsdAttribute GetValuesAttr() const
Values of the knots.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
Single Apply API schema.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:80
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
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
virtual USDRI_API ~UsdRiSplineAPI()
Destructor.
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.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:489
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.
USDRI_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
static USDRI_API UsdRiSplineAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
UsdRiSplineAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdRiSplineAPI on UsdPrim prim .
Definition: splineAPI.h:69
USDRI_API UsdAttribute GetInterpolationAttr() const
Interpolation method for the spline.
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.
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:78
TfType represents a dynamic runtime type.
Definition: type.h:47
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDRI_API bool Validate(std::string *reason) const
Validates the attribute values belonging to the spline.
The base class for all schema types in Usd.
Definition: schemaBase.h:39
USDRI_API UsdAttribute GetPositionsAttr() const
Positions of the knots.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:89
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
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...