Fix T38251: "Apply Visual Transform to Pose" Offsets bone unpredictably

Code here was using pchan->chan_mat, which for some reason does not work,
we rather have to use pchan->pose_mat, and convert it again from
pose space to bone space, as done by visual keyframing.
This commit is contained in:
Bastien Montagne 2014-01-21 09:10:08 +01:00
parent 85a3d51078
commit be87a65f49
Notes: blender-bot 2023-02-14 11:20:24 +01:00
Referenced by issue #38251, "Apply Visual Transform to Pose" Offsets bone unpredictably
1 changed files with 5 additions and 1 deletions

View File

@ -213,7 +213,11 @@ static int pose_visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
* new raw-transform components, don't recalc the poses yet, otherwise IK result will
* change, thus changing the result we may be trying to record.
*/
copy_m4_m4(delta_mat, pchan->chan_mat);
/* XXX For some reason, we can't use pchan->chan_mat here, gives odd rotation/offset (see T38251).
* Using pchan->pose_mat and bringing it back in bone space seems to work as expected!
*/
BKE_armature_mat_pose_to_bone(pchan, pchan->pose_mat, delta_mat);
BKE_pchan_apply_mat4(pchan, delta_mat, TRUE);
}
CTX_DATA_END;