[Bf-blender-cvs] [e2b3681f09c] master: Fix Dyntopo detail size preview orientation not matching the cursor

Pablo Dobarro noreply at git.blender.org
Thu Nov 5 23:26:50 CET 2020


Commit: e2b3681f09c774aac96e7e4a06922897bdacb773
Author: Pablo Dobarro
Date:   Wed Nov 4 21:41:22 2020 +0100
Branches: master
https://developer.blender.org/rBe2b3681f09c774aac96e7e4a06922897bdacb773

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

===================================================================

M	source/blender/editors/sculpt_paint/sculpt.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list