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
path: root/source
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-09-10 17:37:31 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-09-10 17:51:06 +0300
commitae200cb2e4d399f7561c4bee86eae70599d0396f (patch)
treee5bb7767c5092ff52fbde5583dd7d088d96f9a8e /source
parent8a65afac1e4c4f4ef25b6c9e01cde3bc64bae48a (diff)
GPencil: Fix unreported Eraser Point problem for one point selected
The Eraser Point mode was erasing too much points. This eraser existed before the new Soft erasers were created and now it was working wrongly. The eraser point mode must remove the points below the eraser cursor at the first contact. For more soft erasers, the new Soft modes can be used.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6748211a1bc..fdab3649b13 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1525,6 +1525,9 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
pt1 = gps->points + i;
pt2 = gps->points + i + 1;
+ float inf1 = 0.0f;
+ float inf2 = 0.0f;
+
/* only process if it hasn't been masked out... */
if ((p->flags & GP_PAINTFLAG_SELECTMASK) && !(gps->points->flag & GP_SPOINT_SELECT)) {
continue;
@@ -1603,22 +1606,36 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
pt2->flag |= GP_SPOINT_TAG;
do_cull = true;
}
+
+ inf1 = 1.0f;
+ inf2 = 1.0f;
}
else {
- pt1->pressure -= gpencil_stroke_eraser_calc_influence(p, mval, radius, pc1) *
- strength;
- pt2->pressure -= gpencil_stroke_eraser_calc_influence(p, mval, radius, pc2) *
- strength * 0.5f;
+ /* Erase point. Only erase if the eraser is on top of the point. */
+ inf1 = gpencil_stroke_eraser_calc_influence(p, mval, radius, pc1);
+ if (inf1 > 0.0f) {
+ pt1->pressure = 0.0f;
+ pt1->flag |= GP_SPOINT_TAG;
+ do_cull = true;
+ }
+ inf2 = gpencil_stroke_eraser_calc_influence(p, mval, radius, pc2);
+ if (inf2 > 0.0f) {
+ pt2->pressure = 0.0f;
+ pt2->flag |= GP_SPOINT_TAG;
+ do_cull = true;
+ }
}
/* 2) Tag any point with overly low influence for removal in the next pass */
- if ((pt1->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) ||
- (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) {
+ if ((inf1 > 0.0f) &&
+ (((pt1->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) ||
+ (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)))) {
pt1->flag |= GP_SPOINT_TAG;
do_cull = true;
}
- if ((pt2->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) ||
- (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) {
+ if ((inf1 > 2.0f) &&
+ (((pt2->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) ||
+ (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)))) {
pt2->flag |= GP_SPOINT_TAG;
do_cull = true;
}