print error if rip does nothing (rather then grabbing the unripped verts as it did before)

This commit is contained in:
Campbell Barton
2012-03-28 08:00:58 +00:00
parent f342c7de45
commit 8aa42f309c
2 changed files with 12 additions and 4 deletions

View File

@@ -512,7 +512,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < tot_found; i++) { for (i = 0; i < tot_found; i++) {
BMEdge *e = (BMEdge *)weight_elems[i].ele; BMEdge *e = (BMEdge *)weight_elems[i].ele;
/* check twice because cumulative effect could disolve over angle limit */ /* check twice because cumulative effect could dissolve over angle limit */
if (BM_edge_face_angle(e) < angle_limit) { if (BM_edge_face_angle(e) < angle_limit) {
BMFace *nf = BM_faces_join_pair(bm, e->l->f, BMFace *nf = BM_faces_join_pair(bm, e->l->f,
e->l->radial_next->f, e->l->radial_next->f,
@@ -547,7 +547,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < tot_found; i++) { for (i = 0; i < tot_found; i++) {
BMVert *v = (BMVert *)weight_elems[i].ele; BMVert *v = (BMVert *)weight_elems[i].ele;
/* check twice because cumulative effect could disolve over angle limit */ /* check twice because cumulative effect could dissolve over angle limit */
if (BM_vert_edge_angle(v) < angle_limit) { if (BM_vert_edge_angle(v) < angle_limit) {
BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */ BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
} }

View File

@@ -2150,6 +2150,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]}; float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
float dist = FLT_MAX; float dist = FLT_MAX;
float d; float d;
const int totedge_orig = bm->totedge;
/* note on selection: /* note on selection:
* When calling edge split we operate on tagged edges rather then selected * When calling edge split we operate on tagged edges rather then selected
@@ -2195,7 +2196,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (v->e) { if (v->e) {
/* find closest edge to mouse cursor */ /* find closest edge to mouse cursor */
BM_ITER(e, &iter, bm, BM_EDGES_OF_VERT, v) { BM_ITER(e, &iter, bm, BM_EDGES_OF_VERT, v) {
if (e->l && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN) && BM_edge_face_count(e) == 2) {
d = mesh_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval); d = mesh_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval);
if (d < dist) { if (d < dist) {
dist = d; dist = d;
@@ -2207,7 +2208,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
} }
if (!e2) { if (!e2) {
BKE_report(op->reports, RPT_ERROR, "Selected vertex has no faces attached"); BKE_report(op->reports, RPT_ERROR, "Selected vertex has no edge/face pairs attached");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
@@ -2266,6 +2267,13 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
BMO_op_exec(bm, &bmop); BMO_op_exec(bm, &bmop);
if (totedge_orig == bm->totedge) {
EDBM_op_finish(em, &bmop, op, TRUE);
BKE_report(op->reports, RPT_ERROR, "No edges could be ripped");
return OPERATOR_CANCELLED;
}
BMO_ITER(e, &siter, bm, &bmop, "edgeout", BM_EDGE) { BMO_ITER(e, &siter, bm, &bmop, "edgeout", BM_EDGE) {
float cent[3] = {0, 0, 0}, mid[3]; float cent[3] = {0, 0, 0}, mid[3];