diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-07 10:46:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-07 10:46:26 +0400 |
commit | d5bcec80c821f6e43975b26c403a810e56f4c2b5 (patch) | |
tree | 42e348f73fc0c3d6f01cbee1eee297fcf80fa1f6 /source/blender/editors/mesh | |
parent | cdc9e553c13741807208fa7e3a1d7a330bdf6b52 (diff) |
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
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 37 |
1 files changed, 19 insertions, 18 deletions
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]; @@ -501,6 +486,22 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) } } } + 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; + } + } + } + } } /* select the vert from the best region */ |