[Bf-blender-cvs] [74f291c] master: Fix T47101 - Grease Pencil eraser doesn't work when activated using D+RMB when using a tablet

Joshua Leung noreply at git.blender.org
Mon Jan 11 03:13:04 CET 2016


Commit: 74f291cdea9799b31761fc06e4052ae3c470c075
Author: Joshua Leung
Date:   Mon Jan 11 15:11:07 2016 +1300
Branches: master
https://developer.blender.org/rB74f291cdea9799b31761fc06e4052ae3c470c075

Fix T47101 - Grease Pencil eraser doesn't work when activated using D+RMB when using a tablet

When using D+RMB using a tablet (e.g. holding down the side button of the stylus
while hovering it over the surface of the tablet) to erase, the tablet would
report zero-pressure. This causes problems when using the new pressure-sensitive
Grease Pencil eraser, causing it to have no effect.

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

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 c5a92c4..8c8f29b 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1679,9 +1679,23 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event)
 		
 		tablet = (wmtab->Active != EVT_TABLET_NONE);
 		p->pressure = wmtab->Pressure;
+		
+		/* Hack for pressure sensitive eraser on D+RMB when using a tablet:
+		 *  The pen has to float over the tablet surface, resulting in
+		 *  zero pressure (T47101). Ignore pressure values if floating
+		 *  (i.e. "effectively zero" pressure), and only when the "active"
+		 *  end is the stylus (i.e. the default when not eraser)
+		 */
+		if (p->paintmode == GP_PAINTMODE_ERASER) {
+			if ((wmtab->Active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
+				p->pressure = 1.0f;
+			}
+		}
 	}
-	else
+	else {
+		/* No tablet data -> No pressure info is available */
 		p->pressure = 1.0f;
+	}
 	
 	/* special exception for start of strokes (i.e. maybe for just a dot) */
 	if (p->flags & GP_PAINTFLAG_FIRSTRUN) {




More information about the Bf-blender-cvs mailing list