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.
This commit is contained in:
Joseph Eagar 2022-11-29 14:29:45 -08:00
parent 692474ccf9
commit 8fa5206ab0
2 changed files with 6 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);
}