Fix for typo comparing double events

Also remove doubles when filling the final array.
This commit is contained in:
Campbell Barton 2016-04-30 16:18:29 +10:00
parent ac163447f8
commit 6ab22064c2
Notes: blender-bot 2023-02-14 09:48:23 +01:00
Referenced by issue #48204, Generic Tablet on Linux - Erratic strokes with pressure sensitivity enabled
1 changed files with 7 additions and 1 deletions

View File

@ -876,6 +876,12 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
if (coords_indices.radius != -1) {
co[coords_indices.radius] = selem->pressure;
}
/* remove doubles */
if ((co != coords) && UNLIKELY(memcmp(co, co - dims, sizeof(float) * dims) == 0)) {
co -= dims;
stroke_len--;
}
}
}
@ -1173,7 +1179,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
if (cdd->state == CURVE_DRAW_PAINTING) {
const float mval_fl[2] = {UNPACK2(event->mval)};
if (len_squared_v2v2(mval_fl, cdd->prev.location_world) > SQUARE(STROKE_SAMPLE_DIST_MIN_PX)) {
if (len_squared_v2v2(mval_fl, cdd->prev.mouse) > SQUARE(STROKE_SAMPLE_DIST_MIN_PX)) {
curve_draw_event_add(op, event);
}
}