HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blendShapeData.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_BLEND_SHAPE_DATA_H
8 #define PXR_USD_IMAGING_USD_SKEL_IMAGING_BLEND_SHAPE_DATA_H
9 
11 
12 #include "pxr/usd/sdf/path.h"
13 
14 #include "pxr/base/vt/array.h"
15 
17 
18 #include <map>
19 
21 
23 
24 ///
25 /// Data to determine sub shape contributions.
26 ///
27 /// Sub shape:
28 ///
29 /// A sub shape consists of offsets for a subset of points or all points of a
30 /// deformable prim with SkelBindingAPI.
31 ///
32 /// The offsets ultimately applied to the prim are computed as linear
33 /// combination of the sub shapes.
34 ///
35 /// Sub shapes come from the BlendShape prim's targeted by the deformable prim.
36 /// Each BlendShape can provide several subshapes: one from BlendShape.offsets
37 /// and several from BlendShape.inbetweens:BETWEEN_NAME:offsets.
38 ///
40 {
41  /// Weight authored for BlendShape.inbetweens:BETWEEN_NAME
42  ///
43  /// weight = 1.0 for the sub shape corresponding to a BlendShape.offsets.
44  ///
45  /// If weight = 0.0, this pair does not correspond to any sub shape and
46  /// subShapeIndex = -1.
47  float weight;
48 
49  /// Index to sub shape. -1 if this pair does not correspond to a sub shape.
51 };
52 
54  std::vector<UsdSkelImagingWeightAndSubShapeIndex>;
55 
56 /// Data for skinned prim to compute the skel ext computation inputs related to
57 /// blend shapes. These data come from the skeleton and the skelBinding, but
58 /// not from the skelAnimation.
60 {
61  /// Path of deformable prim. Used only for warnings/error messages.
63 
64  /// List of (offset, subShapeIndex)
66  /// For each point, pair of indices into blendShapeOffsets.
68 
69  size_t numSubShapes;
70 
71  /// For each blend shape name in SkelBindingAPI.skel:blendShapes, a
72  /// list of (weight, subShapeIndex).
73  ///
74  /// Includes (0.0, -1) to indicate that weight zero in
75  /// SkelAnimation.blendShapeWeights corresponds to applying any
76  /// sub shape from that BlendShape.
77  ///
78  /// Includes (1.0, sub shape index) for the BlendShape.offsets and
79  /// (weight, sub shape index) for the BlendShape.inbetweens:BETWEEN_NAME.
80  ///
81  std::map<TfToken, UsdSkelImagingWeightsAndSubShapeIndices>
83 };
84 
85 /// Computed blend shape for deformable prim with skelBindingAPI.
89  HdSceneIndexBaseRefPtr const &sceneIndex,
90  const SdfPath &primPath);
91 
92 /// blendShapeWeights for skel ext computation inputs.
93 ///
94 /// One weight for each sub shape.
95 ///
100  // from skel animation
101  const VtArray<TfToken> &blendShapeNames,
102  // from skel animation
103  const VtArray<float> &blendShapeWeights);
104 
106 
107 #endif
VtArray< GfVec4f > blendShapeOffsets
List of (offset, subShapeIndex)
std::vector< UsdSkelImagingWeightAndSubShapeIndex > UsdSkelImagingWeightsAndSubShapeIndices
USDSKELIMAGING_API VtArray< float > UsdSkelImagingComputeBlendShapeWeights(const UsdSkelImagingBlendShapeData &data, const VtArray< TfToken > &blendShapeNames, const VtArray< float > &blendShapeWeights)
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_REF_PTRS(HdSceneIndexBase)
USDSKELIMAGING_API UsdSkelImagingBlendShapeData UsdSkelImagingComputeBlendShapeData(HdSceneIndexBaseRefPtr const &sceneIndex, const SdfPath &primPath)
Computed blend shape for deformable prim with skelBindingAPI.
VtArray< GfVec2i > blendShapeOffsetRanges
For each point, pair of indices into blendShapeOffsets.
Definition: path.h:273
#define USDSKELIMAGING_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
int subShapeIndex
Index to sub shape. -1 if this pair does not correspond to a sub shape.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::map< TfToken, UsdSkelImagingWeightsAndSubShapeIndices > blendShapeNameToWeightsAndSubShapeIndices
SdfPath primPath
Path of deformable prim. Used only for warnings/error messages.
Definition: format.h:1821