[Bf-blender-cvs] [824f514f8f6] master: Fix T94860: GPencil - Avoid drift in Sculpt when mouse/pen is not moved

Antonio Vazquez noreply at git.blender.org
Sat Feb 12 10:50:54 CET 2022


Commit: 824f514f8f63f0bdc1b2c7bb279a58194897601e
Author: Antonio Vazquez
Date:   Sat Feb 12 10:50:01 2022 +0100
Branches: master
https://developer.blender.org/rB824f514f8f63f0bdc1b2c7bb279a58194897601e

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

===================================================================

M	source/blender/editors/gpencil/gpencil_sculpt_paint.c

===================================================================

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



More information about the Bf-blender-cvs mailing list