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 
68 {
69 public:
74 
79  explicit UsdSkelBindingAPI(const UsdPrim& prim=UsdPrim())
80  : UsdAPISchemaBase(prim)
81  {
82  }
83 
87  explicit UsdSkelBindingAPI(const UsdSchemaBase& schemaObj)
88  : UsdAPISchemaBase(schemaObj)
89  {
90  }
91 
93  USDSKEL_API
94  virtual ~UsdSkelBindingAPI();
95 
99  USDSKEL_API
100  static const TfTokenVector &
101  GetSchemaAttributeNames(bool includeInherited=true);
102 
112  USDSKEL_API
113  static UsdSkelBindingAPI
114  Get(const UsdStagePtr &stage, const SdfPath &path);
115 
116 
133  USDSKEL_API
134  static bool
135  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
136 
152  USDSKEL_API
153  static UsdSkelBindingAPI
154  Apply(const UsdPrim &prim);
155 
156 protected:
160  USDSKEL_API
161  UsdSchemaKind _GetSchemaKind() const override;
162 
163 private:
164  // needs to invoke _GetStaticTfType.
165  friend class UsdSchemaRegistry;
166  USDSKEL_API
167  static const TfType &_GetStaticTfType();
168 
169  static bool _IsTypedSchema();
170 
171  // override SchemaBase virtuals.
172  USDSKEL_API
173  const TfType &_GetTfType() const override;
174 
175 public:
176  // --------------------------------------------------------------------- //
177  // GEOMBINDTRANSFORM
178  // --------------------------------------------------------------------- //
190  USDSKEL_API
192 
198  USDSKEL_API
199  UsdAttribute CreateGeomBindTransformAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
200 
201 public:
202  // --------------------------------------------------------------------- //
203  // JOINTS
204  // --------------------------------------------------------------------- //
217  USDSKEL_API
218  UsdAttribute GetJointsAttr() const;
219 
225  USDSKEL_API
226  UsdAttribute CreateJointsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
227 
228 public:
229  // --------------------------------------------------------------------- //
230  // JOINTINDICES
231  // --------------------------------------------------------------------- //
246  USDSKEL_API
248 
254  USDSKEL_API
255  UsdAttribute CreateJointIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
256 
257 public:
258  // --------------------------------------------------------------------- //
259  // JOINTWEIGHTS
260  // --------------------------------------------------------------------- //
273  USDSKEL_API
275 
281  USDSKEL_API
282  UsdAttribute CreateJointWeightsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
283 
284 public:
285  // --------------------------------------------------------------------- //
286  // BLENDSHAPES
287  // --------------------------------------------------------------------- //
301  USDSKEL_API
303 
309  USDSKEL_API
310  UsdAttribute CreateBlendShapesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
311 
312 public:
313  // --------------------------------------------------------------------- //
314  // ANIMATIONSOURCE
315  // --------------------------------------------------------------------- //
320  USDSKEL_API
322 
325  USDSKEL_API
327 
328 public:
329  // --------------------------------------------------------------------- //
330  // SKELETON
331  // --------------------------------------------------------------------- //
336  USDSKEL_API
338 
341  USDSKEL_API
343 
344 public:
345  // --------------------------------------------------------------------- //
346  // BLENDSHAPETARGETS
347  // --------------------------------------------------------------------- //
352  USDSKEL_API
354 
357  USDSKEL_API
359 
360 public:
361  // ===================================================================== //
362  // Feel free to add custom code below this line, it will be preserved by
363  // the code generator.
364  //
365  // Just remember to:
366  // - Close the class declaration with };
367  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
368  // - Close the include guard with #endif
369  // ===================================================================== //
370  // --(BEGIN CUSTOM CODE)--
371 
375  USDSKEL_API
377 
386  USDSKEL_API
388  int elementSize=-1) const;
389 
393  USDSKEL_API
395 
404  USDSKEL_API
406  int elementSize=-1) const;
407 
410  USDSKEL_API
411  bool SetRigidJointInfluence(int jointIndex, float weight=1) const;
412 
419  USDSKEL_API
420  bool GetSkeleton(UsdSkelSkeleton* skel) const;
421 
428  USDSKEL_API
429  bool GetAnimationSource(UsdPrim* prim) const;
430 
432  USDSKEL_API
434 
437  USDSKEL_API
439 
445  USDSKEL_API
446  static bool ValidateJointIndices(TfSpan<const int> indices,
447  size_t numJoints,
448  std::string* reason=nullptr);
449 };
450 
451 PXR_NAMESPACE_CLOSE_SCOPE
452 
453 #endif
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:73
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:87
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:67
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...
UsdSkelBindingAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdSkelBindingAPI on UsdPrim prim .
Definition: bindingAPI.h:79