GPv3: Dissolve Operator #111079
|
@ -618,9 +618,9 @@ static int grease_pencil_dissolve_exec(bContext *C, wmOperator *op)
|
|||
const Span<bool> curve_selection = points_to_dissolve.as_span().slice(points);
|
||||
/* The unselected curves should not be dissolved.*/
|
||||
if (!curve_selection.contains(true)) {
|
||||
/* Because we are going to invert, fill with `!false` so that it does not get
|
||||
/* Because we are going to invert, fill with true so that it does not get
|
||||
* dissolved.*/
|
||||
points_to_dissolve.as_mutable_span().slice(points).fill(!false);
|
||||
points_to_dissolve.as_mutable_span().slice(points).fill(true);
|
||||
casey-bianco-davis marked this conversation as resolved
Outdated
|
||||
}
|
||||
|
||||
/* `between` is just `unselect` but with the first and last segments not geting
|
||||
|
@ -633,10 +633,10 @@ static int grease_pencil_dissolve_exec(bContext *C, wmOperator *op)
|
|||
IndexRange first_range = deselection_ranges.first().shift(points.first());
|
||||
filedescriptor marked this conversation as resolved
Outdated
Hans Goudey
commented
There's a lot of nesting here-- I'd suggest splitting the operation for a CurvesGeometry to a separate function ot make it clearer what's going on. There's a lot of nesting here-- I'd suggest splitting the operation for a CurvesGeometry to a separate function ot make it clearer what's going on.
|
||||
IndexRange last_range = deselection_ranges.last().shift(points.first());
|
||||
|
||||
/* Because we are going to invert, fill with `!false` so that it does not get
|
||||
/* Because we are going to invert, fill with true so that it does not get
|
||||
* dissolved.*/
|
||||
points_to_dissolve.as_mutable_span().slice(last_range).fill(!false);
|
||||
points_to_dissolve.as_mutable_span().slice(first_range).fill(!false);
|
||||
points_to_dissolve.as_mutable_span().slice(last_range).fill(true);
|
||||
casey-bianco-davis marked this conversation as resolved
Outdated
Hans Goudey
commented
`!false` could just be written as `true`
|
||||
points_to_dissolve.as_mutable_span().slice(first_range).fill(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
It might make sense to define a
MutableSpan<bool> points_to_keep = points_to_dissolve.as_mutable_span();
with the comment above saying that this will be inverted later and thus it is the points to keep.