[Bf-blender-cvs] [042775ad482] master: Sculpt: Fix T104068, depth calculation error in trim tools

Joseph Eagar noreply at git.blender.org
Sun Jan 29 01:10:04 CET 2023


Commit: 042775ad482977a930528bf11eb26da5ce2810f0
Author: Joseph Eagar
Date:   Sat Jan 28 16:04:50 2023 -0800
Branches: master
https://developer.blender.org/rB042775ad482977a930528bf11eb26da5ce2810f0

Sculpt: Fix T104068, depth calculation error in trim tools

Also made the coplanar padding factor relative.

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

M	source/blender/editors/sculpt_paint/paint_mask.cc

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

diff --git a/source/blender/editors/sculpt_paint/paint_mask.cc b/source/blender/editors/sculpt_paint/paint_mask.cc
index c0f4ddf4218..177bc33bed5 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.cc
+++ b/source/blender/editors/sculpt_paint/paint_mask.cc
@@ -1148,13 +1148,16 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
 
   float depth_front = trim_operation->depth_front;
   float depth_back = trim_operation->depth_back;
+  float pad_factor = 0.0f;
 
   if (!trim_operation->use_cursor_depth) {
+    pad_factor = (depth_back - depth_front) * 0.01f + 0.001f;
+
     /* When using cursor depth, don't modify the depth set by the cursor radius. If full depth is
      * used, adding a little padding to the trimming shape can help avoiding booleans with coplanar
      * faces. */
-    depth_front -= 0.1f;
-    depth_back += 0.1f;
+    depth_front -= pad_factor;
+    depth_back += pad_factor;
   }
 
   float shape_origin[3];
@@ -1198,7 +1201,9 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
     }
     else {
       copy_v3_v3(new_point, positions[i]);
-      madd_v3_v3fl(new_point, shape_normal, depth_back);
+      float dist = dist_signed_to_plane_v3(new_point, shape_plane);
+
+      madd_v3_v3fl(new_point, shape_normal, depth_back - dist);
     }
 
     copy_v3_v3(positions[i + tot_screen_points], new_point);



More information about the Bf-blender-cvs mailing list