[Bf-blender-cvs] [8fa5206ab04] blender-v3.4-release: Sculpt: fix crash when no brush

Joseph Eagar noreply at git.blender.org
Wed Nov 30 22:53:15 CET 2022


Commit: 8fa5206ab04d901320484351657bbcea8dc037f0
Author: Joseph Eagar
Date:   Tue Nov 29 14:29:45 2022 -0800
Branches: blender-v3.4-release
https://developer.blender.org/rB8fa5206ab04d901320484351657bbcea8dc037f0

Sculpt: fix crash when no brush

If no brush exists the stroke operator
falls through to the grab transform
op in the global view3d keymap.

This now works.  It would be nice if
we could get rid of that keymap entry
though and add it manually to the edit/paint
modes that need it.

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index aad86ffc2b1..212d39464b7 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4861,6 +4861,10 @@ static bool sculpt_needs_connectivity_info(const Sculpt *sd,
                                            SculptSession *ss,
                                            int stroke_mode)
 {
+  if (!brush) {
+    return true;
+  }
+
   if (ss && ss->pbvh && SCULPT_is_automasking_enabled(sd, ss, brush)) {
     return true;
   }
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index c158cf33f6d..e677b565a10 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -191,7 +191,8 @@ void SCULPT_filter_cache_init(bContext *C,
 
     BKE_pbvh_search_gather(pbvh, SCULPT_search_sphere_cb, &search_data2, &nodes, &totnode);
 
-    if (SCULPT_pbvh_calc_area_normal(
+    if (BKE_paint_brush(&sd->paint) &&
+        SCULPT_pbvh_calc_area_normal(
             brush, ob, nodes, totnode, true, ss->filter_cache->initial_normal)) {
       copy_v3_v3(ss->last_normal, ss->filter_cache->initial_normal);
     }



More information about the Bf-blender-cvs mailing list