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
This commit is contained in:
Antonio Vazquez 2022-02-12 10:50:01 +01:00
parent cf6546863e
commit 824f514f8f
Notes: blender-bot 2023-02-14 08:07:50 +01:00
Referenced by issue #94860, Grease Pencil Grab sculpt tool causing line drift when tablet pen is held down in place
1 changed files with 6 additions and 0 deletions

View File

@ -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")) {