Cleanup: only handle selection when BM_mesh_esubdivide uses selection

While all callers currently operate on the selection, the function
supports other header-flags, so check the selection is being used
before updating & flushing the selection.
This commit is contained in:
Campbell Barton
2025-08-02 04:41:40 +00:00
parent 619d370703
commit d72e7f9d6e

View File

@@ -1354,24 +1354,34 @@ void BM_mesh_esubdivide(BMesh *bm,
BMO_op_exec(bm, &op);
switch (seltype) {
case SUBDIV_SELECT_NONE:
case SUBDIV_SELECT_NONE: {
break;
case SUBDIV_SELECT_ORIG:
}
case SUBDIV_SELECT_ORIG: {
/* set the newly created data to be selected */
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
BM_mesh_select_flush(bm);
if (edge_hflag & BM_ELEM_SELECT) {
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true);
BM_mesh_select_flush(bm);
}
break;
case SUBDIV_SELECT_INNER:
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT, BM_ELEM_SELECT, true);
}
case SUBDIV_SELECT_INNER: {
if (edge_hflag & BM_ELEM_SELECT) {
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT, BM_ELEM_SELECT, true);
}
break;
case SUBDIV_SELECT_LOOPCUT:
/* deselect input */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_EDGE, BM_ELEM_SELECT, true);
}
case SUBDIV_SELECT_LOOPCUT: {
if (edge_hflag & BM_ELEM_SELECT) {
/* deselect input */
BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_SELECT, false);
BMO_slot_buffer_hflag_enable(
bm, op.slots_out, "geom_inner.out", BM_EDGE, BM_ELEM_SELECT, true);
}
break;
}
}
BMO_op_finish(bm, &op);