diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-08-07 21:08:16 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-10-04 19:55:44 +0300 |
commit | 65f77ccea1645f8c66fc171377641b08b62010e0 (patch) | |
tree | 8ff90e2385cadcbe7e50a4de0ffd062fea182668 /source/blender/blenkernel/BKE_armature.h | |
parent | 61a24c799b2882c22a43591138a113d7f09be0ed (diff) |
Fix T56268: display the correct rest shape for B-Bones in Edit Mode.
The rest shape of B-Bones is actually affected by custom handles or
the default connected parent/child mechanism. Ignoring these effects
thus leads to the edit mode shape being different from the actual
rest pose.
This splits the b_bone_spline_setup function that is used to compute
the correct rest and pose shape from pose channels into two parts,
and applies the data structure independent half to edit mode.
In order to access the custom handle settings in Edit Mode, they are
moved to Bone and EditBone, while the bPoseChannel fields are downgraded
in status to a cache for performance. Also, instead of flags, introduce
an enum to specify the handle operation modes, so that new ones could
be added later.
Reviewers: aligorith, brecht
Differential Revision: https://developer.blender.org/D3588
Diffstat (limited to 'source/blender/blenkernel/BKE_armature.h')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 44120d182b7..abcf1388c55 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -140,11 +140,34 @@ typedef struct Mat4 { float mat[4][4]; } Mat4; +typedef struct BBoneSplineParameters { + int segments; + float length; + + /* Non-uniform scale correction. */ + bool do_scale; + float scale[3]; + + /* Handle control bone data. */ + bool use_prev, prev_bbone; + bool use_next, next_bbone; + + float prev_h[3], next_h[3]; + float prev_mat[4][4], next_mat[4][4]; + + /* Control values. */ + float ease1, ease2; + float roll1, roll2; + float scaleIn, scaleOut; + float curveInX, curveInY, curveOutX, curveOutY; +} BBoneSplineParameters; + void BKE_pchan_get_bbone_handles(struct bPoseChannel *pchan, struct bPoseChannel **r_prev, struct bPoseChannel **r_next); -void equalize_bbone_bezier(float *data, int desired); void b_bone_spline_setup(struct bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BBONE_SUBDIV]); +int BKE_compute_b_bone_spline(struct BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]); + /* like EBONE_VISIBLE */ #define PBONE_VISIBLE(arm, bone) ( \ CHECK_TYPE_INLINE(arm, bArmature *), \ |