Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-11-04 23:41:22 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-11-06 01:26:18 +0300
commite2b3681f09c774aac96e7e4a06922897bdacb773 (patch)
tree3fc4ed8922285ba543c596934924542f5f76d94d /source/blender/editors/sculpt_paint/sculpt.c
parent00374fbde2bd717f3fe7b8ee5eb79be0145de37b (diff)
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
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c11
1 files changed, 10 insertions, 1 deletions
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);