[Bf-blender-cvs] [2bc0e8d3049] master: Fix T81452: Incorrect trim lasso radius

Joseph Eagar noreply at git.blender.org
Mon Apr 25 22:12:09 CEST 2022


Commit: 2bc0e8d3049ec1b7c775717ec7aff6e9ab1c7726
Author: Joseph Eagar
Date:   Mon Apr 25 13:10:23 2022 -0700
Branches: master
https://developer.blender.org/rB2bc0e8d3049ec1b7c775717ec7aff6e9ab1c7726

Fix T81452: Incorrect trim lasso radius

Added a fallback path to compute the
cursor radius for when the stroke
starts over a blank area of space
(in which case SCULPT_cursor_geometry_update
fails).

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

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

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

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 3ca686e9351..fb5e76b578f 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1057,7 +1057,30 @@ static void sculpt_gesture_trim_calculate_depth(SculptGestureContext *sgcontext)
                             (trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
     }
 
-    const float depth_radius = ss->cursor_radius;
+    float depth_radius;
+
+    if (ss->gesture_initial_hit) {
+      depth_radius = ss->cursor_radius;
+    }
+    else {
+      /* ss->cursor_radius is only valid if the stroke started
+       * over the sculpt mesh.  If it's not we must
+       * compute the radius ourselves.  See T81452.
+       */
+
+      Sculpt *sd = CTX_data_tool_settings(vc->C)->sculpt;
+      Brush *brush = BKE_paint_brush(&sd->paint);
+      Scene *scene = CTX_data_scene(vc->C);
+
+      if (!BKE_brush_use_locked_size(scene, brush)) {
+        depth_radius = paint_calc_object_space_radius(
+            vc, ss->gesture_initial_location, BKE_brush_size_get(scene, brush));
+      }
+      else {
+        depth_radius = BKE_brush_unprojected_radius_get(scene, brush);
+      }
+    }
+
     trim_operation->depth_front = mid_point_depth - depth_radius;
     trim_operation->depth_back = mid_point_depth + depth_radius;
   }



More information about the Bf-blender-cvs mailing list