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 
72 {
73 public:
78 
83  explicit UsdRiSplineAPI(const UsdPrim& prim=UsdPrim())
84  : UsdAPISchemaBase(prim)
85  {
86  }
87 
91  explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj)
92  : UsdAPISchemaBase(schemaObj)
93  {
94  }
95 
97  USDRI_API
98  virtual ~UsdRiSplineAPI();
99 
103  USDRI_API
104  static const TfTokenVector &
105  GetSchemaAttributeNames(bool includeInherited=true);
106 
116  USDRI_API
117  static UsdRiSplineAPI
118  Get(const UsdStagePtr &stage, const SdfPath &path);
119 
120 
133  USDRI_API
134  static UsdRiSplineAPI
135  Apply(const UsdPrim &prim);
136 
137 protected:
141  USDRI_API
142  UsdSchemaType _GetSchemaType() const override;
143 
144 private:
145  // needs to invoke _GetStaticTfType.
146  friend class UsdSchemaRegistry;
147  USDRI_API
148  static const TfType &_GetStaticTfType();
149 
150  static bool _IsTypedSchema();
151 
152  // override SchemaBase virtuals.
153  USDRI_API
154  const TfType &_GetTfType() const override;
155 
156 public:
157  // ===================================================================== //
158  // Feel free to add custom code below this line, it will be preserved by
159  // the code generator.
160  //
161  // Just remember to:
162  // - Close the class declaration with };
163  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
164  // - Close the include guard with #endif
165  // ===================================================================== //
166  // --(BEGIN CUSTOM CODE)--
167 
170  explicit UsdRiSplineAPI(const UsdPrim& prim, const TfToken &splineName,
171  const SdfValueTypeName &valuesTypeName,
172  bool doesDuplicateBSplineEndpoints)
173  : UsdAPISchemaBase(prim)
174  , _splineName(splineName)
175  , _valuesTypeName(valuesTypeName)
176  , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
177  {
178  }
179 
182  explicit UsdRiSplineAPI(const UsdSchemaBase& schemaObj,
183  const TfToken &splineName,
184  const SdfValueTypeName &valuesTypeName,
185  bool doesDuplicateBSplineEndpoints)
186  : UsdAPISchemaBase(schemaObj.GetPrim())
187  , _splineName(splineName)
188  , _valuesTypeName(valuesTypeName)
189  , _duplicateBSplineEndpoints(doesDuplicateBSplineEndpoints)
190  {
191  }
192 
198  USDRI_API
200  return _duplicateBSplineEndpoints;
201  }
202 
204  USDRI_API
206  return _valuesTypeName;
207  }
208 
209  // --------------------------------------------------------------------- //
210  // INTERPOLATION
211  // --------------------------------------------------------------------- //
219  USDRI_API
221 
227  USDRI_API
228  UsdAttribute CreateInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
229 
230  // --------------------------------------------------------------------- //
231  // POSITIONS
232  // --------------------------------------------------------------------- //
239  USDRI_API
241 
247  USDRI_API
248  UsdAttribute CreatePositionsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
249 
250  // --------------------------------------------------------------------- //
251  // VALUES
252  // --------------------------------------------------------------------- //
259  USDRI_API
260  UsdAttribute GetValuesAttr() const;
261 
267  USDRI_API
268  UsdAttribute CreateValuesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
269 
276 
290  USDRI_API
291  bool Validate(std::string *reason) const;
292 
294 
295 private:
298  TfToken _GetScopedPropertyName(const TfToken &baseName) const;
299 
300 private:
301  const TfToken _splineName;
302  const SdfValueTypeName _valuesTypeName;
303  bool _duplicateBSplineEndpoints;
304 };
305 
306 PXR_NAMESPACE_CLOSE_SCOPE
307 
308 #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:77
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:91
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:199
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
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:170
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:182
virtual USDRI_API ~UsdRiSplineAPI()
Destructor.
RiSplineAPI is a general purpose API schema used to describe a named spline stored as a set of attrib...
Definition: splineAPI.h:71
UsdSchemaType
An enum representing which type of schema a given schema class belongs to.
Definition: common.h:149
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:131
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
Single Apply API schema.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
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:205
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:83
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:70
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 prim and property definition information for registered Us...
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:182
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