From aad88634b611a6ef778a8ebfa4e2e69e8d32d348 Mon Sep 17 00:00:00 2001 From: Casey Bianco-Davis Date: Mon, 11 Aug 2025 18:27:44 +0200 Subject: [PATCH] Fix #144307: Smooth brush uses selection even with mask is disabled. The problem was that the function `smooth_curve_positions` would grab the selection attribute instead of taking the current mask. Pull Request: https://projects.blender.org/blender/blender/pulls/144316 --- .../editors/sculpt_paint/grease_pencil_sculpt_smooth.cc | 9 +++++++-- source/blender/geometry/GEO_smooth_curves.hh | 2 ++ source/blender/geometry/intern/smooth_curves.cc | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/sculpt_paint/grease_pencil_sculpt_smooth.cc b/source/blender/editors/sculpt_paint/grease_pencil_sculpt_smooth.cc index 2a481a71057..ad858edbec3 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_sculpt_smooth.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_sculpt_smooth.cc @@ -147,8 +147,13 @@ void SmoothOperation::on_stroke_extended(const bContext &C, const InputSample &e bool changed = false; if (sculpt_mode_flag & GP_SCULPT_FLAGMODE_APPLY_POSITION) { - geometry::smooth_curve_positions( - curves, curves.curves_range(), iterations, influences, false, false); + geometry::smooth_curve_positions(curves, + curves.curves_range(), + selection_varray, + iterations, + influences, + false, + false); params.drawing.tag_positions_changed(); changed = true; diff --git a/source/blender/geometry/GEO_smooth_curves.hh b/source/blender/geometry/GEO_smooth_curves.hh index 60f8c09df69..47bda6c766b 100644 --- a/source/blender/geometry/GEO_smooth_curves.hh +++ b/source/blender/geometry/GEO_smooth_curves.hh @@ -60,12 +60,14 @@ void smooth_curve_attribute(const IndexMask &curves_to_smooth, */ void smooth_curve_positions(bke::CurvesGeometry &curves, const IndexMask &curves_to_smooth, + const VArray &point_selection, int iterations, const VArray &influence_by_point, bool smooth_ends, bool keep_shape); void smooth_curve_positions(bke::CurvesGeometry &curves, const IndexMask &curves_to_smooth, + const VArray &point_selection, int iterations, float influence, bool smooth_ends, diff --git a/source/blender/geometry/intern/smooth_curves.cc b/source/blender/geometry/intern/smooth_curves.cc index d866b17bc15..e8a32ed535e 100644 --- a/source/blender/geometry/intern/smooth_curves.cc +++ b/source/blender/geometry/intern/smooth_curves.cc @@ -245,6 +245,7 @@ void smooth_curve_attribute(const IndexMask &curves_to_smooth, void smooth_curve_positions(bke::CurvesGeometry &curves, const IndexMask &curves_to_smooth, + const VArray &point_selection, const int iterations, const VArray &influence_by_point, const bool smooth_ends, @@ -253,8 +254,6 @@ void smooth_curve_positions(bke::CurvesGeometry &curves, bke::MutableAttributeAccessor attributes = curves.attributes_for_write(); const OffsetIndices points_by_curve = curves.points_by_curve(); const VArray cyclic = curves.cyclic(); - const VArray point_selection = *curves.attributes().lookup_or_default( - ".selection", bke::AttrDomain::Point, true); if (!curves.has_curve_with_type(CURVE_TYPE_BEZIER)) { bke::GSpanAttributeWriter positions = attributes.lookup_for_write_span("position"); smooth_curve_attribute(curves_to_smooth, @@ -361,6 +360,7 @@ void smooth_curve_positions(bke::CurvesGeometry &curves, void smooth_curve_positions(bke::CurvesGeometry &curves, const IndexMask &curves_to_smooth, + const VArray &point_selection, const int iterations, const float influence, const bool smooth_ends, @@ -368,6 +368,7 @@ void smooth_curve_positions(bke::CurvesGeometry &curves, { smooth_curve_positions(curves, curves_to_smooth, + point_selection, iterations, VArray::from_single(influence, curves.points_num()), smooth_ends,