Cleanup: Move Surface Smooth brush initialization into brush file

Pull Request: https://projects.blender.org/blender/blender/pulls/138905
This commit is contained in:
Sean Kim
2025-05-15 04:36:51 +02:00
committed by Sean Kim
parent e97e9c2904
commit 5d0df1f052
2 changed files with 7 additions and 8 deletions

View File

@@ -387,6 +387,13 @@ void do_surface_smooth_brush(const Depsgraph &depsgraph,
bke::pbvh::Tree &pbvh = *bke::object::pbvh_get(object);
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
if (ss.cache->surface_smooth_laplacian_disp.is_empty()) {
BLI_assert_msg(SCULPT_stroke_is_first_brush_step(*ss.cache),
"Should only be allocated on the first step");
ss.cache->surface_smooth_laplacian_disp = Array<float3>(SCULPT_vertex_count_get(object),
float3(0));
}
switch (pbvh.type()) {
case bke::pbvh::Type::Mesh:
do_surface_smooth_brush_mesh(

View File

@@ -3241,14 +3241,6 @@ static void do_brush_action(const Depsgraph &depsgraph,
if (auto_mask::is_enabled(sd, ob, &brush)) {
ss.cache->automasking = auto_mask::cache_init(depsgraph, sd, &brush, ob);
}
/* Initialize surface smooth cache. */
if ((brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_SMOOTH) &&
(brush.smooth_deform_type == BRUSH_SMOOTH_DEFORM_SURFACE))
{
BLI_assert(ss.cache->surface_smooth_laplacian_disp.is_empty());
ss.cache->surface_smooth_laplacian_disp = Array<float3>(SCULPT_vertex_count_get(ob),
float3(0));
}
}
}