From e2b3681f09c774aac96e7e4a06922897bdacb773 Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Wed, 4 Nov 2020 21:41:22 +0100 Subject: Fix Dyntopo detail size preview orientation not matching the cursor Used the sampled cursor normal when available instead of the raycast face normal. This makes the preview match the previous orientation of the cursor. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9460 --- source/blender/editors/sculpt_paint/sculpt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ecd45bfb5e9..604378cd691 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -9514,7 +9514,16 @@ static int dyntopo_detail_size_edit_invoke(bContext *C, wmOperator *op, const wm copy_m4_m4(cursor_trans, active_object->obmat); translate_m4( cursor_trans, ss->cursor_location[0], ss->cursor_location[1], ss->cursor_location[2]); - rotation_between_vecs_to_quat(quat, z_axis, ss->cursor_normal); + + float cursor_normal[3]; + if (!is_zero_v3(ss->cursor_sampled_normal)) { + copy_v3_v3(cursor_normal, ss->cursor_sampled_normal); + } + else { + copy_v3_v3(cursor_normal, ss->cursor_normal); + } + + rotation_between_vecs_to_quat(quat, z_axis, cursor_normal); quat_to_mat4(cursor_rot, quat); copy_m4_m4(cd->gizmo_mat, cursor_trans); mul_m4_m4_post(cd->gizmo_mat, cursor_rot); -- cgit v1.2.3