[Bf-blender-cvs] [fbc020c7527] sculpt-dev: Sculpt: fix twist brush mirroring

Joseph Eagar noreply at git.blender.org
Fri Dec 3 14:23:03 CET 2021


Commit: fbc020c7527754384d71ec1241b3f759d1ec50a5
Author: Joseph Eagar
Date:   Fri Dec 3 05:22:49 2021 -0800
Branches: sculpt-dev
https://developer.blender.org/rBfbc020c7527754384d71ec1241b3f759d1ec50a5

Sculpt: fix twist brush mirroring

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index edd7dc1a377..7000cb441b6 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5152,6 +5152,7 @@ static bool brush_uses_commandlist(Brush *brush, int tool)
     case SCULPT_TOOL_RELAX:
     case SCULPT_TOOL_INFLATE:
     case SCULPT_TOOL_PAINT:
+    case SCULPT_TOOL_TWIST:
     case SCULPT_TOOL_SMEAR:
       ok = true;
       break;
diff --git a/source/blender/editors/sculpt_paint/sculpt_brushes.c b/source/blender/editors/sculpt_paint/sculpt_brushes.c
index 64b2136d012..17435bd397f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_brushes.c
+++ b/source/blender/editors/sculpt_paint/sculpt_brushes.c
@@ -529,8 +529,24 @@ void SCULPT_do_twist_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
     add_v3_v3(area_co, temp);
     */
 
+  int totbit = 0;
+
+  for (int i = 0; i < 3; i++) {
+    if (ss->cache->mirror_symmetry_pass & (1<<i)) {
+      totbit++;
+    }
+  }
+
+  float tan[3];
+
+  copy_v3_v3(tan, ss->cache->grab_delta_symmetry);
+
+  if (totbit & 1) {
+    negate_v3(tan);
+  }
+
   /* Initialize brush local-space matrix. */
-  cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
+  cross_v3_v3v3(mat[0], area_no, tan);
   mat[0][3] = 0.0f;
   cross_v3_v3v3(mat[1], area_no, mat[0]);
   mat[1][3] = 0.0f;



More information about the Bf-blender-cvs mailing list