[Bf-blender-cvs] [7f419a56154] greasepencil-object: Enable Hard Eraser with SHIFT

Antonio Vazquez noreply at git.blender.org
Thu Dec 14 18:16:19 CET 2017


Commit: 7f419a56154d28c3eef4695d146c86ff426eed49
Author: Antonio Vazquez
Date:   Thu Dec 14 18:16:09 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7f419a56154d28c3eef4695d146c86ff426eed49

Enable Hard Eraser with SHIFT

While you are drawing, if press Shift key, the eraser delete points with one contact only and does not depends of pressure.

This is very useful for fast remove.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 4c0b8df2407..dddf14234ce 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -113,6 +113,7 @@ typedef enum eGPencil_PaintFlags {
 	GP_PAINTFLAG_STROKEADDED    = (1 << 1),
 	GP_PAINTFLAG_V3D_ERASER_DEPTH = (1 << 2),
 	GP_PAINTFLAG_SELECTMASK     = (1 << 3),
+	GP_PAINTFLAG_HARD_ERASER    = (1 << 4),
 } eGPencil_PaintFlags;
 
 
@@ -1206,11 +1207,11 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 						pt2->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength / 2.0f;
 						
 						/* 2) Tag any point with overly low influence for removal in the next pass */
-						if (pt1->pressure < cull_thresh) {
+						if ((pt1->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER)) {
 							pt1->flag |= GP_SPOINT_TAG;
 							do_cull = true;
 						}
-						if (pt2->pressure < cull_thresh) {
+						if ((pt2->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER)) {
 							pt2->flag |= GP_SPOINT_TAG;
 							do_cull = true;
 						}
@@ -2201,6 +2202,12 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event)
 			if ((wmtab->Active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
 				p->pressure = 1.0f;
 			}
+			if (event->shift > 0) {
+				p->flags |= GP_PAINTFLAG_HARD_ERASER;
+			}
+			else {
+				p->flags &= ~GP_PAINTFLAG_HARD_ERASER;
+			}
 		}
 	}
 	else {



More information about the Bf-blender-cvs mailing list