From 824f514f8f63f0bdc1b2c7bb279a58194897601e Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Sat, 12 Feb 2022 10:50:01 +0100 Subject: Fix T94860: GPencil - Avoid drift in Sculpt when mouse/pen is not moved This fix avoid the drif checking if the previous position is equals to new one, in this case, the pen has not moved and can be canceled. Differential Revision: https://developer.blender.org/D13870 --- source/blender/editors/gpencil/gpencil_sculpt_paint.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 3f17fbf2bc3..976c5988aa6 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1810,6 +1810,12 @@ static void gpencil_sculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA * gso->mval[0] = mouse[0] = (int)(mousef[0]); gso->mval[1] = mouse[1] = (int)(mousef[1]); + /* If the mouse/pen has not moved, no reason to continue. This also avoid a small + * drift due precision acumulation errors. */ + if ((gso->mval[0] == gso->mval_prev[0]) && (gso->mval[1] == gso->mval_prev[1])) { + return; + } + gso->pressure = RNA_float_get(itemptr, "pressure"); if (RNA_boolean_get(itemptr, "pen_flip")) { -- cgit v1.2.3