From b85f779355b784675d2e948c1b92a32794554dc6 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 1 Oct 2010 08:12:37 +0000 Subject: [PATCH] Add distance check in lasso generation to get a smoother lasso. Hopefully this helps with lasso select troubles [#21179]. --- source/blender/editors/mesh/editmesh_mods.c | 2 +- .../windowmanager/intern/wm_operators.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 5a33d60b00e..f8018c686f5 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -284,7 +284,7 @@ int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, s /* yah, opengl doesn't do concave... tsk! */ ED_region_pixelspace(vc->ar); - draw_triangulated(mcords, tot); + draw_triangulated(mcords, tot); glBegin(GL_LINE_LOOP); /* for zero sized masks, lines */ for(a=0; acustomdata; - lasso += 2 * gesture->points; - lasso[0] = event->x - sx; - lasso[1] = event->y - sy; - gesture->points++; + + lasso += (2 * gesture->points - 2); + x = (event->x - sx - lasso[0]); + y = (event->y - sy - lasso[1]); + + /* make a simple distance check to get a smoother lasso + add only when at least 2 pixels between this and previous location */ + if((x*x+y*y) > 4) { + lasso += 2; + lasso[0] = event->x - sx; + lasso[1] = event->y - sy; + gesture->points++; + } } break;