BMesh: fix edge-rotation selection state bug

Failed edge rotation could leave unselected edge between selected faces,
also report warning when edges fail to be rotated.
This commit is contained in:
Campbell Barton 2016-11-15 03:26:19 +11:00
parent 6a2b95e1ca
commit d3919c22b0
1 changed files with 12 additions and 0 deletions

View File

@ -1561,6 +1561,18 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
/* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, true);
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
const int tot_rotate = BMO_slot_buffer_count(bmop.slots_out, "edges.out");
const int tot_failed = tot - tot_rotate;
if (tot_failed != 0) {
/* If some edges fail to rotate, we need to re-select them,
* otherwise we can end up with invalid selection
* (unselected edge between 2 selected faces). */
BM_mesh_elem_hflag_enable_test(em->bm, BM_EDGE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);
BKE_reportf(op->reports, RPT_WARNING, "Unable to rotate %d edge(s)", tot_failed);
}
EDBM_selectmode_flush(em);
if (!EDBM_op_finish(em, &bmop, op, true)) {