Commit: 918282d391a4068102bbc4e25ab9c829bd1b41f3
Author: Joseph Eagar
Date:   Tue Nov 29 14:29:45 2022 -0800
Branches: master
https://developer.blender.org/rB918282d391a4068102bbc4e25ab9c829bd1b41f3

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.cc
M       source/blender/editors/sculpt_paint/sculpt_filter_mesh.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.cc 
b/source/blender/editors/sculpt_paint/sculpt.cc
index e1dac167a32..9d30aa512c8 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -4839,6 +4839,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);
     }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to