diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-13 17:06:31 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-13 17:06:45 +0300 |
commit | 379225d2bcd11c93358e4ecbee216318e107b411 (patch) | |
tree | ec4cb4811d7722128b7164090ea6cfa1ecbdca05 /source/blender | |
parent | 1e3d6ae09b89cb6ab6c357d506af7d0c635aa50e (diff) |
GP: More changes to improve soft eraser
Small changes to improve "feeling" of the soft eraser.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d8a009e90f0..f65ae8806b4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1364,6 +1364,15 @@ static void gp_stroke_soft_refine(bGPDstroke *gps, const float cull_thresh) pt->flag |= GP_SPOINT_TEMP_TAG; } } + else { + /* reduce opacity of extreme points */ + if ((pt_before->flag & GP_SPOINT_TAG) == 0) { + pt_before->strength *= 0.5f; + } + if ((pt_after->flag & GP_SPOINT_TAG) == 0) { + pt_after->strength *= 0.5f; + } + } } } @@ -1485,6 +1494,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, gp_point_to_parent_space(pt0, diff_mat, &npt); gp_point_to_xy(&p->gsc, gps, &npt, &pc0[0], &pc0[1]); } + else { + /* avoid null values */ + copy_v2_v2_int(pc0, pc1); + } gp_point_to_parent_space(pt1, diff_mat, &npt); gp_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); @@ -1505,11 +1518,12 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, (gp_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { /* Point is affected: */ - /* 1a) Adjust thickness + /* Adjust thickness * - Influence of eraser falls off with distance from the middle of the eraser * - Second point gets less influence, as it might get hit again in the next segment */ - /* 1b) Adjust strength if the eraser is soft */ + + /* Adjust strength if the eraser is soft */ if (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_SOFT) { if (pt0) { pt0->strength -= gp_stroke_eraser_calc_influence(p, mval, radius, pc0) * strength * 0.5f; |