diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-13 18:04:35 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-13 18:04:35 +0300 |
commit | 74a3519a15e27b139bd5e07ea5b7e6e8962d276a (patch) | |
tree | 3b3f7d3236b8bf9869afbe18f83c60e061b9cd4b | |
parent | a273e432ccbb510c5dea26f16df61cfc9c747008 (diff) |
GP: More tweaks in soft eraser
Follow with the changes to get a good feeling using the eraser.
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 16c085f1fdb..dcee4c06132 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1509,15 +1509,17 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, gp_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, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + 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])) || ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, mvalo, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { - if ((gp_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || + if (gp_stroke_inside_circle(mval, mvalo, radius, pc0[0], pc0[1], pc2[0], pc2[1])) { + if ((gp_stroke_eraser_is_occluded(p, pt0, pc0[0], pc0[1]) == false) || + (gp_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || (gp_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { /* Point is affected: */ @@ -1536,10 +1538,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, pt1->strength -= gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength; CLAMP_MIN(pt1->strength, 0.0f); + pt1->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength * 0.10f; + pt2->strength -= gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength * 0.5f; CLAMP_MIN(pt2->strength, 0.0f); - - pt1->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength * 0.10f; pt2->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength * 0.05f; /* if invisible, delete point */ |