All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
31 #include "pxr/usd/usd/apiSchemaBase.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"
39 #include "pxr/base/gf/matrix4d.h"
40 
41 #include "pxr/base/tf/token.h"
42 #include "pxr/base/tf/type.h"
43 
44 PXR_NAMESPACE_OPEN_SCOPE
45 
46 class SdfAssetPath;
47 
48 // -------------------------------------------------------------------------- //
49 // RISPLINEAPI //
50 // -------------------------------------------------------------------------- //
51 
75 {
76 public:
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
101  virtual ~UsdRiSplineAPI();
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 
138  USDRI_API
139  static UsdRiSplineAPI
140  Apply(const UsdPrim &prim);
141 
142 protected:
146  USDRI_API
147  UsdSchemaType _GetSchemaType() const override;
148 
149 private:
150  // needs to invoke _GetStaticTfType.
151  friend class UsdSchemaRegistry;
152  USDRI_API
153  static const TfType &_GetStaticTfType();
154 
155  static bool _IsTypedSchema();
156 
157  // override SchemaBase virtuals.
158  USDRI_API
159  const TfType &_GetTfType() const override;
160 
161 public:
162  // ===================================================================== //
163  // Feel free to add custom code below this line, it will be preserved by
164  // the code generator.
165  //
166  // Just remember to:
167  // - Close the class declaration with };
168  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
169  // - Close the include guard with #endif
170  // ===================================================================== //
171  // --(BEGIN CUSTOM CODE)--
172 
175  explicit UsdRiSplineAPI(const UsdPrim& prim, const TfToken &splineName,
176  const SdfValueTypeName &valuesTypeName,
177  bool doesDuplicateBSplineEndpoints)
178  : UsdAPISchemaBase(prim)
179  , _splineName(splineName)
180  , _valuesTypeName(valuesTypeName)
181  , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
182  {
183  }
184 
187  explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj,
188  const TfToken &splineName,
189  const SdfValueTypeName &valuesTypeName,
190  bool doesDuplicateBSplineEndpoints)
191  : UsdAPISchemaBase(schemaObj.GetPrim())
192  , _splineName(splineName)
193  , _valuesTypeName(valuesTypeName)
194  , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
195  {
196  }
197 
203  USDRI_API
205  return _duplicateBSplineEndpoints;
206  }
207 
209  USDRI_API
211  return _valuesTypeName;
212  }
213 
214  // --------------------------------------------------------------------- //
215  // INTERPOLATION
216  // --------------------------------------------------------------------- //
224  USDRI_API
226 
232  USDRI_API
233  UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
234 
235  // --------------------------------------------------------------------- //
236  // POSITIONS
237  // --------------------------------------------------------------------- //
244  USDRI_API
246 
252  USDRI_API
253  UsdAttribute CreatePositionsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
254 
255  // --------------------------------------------------------------------- //
256  // VALUES
257  // --------------------------------------------------------------------- //
264  USDRI_API
265  UsdAttribute GetValuesAttr() const;
266 
272  USDRI_API
273  UsdAttribute CreateValuesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
274 
281 
295  USDRI_API
296  bool Validate(std::string *reason) const;
297 
299 
300 private:
303  TfToken _GetScopedPropertyName(const TfToken &baseName) const;
304 
305 private:
306  const TfToken _splineName;
307  const SdfValueTypeName _valuesTypeName;
308  bool _duplicateBSplineEndpoints;
309 };
310 
311 PXR_NAMESPACE_CLOSE_SCOPE
312 
313 #endif
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...
static const UsdSchemaType schemaType
Compile time constant representing what kind of schema this class is.
Definition: splineAPI.h:80
USDRI_API UsdAttribute GetInterpolationAttr() const
Interpolation method for the spline.
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 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...
UsdRiSplineAPI(const UsdSchemaBase &schemaObj)
Construct a UsdRiSplineAPI on the prim held by schemaObj .
Definition: splineAPI.h:94
Represents a value type name, i.e.
Definition: valueTypeName.h:83
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
USDRI_API bool DoesDuplicateBSplineEndpoints() const
Returns true if this UsdRiSplineAPI is configured to ensure the endpoints are duplicated when using a...
Definition: splineAPI.h:204
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
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:175
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:187
virtual USDRI_API ~UsdRiSplineAPI()
Destructor.
UsdSchemaType
An enum representing which type of schema a given schema class belongs to.
Definition: common.h:127
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Single Apply API schema.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
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:210
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 UsdPrim &prim=UsdPrim())
Construct a UsdRiSplineAPI on UsdPrim prim .
Definition: splineAPI.h:86
Contains an asset path and an optional resolved path.
Definition: assetPath.h:43
USDRI_API UsdAttribute GetValuesAttr() const
Values of the knots.
TfType represents a dynamic runtime type.
Definition: type.h:64
USDRI_API UsdSchemaType _GetSchemaType() const override
Returns the type of schema this class belongs to.
USDRI_API bool Validate(std::string *reason) const
Validates the attribute values belonging to the spline.
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDRI_API UsdAttribute GetPositionsAttr() const
Positions of the knots.
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168
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...
UsdPrim GetPrim() const
Return this schema object&#39;s held prim.
Definition: schemaBase.h:119