Fix: Plane brush symmetry passes do not use the stabilized normal

The issue is the following:
- The stabilized normal for the main pass is calculated in
`calc_brush_plane`
- The normal is (wrongly) recalculated in `update_sculpt_normal`. This
is a common problem that other brushes have. The specific issue with the
Plane brush is that the recomputed normal is not stabilized.
- For symmetry passes, this non-stabilized normal is then assigned to
the brush in `calc_brush_plane`

This PR fixes the issue by explicitly returning false in
`sculpt_brush_needs_normal` when the Plane brush is used. A more proper
refactor would be needed, but this can easily be ported to 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/137271
This commit is contained in:
Nicola
2025-04-11 21:08:50 +02:00
committed by Sean Kim
parent 0ee5e6ded7
commit 3c51029ec7

View File

@@ -807,6 +807,14 @@ static bool brush_uses_topology_rake(const SculptSession &ss, const Brush &brush
*/
static int sculpt_brush_needs_normal(const SculptSession &ss, const Sculpt &sd, 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
* #calc_brush_plane. */
BLI_assert_msg(!math::is_zero(ss.cache->sculpt_normal),
"Normal should have been previously calculated.");
return false;
}
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)) ||