Fix: GPv3: Stroke Eraser does not work with one-point strokes.
The stroke mode of the eraser only tests distance with segments of the strokes, so it does not take into account strokes that only have one point, and thus no segment. This patch fixes the issue by testing if the point is inside the eraser in the case of a one-point stroke. Pull Request: https://projects.blender.org/blender/blender/pulls/111387
This commit is contained in:
committed by
Amélie Fondevilla
parent
acd6dd96b7
commit
6cfda322a6
@@ -584,6 +584,13 @@ struct EraseOperationExecutor {
|
||||
src.curves_range(), GrainSize(256), memory, [&](const int64_t src_curve) {
|
||||
const IndexRange src_curve_points = src_points_by_curve[src_curve];
|
||||
|
||||
/* One-point stroke : remove the stroke if the point lies inside of the eraser. */
|
||||
if (src_curve_points.size() == 1) {
|
||||
const float2 &point_pos = screen_space_positions[src_curve_points.first()];
|
||||
const float dist_to_eraser = math::distance(point_pos, this->mouse_position);
|
||||
return !(dist_to_eraser < eraser_radius);
|
||||
}
|
||||
|
||||
/* If any segment of the stroke is closer to the eraser than its radius, then remove
|
||||
* the stroke. */
|
||||
for (const int64_t src_point : src_curve_points.drop_back(1)) {
|
||||
|
||||
Reference in New Issue
Block a user