Skip to content

Commit aad8863

Browse files
casey-1103Falk David
authored andcommitted
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
1 parent 6bbeac9 commit aad8863

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

source/blender/editors/sculpt_paint/grease_pencil_sculpt_smooth.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ void SmoothOperation::on_stroke_extended(const bContext &C, const InputSample &e
147147

148148
bool changed = false;
149149
if (sculpt_mode_flag & GP_SCULPT_FLAGMODE_APPLY_POSITION) {
150-
geometry::smooth_curve_positions(
151-
curves, curves.curves_range(), iterations, influences, false, false);
150+
geometry::smooth_curve_positions(curves,
151+
curves.curves_range(),
152+
selection_varray,
153+
iterations,
154+
influences,
155+
false,
156+
false);
152157

153158
params.drawing.tag_positions_changed();
154159
changed = true;

source/blender/geometry/GEO_smooth_curves.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ void smooth_curve_attribute(const IndexMask &curves_to_smooth,
6060
*/
6161
void smooth_curve_positions(bke::CurvesGeometry &curves,
6262
const IndexMask &curves_to_smooth,
63+
const VArray<bool> &point_selection,
6364
int iterations,
6465
const VArray<float> &influence_by_point,
6566
bool smooth_ends,
6667
bool keep_shape);
6768
void smooth_curve_positions(bke::CurvesGeometry &curves,
6869
const IndexMask &curves_to_smooth,
70+
const VArray<bool> &point_selection,
6971
int iterations,
7072
float influence,
7173
bool smooth_ends,

source/blender/geometry/intern/smooth_curves.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ void smooth_curve_attribute(const IndexMask &curves_to_smooth,
245245

246246
void smooth_curve_positions(bke::CurvesGeometry &curves,
247247
const IndexMask &curves_to_smooth,
248+
const VArray<bool> &point_selection,
248249
const int iterations,
249250
const VArray<float> &influence_by_point,
250251
const bool smooth_ends,
@@ -253,8 +254,6 @@ void smooth_curve_positions(bke::CurvesGeometry &curves,
253254
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
254255
const OffsetIndices points_by_curve = curves.points_by_curve();
255256
const VArray<bool> cyclic = curves.cyclic();
256-
const VArray<bool> point_selection = *curves.attributes().lookup_or_default<bool>(
257-
".selection", bke::AttrDomain::Point, true);
258257
if (!curves.has_curve_with_type(CURVE_TYPE_BEZIER)) {
259258
bke::GSpanAttributeWriter positions = attributes.lookup_for_write_span("position");
260259
smooth_curve_attribute(curves_to_smooth,
@@ -361,13 +360,15 @@ void smooth_curve_positions(bke::CurvesGeometry &curves,
361360

362361
void smooth_curve_positions(bke::CurvesGeometry &curves,
363362
const IndexMask &curves_to_smooth,
363+
const VArray<bool> &point_selection,
364364
const int iterations,
365365
const float influence,
366366
const bool smooth_ends,
367367
const bool keep_shape)
368368
{
369369
smooth_curve_positions(curves,
370370
curves_to_smooth,
371+
point_selection,
371372
iterations,
372373
VArray<float>::from_single(influence, curves.points_num()),
373374
smooth_ends,

0 commit comments

Comments
 (0)