diff options
author | Pablo Dobarro <pablodp606> | 2020-03-01 21:31:28 +0300 |
---|---|---|
committer | Pablo Dobarro <pablo@pop-os.localdomain> | 2020-03-01 21:32:01 +0300 |
commit | a489d77c5be4e2f1e7e1fac3a3271bb7bca293af (patch) | |
tree | 45eb5d291bb399c53c7207a3f29abb57382cfdd3 /source | |
parent | c04c5ac4f6ea59173c86d0b99be84d28571a4a00 (diff) |
Fix T74074: Strokes with timer events don't get pressure values
When processing a timer event WM_event_tablet_data returns 0 instead of
the last valid pressure value from the tablet. This always stores the
last pressure value and uses it in case a timer event is being
processed.
Reviewed By: brecht
Maniphest Tasks: T74074
Differential Revision: https://developer.blender.org/D6950
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 4abeb937758..2fb89a49016 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -118,6 +118,8 @@ typedef struct PaintStroke { float last_pressure; int stroke_mode; + float last_tablet_event_pressure; + float zoom_2d; int pen_flip; @@ -1355,6 +1357,15 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) 1.0f : WM_event_tablet_data(event, &stroke->pen_flip, NULL)); + /* When processing a timer event the pressure from the event is 0, so use the last valid + * pressure. */ + if (event->type == TIMER) { + pressure = stroke->last_tablet_event_pressure; + } + else { + stroke->last_tablet_event_pressure = pressure; + } + paint_stroke_add_sample(p, stroke, event->mval[0], event->mval[1], pressure); paint_stroke_sample_average(stroke, &sample_average); |