diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index e4cc552df84..bedcf413bfa 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -418,11 +418,12 @@ static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], cons for (base = vc->scene->base.first; base; base = base->next) { if (BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */ - ED_view3d_project_base(vc->ar, base); - if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) { - - ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT); - base->object->flag = base->flag; + if (ED_view3d_project_base(vc->ar, base) == V3D_PROJ_RET_OK) { + if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) { + + ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT); + base->object->flag = base->flag; + } } if (vc->obact == base->object && (base->object->mode & OB_MODE_POSE)) { do_lasso_select_pose(vc, base->object, mcords, moves, select); @@ -1096,21 +1097,22 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int /* two selection methods, the CTRL select uses max dist of 15 */ if (buffer) { - int a; - for (a = 0; a < hits; a++) { + for (int a = 0; a < hits; a++) { /* index was converted */ if (base->selcol == (buffer[(4 * a) + 3] & ~0xFFFF0000)) { ok = true; + break; } } } else { - int temp, dist = 15; - ED_view3d_project_base(vc->ar, base); - - temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]); - if (temp < dist) - ok = true; + const int dist = 15 * U.pixelsize; + if (ED_view3d_project_base(vc->ar, base) == V3D_PROJ_RET_OK) { + const int delta_px[2] = {base->sx - mval[0], base->sy - mval[1]}; + if (len_manhattan_v2_int(delta_px) < dist) { + ok = true; + } + } } if (ok) { |