Fix T83856: Sculpt: anchored brushes with spherical falloff ignore topology automasking

Anchored brushes with spherical falloff start off with zero radius, thus
we have no pbvh nodes on the first brush step. This would prevent
initializing the automasking cache [which only happens on the first brush
step].

Maniphest Tasks: T83856

Differential Revision: https://developer.blender.org/D9873
This commit is contained in:
Philipp Oeser 2020-12-16 19:00:12 +01:00
parent 247b10e6a2
commit 07c4615431
Notes: blender-bot 2023-02-14 08:39:23 +01:00
Referenced by issue #83856, Sculpt: anchored brushes with spherical falloff ignore topology automasking
1 changed files with 11 additions and 6 deletions

View File

@ -5923,6 +5923,17 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
}
}
/* Initialize automasking cache. For anchored brushes with spherical falloff, we start off with
* zero radius, thus we have no pbvh nodes on the first brush step. */
if (totnode ||
((brush->falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) && (brush->flag & BRUSH_ANCHORED))) {
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
if (SCULPT_is_automasking_enabled(sd, ss, brush)) {
ss->cache->automasking = SCULPT_automasking_cache_init(sd, brush, ob);
}
}
}
/* Only act if some verts are inside the brush area. */
if (totnode) {
float location[3];
@ -5946,12 +5957,6 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
update_brush_local_mat(sd, ob);
}
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
if (SCULPT_is_automasking_enabled(sd, ss, brush)) {
ss->cache->automasking = SCULPT_automasking_cache_init(sd, brush, ob);
}
}
if (brush->sculpt_tool == SCULPT_TOOL_POSE && SCULPT_stroke_is_first_brush_step(ss->cache)) {
SCULPT_pose_brush_init(sd, ob, ss, brush);
}