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:
authorAntonio Vazquez <blendergit@gmail.com>2022-02-12 12:50:01 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-02-12 12:50:39 +0300
commit824f514f8f63f0bdc1b2c7bb279a58194897601e (patch)
tree428447e85925b5e0977204d666816213ee9b8b4c
parentcf6546863ebe06862fbe0c00c34e441f40ae7dc7 (diff)
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
-rw-r--r--source/blender/editors/gpencil/gpencil_sculpt_paint.c6
1 files changed, 6 insertions, 0 deletions
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")) {