diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-01-11 05:11:07 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-01-11 05:11:36 +0300 |
commit | 74f291cdea9799b31761fc06e4052ae3c470c075 (patch) | |
tree | 7e6133eac1e6bfdf3754977c08b45a9a56abc540 /source/blender/editors/gpencil | |
parent | 961ac8eb85a6ede92c0d1bd062d2bdf264bbaef5 (diff) |
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.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index c5a92c4383d..8c8f29b0f51 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) { |