[Bf-blender-cvs] [7a67cb2aeb2] sculpt-dev: Twist Brush: Fix bug in rotation

Pablo Dobarro noreply at git.blender.org
Fri Jul 2 22:20:19 CEST 2021


Commit: 7a67cb2aeb23fc764b2a722bff96d5f5b597ada2
Author: Pablo Dobarro
Date:   Sun Jun 20 17:53:35 2021 +0200
Branches: sculpt-dev
https://developer.blender.org/rB7a67cb2aeb23fc764b2a722bff96d5f5b597ada2

Twist Brush: Fix bug in rotation

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

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 93627662dc1..ccf49d429a7 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5859,8 +5859,13 @@ static void do_twist_brush_task_cb_ex(void *__restrict userdata,
   add_v3_v3v3(stroke_line[1], stroke_line[0], stroke_direction);
 
 
+  SculptOrigVertData orig_data;
+  SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
+
 
   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
+
+    SCULPT_orig_vert_data_update(&orig_data, &vd);
     if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
       continue;
     }
@@ -5889,18 +5894,18 @@ static void do_twist_brush_task_cb_ex(void *__restrict userdata,
 
     copy_m4_m4(scaled_mat, mat);
     invert_m4(scaled_mat);
-    mul_v3_fl(scaled_mat[2], 0.5f * fade);
+    mul_v3_fl(scaled_mat[2], 0.3f * fade);
     invert_m4(scaled_mat);
     
     invert_m4_m4(scaled_mat_inv, scaled_mat);
 
 
     mul_v3_m4v3(local_vert_co, scaled_mat, vd.co);
-    closest_to_line_v3(vertex_in_line, vd.co, rotation_axis, origin);
+    closest_to_line_v3(vertex_in_line, local_vert_co, rotation_axis, origin);
     float p_to_rotate[3];
     sub_v3_v3v3(p_to_rotate, local_vert_co, vertex_in_line);
     float p_rotated[3];
-    rotate_v3_v3v3fl(p_rotated, p_to_rotate, rotation_axis, bstrength * fade);
+    rotate_v3_v3v3fl(p_rotated, p_to_rotate, rotation_axis, 2.0f * bstrength * fade);
     add_v3_v3(p_rotated, vertex_in_line);
     mul_v3_m4v3(p_rotated, scaled_mat_inv, p_rotated);
 
@@ -5974,9 +5979,11 @@ static void do_twist_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
     return;
   }
 
+/*
   mul_v3_v3v3(temp, area_no_sp, ss->cache->scale);
   mul_v3_fl(temp, displace);
   add_v3_v3(area_co, temp);
+  */
 
   /* Initialize brush local-space matrix. */
   cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
@@ -5985,7 +5992,7 @@ static void do_twist_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
   mat[1][3] = 0.0f;
   copy_v3_v3(mat[2], area_no);
   mat[2][3] = 0.0f;
-  copy_v3_v3(mat[3], ss->cache->location);
+  copy_v3_v3(mat[3], area_co);
   mat[3][3] = 1.0f;
   normalize_m4(mat);



More information about the Bf-blender-cvs mailing list