From d5bcec80c821f6e43975b26c403a810e56f4c2b5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Sep 2012 06:46:26 +0000 Subject: minor fix for previous commit. ripping a vert-edge connected to a face would always choose the face even if the mouse is closer to the edge, now check both edges and faces when ripping from a non wire vertex --- source/blender/editors/mesh/editmesh_rip.c | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 03ee8320567..d2806233fa9 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -464,25 +464,10 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) dist = FLT_MAX; - if (is_wire) { - for (i = 0; i < vout_len; i++) { - BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) { - if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { - float e_mid_co[3]; - mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co); + for (i = 0; i < vout_len; i++) { - d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval); - - if (d < dist) { - dist = d; - vi_best = i; - } - } - } - } - } - else { - for (i = 0; i < vout_len; i++) { + if (BM_vert_is_wire(vout[i]) == FALSE) { + /* find the best face corner */ BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) { if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) { float l_mid_co[3]; @@ -494,6 +479,22 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval); + if (d < dist) { + dist = d; + vi_best = i; + } + } + } + } + else { + /* a wire vert, find the best edge */ + BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) { + if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { + float e_mid_co[3]; + mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co); + + d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval); + if (d < dist) { dist = d; vi_best = i; -- cgit v1.2.3