Sculpt: Avoid calculating brush normal during stroke for automasking

The `initial_normal` and `initial_normal_symm` values used for the "Area
Normal" automasking functionality are not set inside
`update_sculpt_normal`, therefore this check and subsequent processing
can be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/137693
This commit is contained in:
Sean Kim
2025-04-18 02:12:37 +02:00
committed by Sean Kim
parent 5a21fa0ada
commit fd803c2a3f
3 changed files with 2 additions and 10 deletions

View File

@@ -805,7 +805,7 @@ static bool brush_uses_topology_rake(const SculptSession &ss, const Brush &brush
/**
* Test whether the #StrokeCache.sculpt_normal needs update in #do_brush_action
*/
static int sculpt_brush_needs_normal(const SculptSession &ss, const Sculpt &sd, const Brush &brush)
static int sculpt_brush_needs_normal(const SculptSession &ss, const Brush &brush)
{
if (brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_PLANE) {
/* The normal for the Plane brush is expected to have already been calculated in
@@ -818,7 +818,6 @@ static int sculpt_brush_needs_normal(const SculptSession &ss, const Sculpt &sd,
using namespace blender::ed::sculpt_paint;
const MTex *mask_tex = BKE_brush_mask_texture_get(&brush, OB_MODE_SCULPT);
return ((bke::brush::supports_normal_weight(brush) && (ss.cache->normal_weight > 0.0f)) ||
auto_mask::needs_normal(sd, &brush) ||
ELEM(brush.sculpt_brush_type,
SCULPT_BRUSH_TYPE_BLOB,
SCULPT_BRUSH_TYPE_CREASE,
@@ -3294,7 +3293,7 @@ static void do_brush_action(const Depsgraph &depsgraph,
push_undo_nodes(depsgraph, ob, brush, node_mask);
}
if (sculpt_brush_needs_normal(ss, sd, brush)) {
if (sculpt_brush_needs_normal(ss, brush)) {
update_sculpt_normal(depsgraph, sd, ob, node_mask);
}

View File

@@ -112,8 +112,6 @@ std::unique_ptr<Cache> cache_init(const Depsgraph &depsgraph,
bool mode_enabled(const Sculpt &sd, const Brush *br, eAutomasking_flag mode);
bool is_enabled(const Sculpt &sd, const Object &object, const Brush *br);
bool needs_normal(const Sculpt &sd, const Brush *brush);
/**
* Calculate all auto-masking influence on each vertex.
*/

View File

@@ -115,11 +115,6 @@ static int calc_effective_bits(const Sculpt &sd, const Brush *brush)
return sd.automasking_flags;
}
bool needs_normal(const Sculpt &sd, const Brush *brush)
{
return calc_effective_bits(sd, brush) & BRUSH_AUTOMASKING_BRUSH_NORMAL;
}
static float normal_calc(const float3 &compare_normal,
const float3 &normal,
float limit_lower,