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
This commit is contained in:
Casey Bianco-Davis
2025-08-11 18:27:44 +02:00
committed by Falk David
parent 6bbeac97fd
commit aad88634b6
3 changed files with 12 additions and 4 deletions

View File

@@ -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;

View File

@@ -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<bool> &point_selection,
int iterations,
const VArray<float> &influence_by_point,
bool smooth_ends,
bool keep_shape);
void smooth_curve_positions(bke::CurvesGeometry &curves,
const IndexMask &curves_to_smooth,
const VArray<bool> &point_selection,
int iterations,
float influence,
bool smooth_ends,

View File

@@ -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<bool> &point_selection,
const int iterations,
const VArray<float> &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<bool> cyclic = curves.cyclic();
const VArray<bool> point_selection = *curves.attributes().lookup_or_default<bool>(
".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<bool> &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<float>::from_single(influence, curves.points_num()),
smooth_ends,