bindingAPI.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 USDSKEL_GENERATED_BINDINGAPI_H
25 #define USDSKEL_GENERATED_BINDINGAPI_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdSkel/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdSkel/tokens.h"
35 
36 #include "pxr/base/tf/span.h"
37 #include "pxr/usd/usdGeom/primvar.h"
39 
40 #include "pxr/base/vt/value.h"
41 
42 #include "pxr/base/gf/vec3d.h"
43 #include "pxr/base/gf/vec3f.h"
44 #include "pxr/base/gf/matrix4d.h"
45 
46 #include "pxr/base/tf/token.h"
47 #include "pxr/base/tf/type.h"
48 
49 PXR_NAMESPACE_OPEN_SCOPE
50 
51 class SdfAssetPath;
52 
53 // -------------------------------------------------------------------------- //
54 // SKELBINDINGAPI //
55 // -------------------------------------------------------------------------- //
56 
73 {
74 public:
79 
84  explicit UsdSkelBindingAPI(const UsdPrim& prim=UsdPrim())
85  : UsdAPISchemaBase(prim)
86  {
87  }
88 
92  explicit UsdSkelBindingAPI(const UsdSchemaBase& schemaObj)
93  : UsdAPISchemaBase(schemaObj)
94  {
95  }
96 
98  USDSKEL_API
99  virtual ~UsdSkelBindingAPI();
100 
104  USDSKEL_API
105  static const TfTokenVector &
106  GetSchemaAttributeNames(bool includeInherited=true);
107 
117  USDSKEL_API
118  static UsdSkelBindingAPI
119  Get(const UsdStagePtr &stage, const SdfPath &path);
120 
121 
138  USDSKEL_API
139  static bool
140  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
141 
157  USDSKEL_API
158  static UsdSkelBindingAPI
159  Apply(const UsdPrim &prim);
160 
161 protected:
165  USDSKEL_API
166  UsdSchemaKind _GetSchemaKind() const override;
167 
168 private:
169  // needs to invoke _GetStaticTfType.
170  friend class UsdSchemaRegistry;
171  USDSKEL_API
172  static const TfType &_GetStaticTfType();
173 
174  static bool _IsTypedSchema();
175 
176  // override SchemaBase virtuals.
177  USDSKEL_API
178  const TfType &_GetTfType() const override;
179 
180 public:
181  // --------------------------------------------------------------------- //
182  // SKINNINGMETHOD
183  // --------------------------------------------------------------------- //
193  USDSKEL_API
195 
201  USDSKEL_API
202  UsdAttribute CreateSkinningMethodAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
203 
204 public:
205  // --------------------------------------------------------------------- //
206  // GEOMBINDTRANSFORM
207  // --------------------------------------------------------------------- //
219  USDSKEL_API
221 
227  USDSKEL_API
228  UsdAttribute CreateGeomBindTransformAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
229 
230 public:
231  // --------------------------------------------------------------------- //
232  // JOINTS
233  // --------------------------------------------------------------------- //
246  USDSKEL_API
247  UsdAttribute GetJointsAttr() const;
248 
254  USDSKEL_API
255  UsdAttribute CreateJointsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
256 
257 public:
258  // --------------------------------------------------------------------- //
259  // JOINTINDICES
260  // --------------------------------------------------------------------- //
275  USDSKEL_API
277 
283  USDSKEL_API
284  UsdAttribute CreateJointIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
285 
286 public:
287  // --------------------------------------------------------------------- //
288  // JOINTWEIGHTS
289  // --------------------------------------------------------------------- //
302  USDSKEL_API
304 
310  USDSKEL_API
311  UsdAttribute CreateJointWeightsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
312 
313 public:
314  // --------------------------------------------------------------------- //
315  // BLENDSHAPES
316  // --------------------------------------------------------------------- //
330  USDSKEL_API
332 
338  USDSKEL_API
339  UsdAttribute CreateBlendShapesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
340 
341 public:
342  // --------------------------------------------------------------------- //
343  // ANIMATIONSOURCE
344  // --------------------------------------------------------------------- //
349  USDSKEL_API
351 
354  USDSKEL_API
356 
357 public:
358  // --------------------------------------------------------------------- //
359  // SKELETON
360  // --------------------------------------------------------------------- //
365  USDSKEL_API
367 
370  USDSKEL_API
372 
373 public:
374  // --------------------------------------------------------------------- //
375  // BLENDSHAPETARGETS
376  // --------------------------------------------------------------------- //
381  USDSKEL_API
383 
386  USDSKEL_API
388 
389 public:
390  // ===================================================================== //
391  // Feel free to add custom code below this line, it will be preserved by
392  // the code generator.
393  //
394  // Just remember to:
395  // - Close the class declaration with };
396  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
397  // - Close the include guard with #endif
398  // ===================================================================== //
399  // --(BEGIN CUSTOM CODE)--
400 
404  USDSKEL_API
406 
415  USDSKEL_API
417  int elementSize=-1) const;
418 
422  USDSKEL_API
424 
433  USDSKEL_API
435  int elementSize=-1) const;
436 
439  USDSKEL_API
440  bool SetRigidJointInfluence(int jointIndex, float weight=1) const;
441 
448  USDSKEL_API
449  bool GetSkeleton(UsdSkelSkeleton* skel) const;
450 
457  USDSKEL_API
458  bool GetAnimationSource(UsdPrim* prim) const;
459 
461  USDSKEL_API
463 
466  USDSKEL_API
468 
474  USDSKEL_API
475  static bool ValidateJointIndices(TfSpan<const int> indices,
476  size_t numJoints,
477  std::string* reason=nullptr);
478 };
479 
480 PXR_NAMESPACE_CLOSE_SCOPE
481 
482 #endif
USDSKEL_API UsdAttribute CreateSkinningMethodAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetSkinningMethodAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDSKEL_API UsdAttribute GetJointWeightsAttr() const
Weights for the joints that affect each point of a PointBased gprim.
USDSKEL_API UsdAttribute CreateJointsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetJointsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDSKEL_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...
USDSKEL_API UsdRelationship GetSkeletonRel() const
Skeleton to be bound to this prim and its descendents that possess a mapping and weighting to the joi...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: bindingAPI.h:78
static USDSKEL_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.
USDSKEL_API UsdAttribute GetJointsAttr() const
An (optional) array of tokens defining the list of joints to which jointIndices apply.
USDSKEL_API UsdRelationship CreateAnimationSourceRel() const
See GetAnimationSourceRel(), and also Create vs Get Property Methods for when to use Get vs Create.
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
USDSKEL_API UsdAttribute GetBlendShapesAttr() const
An array of tokens defining the order onto which blend shape weights from an animation source map ont...
USDSKEL_API UsdPrim GetInheritedAnimationSource() const
Returns the animation source bound at this prim, or one of its ancestors.
USDSKEL_API UsdSkelSkeleton GetInheritedSkeleton() const
Returns the skeleton bound at this prim, or one of its ancestors.
UsdSkelBindingAPI(const UsdSchemaBase &schemaObj)
Construct a UsdSkelBindingAPI on the prim held by schemaObj .
Definition: bindingAPI.h:92
static USDSKEL_API UsdSkelBindingAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdSkelBindingAPI holding the prim adhering to this schema at path on stage.
USDSKEL_API UsdGeomPrimvar CreateJointIndicesPrimvar(bool constant, int elementSize=-1) const
Convenience function to create the jointIndices primvar, optionally specifying elementSize.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
Single Apply API schema.
USDSKEL_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDSKEL_API UsdGeomPrimvar GetJointWeightsPrimvar() const
Convenience function to get the jointWeights attribute as a primvar.
USDSKEL_API UsdGeomPrimvar GetJointIndicesPrimvar() const
Convenience function to get the jointIndices attribute as a primvar.
static USDSKEL_API UsdSkelBindingAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
USDSKEL_API bool GetAnimationSource(UsdPrim *prim) const
Convenience method to query the animation source bound on this prim.
Represents a range of contiguous elements.
Definition: span.h:87
USDSKEL_API UsdRelationship CreateSkeletonRel() const
See GetSkeletonRel(), and also Create vs Get Property Methods for when to use Get vs Create.
USDSKEL_API bool SetRigidJointInfluence(int jointIndex, float weight=1) const
Convenience method for defining joints influences that make a primitive rigidly deformed by a single ...
Provides API for authoring and extracting all the skinning-related data that lives in the "geometry h...
Definition: bindingAPI.h:72
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
USDSKEL_API UsdAttribute CreateJointWeightsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetJointWeightsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDSKEL_API UsdRelationship GetBlendShapeTargetsRel() const
Ordered list of all target blend shapes.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
USDSKEL_API UsdAttribute CreateGeomBindTransformAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetGeomBindTransformAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
USDSKEL_API UsdAttribute CreateJointIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetJointIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
Describes a skeleton.
Definition: skeleton.h:63
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
virtual USDSKEL_API ~UsdSkelBindingAPI()
Destructor.
USDSKEL_API bool GetSkeleton(UsdSkelSkeleton *skel) const
Convenience method to query the Skeleton bound on this prim.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
USDSKEL_API UsdAttribute CreateBlendShapesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetBlendShapesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDSKEL_API bool ValidateJointIndices(TfSpan< const int > indices, size_t numJoints, std::string *reason=nullptr)
Validate an array of joint indices.
USDSKEL_API UsdRelationship GetAnimationSourceRel() const
Animation source to be bound to Skeleton primitives at or beneath the location at which this property...
USDSKEL_API UsdAttribute GetGeomBindTransformAttr() const
Encodes the bind-time world space transforms of the prim.
USDSKEL_API UsdRelationship CreateBlendShapeTargetsRel() const
See GetBlendShapeTargetsRel(), and also Create vs Get Property Methods for when to use Get vs Create.
USDSKEL_API UsdAttribute GetJointIndicesAttr() const
Indices into the joints attribute of the closest (in namespace) bound Skeleton that affect each point...
TfType represents a dynamic runtime type.
Definition: type.h:64
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDSKEL_API UsdGeomPrimvar CreateJointWeightsPrimvar(bool constant, int elementSize=-1) const
Convenience function to create the jointWeights primvar, optionally specifying elementSize.
Schema wrapper for UsdAttribute for authoring and introspecting attributes that are primvars.
Definition: primvar.h:261
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:166
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
USDSKEL_API UsdAttribute GetSkinningMethodAttr() const
The skinningMethod specifies the skinning method for the prim.
UsdSkelBindingAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdSkelBindingAPI on UsdPrim prim .
Definition: bindingAPI.h:84