From 3c51029ec790207107f48d34e2bb4bfa707f6afc Mon Sep 17 00:00:00 2001 From: Nicola Date: Fri, 11 Apr 2025 21:08:50 +0200 Subject: [PATCH] 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 --- source/blender/editors/sculpt_paint/sculpt.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 472e0a20772..a04b9b9527a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -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)) ||