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

This commit is contained in:
Campbell Barton 2012-09-07 06:46:26 +00:00
parent cdc9e553c1
commit d5bcec80c8

@ -464,25 +464,10 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
dist = FLT_MAX; dist = FLT_MAX;
if (is_wire) { for (i = 0; i < vout_len; i++) {
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);
d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval); if (BM_vert_is_wire(vout[i]) == FALSE) {
/* find the best face corner */
if (d < dist) {
dist = d;
vi_best = i;
}
}
}
}
}
else {
for (i = 0; i < vout_len; i++) {
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) { if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
float l_mid_co[3]; 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); 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) { if (d < dist) {
dist = d; dist = d;
vi_best = i; vi_best = i;