Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-12-16 13:22:23 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-01-11 16:42:30 +0300
commit1f16b5d7940594a09bf0420389e16d4360893d2a (patch)
treede43c79ea580d3b562d47e504a29856c0e23fec8
parent9336edd060200755c2160844cbfae144556de6f8 (diff)
Fix T94137: GPencil: Eraser does not erase first point
The eraser checks the current, previous and next point (and sets pc0, pc1 & pc2 corresponding to that for futher occlusion/brush/clipping checks). For the very first point, it sets pc0 to pc1 [which makes sense, there is no previous point, so we should assume the previous segment is "visible" as soon as the first point is], but does so *before* pc1 is even calculated. This makes following occlusion/brush/clipping checks work with zero values [which leads to no earsing in most cases]. Now *first* calculate pc1, *then* set pc0 to pc1. Maniphest Tasks: T94137 Differential Revision: https://developer.blender.org/D13593
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 644f02a1c42..1a59eba803d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1569,6 +1569,12 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
}
bGPDspoint npt;
+ gpencil_point_to_parent_space(pt1, p->diff_mat, &npt);
+ gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]);
+
+ gpencil_point_to_parent_space(pt2, p->diff_mat, &npt);
+ gpencil_point_to_xy(&p->gsc, gps, &npt, &pc2[0], &pc2[1]);
+
if (pt0) {
gpencil_point_to_parent_space(pt0, p->diff_mat, &npt);
gpencil_point_to_xy(&p->gsc, gps, &npt, &pc0[0], &pc0[1]);
@@ -1578,12 +1584,6 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
copy_v2_v2_int(pc0, pc1);
}
- gpencil_point_to_parent_space(pt1, p->diff_mat, &npt);
- gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]);
-
- gpencil_point_to_parent_space(pt2, p->diff_mat, &npt);
- gpencil_point_to_xy(&p->gsc, gps, &npt, &pc2[0], &pc2[1]);
-
/* Check that point segment of the boundbox of the eraser stroke */
if (((!ELEM(V2D_IS_CLIPPED, pc0[0], pc0[1])) && BLI_rcti_isect_pt(rect, pc0[0], pc0[1])) ||
((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) ||