Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-10 18:54:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-21 14:22:24 +0300
commitca4e8b423e81f2a72cd5409d1c2c0450e12afc78 (patch)
treef6bcd8f872cb0e9845ef1efc7973ee62ca7d5713 /source/blender/editors/gpencil/gpencil_brush.c
parentf10d190240a135f4e26058eb49a787f9178ceb71 (diff)
Cleanup: simplify wmEvent tablet data storage and naming
Removing meaningless distinction between NULL pointer and EVT_TABLET_NONE, and initialize pressure and tilt to 1.0 and 0.0 respectively when no tablet is used.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 4948df606ee..690fee61005 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1976,7 +1976,6 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
PointerRNA itemptr;
float mouse[2];
- int tablet = 0;
mouse[0] = event->mval[0] + 1;
mouse[1] = event->mval[1] + 1;
@@ -1988,24 +1987,14 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
RNA_boolean_set(&itemptr, "pen_flip", event->ctrl != false);
RNA_boolean_set(&itemptr, "is_start", gso->first);
- /* handle pressure sensitivity (which is supplied by tablets) */
- if (event->tablet_data) {
- const wmTabletData *wmtab = event->tablet_data;
- float pressure = wmtab->Pressure;
-
- tablet = (wmtab->Active != EVT_TABLET_NONE);
-
- /* special exception here for too high pressure values on first touch in
- * windows for some tablets: clamp the values to be sane
- */
- if (tablet && (pressure >= 0.99f)) {
- pressure = 1.0f;
- }
- RNA_float_set(&itemptr, "pressure", pressure);
- }
- else {
- RNA_float_set(&itemptr, "pressure", 1.0f);
+ /* handle pressure sensitivity (which is supplied by tablets and otherwise 1.0) */
+ float pressure = event->tablet.pressure;
+ /* special exception here for too high pressure values on first touch in
+ * windows for some tablets: clamp the values to be sane */
+ if (pressure >= 0.99f) {
+ pressure = 1.0f;
}
+ RNA_float_set(&itemptr, "pressure", pressure);
if (!gso->is_weight_mode) {
if (event->shift) {