bmesh split tool (Ykey), was only splitting off faces, unlike EditMesh which could also split edges.
make this behavior optional and default to off (match EditMesh).
This commit is contained in:
@@ -738,6 +738,7 @@ static BMOpDefine def_splitop = {
|
||||
{BMO_OP_SLOT_MAPPING, "boundarymap"},
|
||||
{BMO_OP_SLOT_MAPPING, "isovertmap"},
|
||||
{BMO_OP_SLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
|
||||
{BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. dont duplicate loose verts/edges */
|
||||
{0} /* null-terminating sentine */},
|
||||
splitop_exec,
|
||||
0
|
||||
|
||||
@@ -379,11 +379,7 @@ void splitop_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator *splitop = op;
|
||||
BMOperator dupeop;
|
||||
BMOperator delop;
|
||||
BMVert *v;
|
||||
BMEdge *e;
|
||||
BMFace *f;
|
||||
BMIter iter, iter2;
|
||||
int found;
|
||||
const short use_only_faces = BMO_slot_bool_get(op, "use_only_faces");
|
||||
|
||||
/* initialize our sub-operator */
|
||||
BMO_op_init(bm, &dupeop, "dupe");
|
||||
@@ -394,30 +390,38 @@ void splitop_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, splitop, "geom", SPLIT_INPUT, BM_ALL);
|
||||
|
||||
/* make sure to remove edges and verts we don't need */
|
||||
for (e = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); e; e = BM_iter_step(&iter)) {
|
||||
found = 0;
|
||||
f = BM_iter_new(&iter2, bm, BM_FACES_OF_EDGE, e);
|
||||
for ( ; f; f = BM_iter_step(&iter2)) {
|
||||
if (!BMO_elem_flag_test(bm, f, SPLIT_INPUT)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) BMO_elem_flag_enable(bm, e, SPLIT_INPUT);
|
||||
}
|
||||
|
||||
for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
|
||||
found = 0;
|
||||
e = BM_iter_new(&iter2, bm, BM_EDGES_OF_VERT, v);
|
||||
for ( ; e; e = BM_iter_step(&iter2)) {
|
||||
if (!BMO_elem_flag_test(bm, e, SPLIT_INPUT)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) BMO_elem_flag_enable(bm, v, SPLIT_INPUT);
|
||||
if (use_only_faces) {
|
||||
BMVert *v;
|
||||
BMEdge *e;
|
||||
BMFace *f;
|
||||
BMIter iter, iter2;
|
||||
int found;
|
||||
|
||||
/* make sure to remove edges and verts we don't need */
|
||||
for (e = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); e; e = BM_iter_step(&iter)) {
|
||||
found = 0;
|
||||
f = BM_iter_new(&iter2, bm, BM_FACES_OF_EDGE, e);
|
||||
for ( ; f; f = BM_iter_step(&iter2)) {
|
||||
if (!BMO_elem_flag_test(bm, f, SPLIT_INPUT)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) BMO_elem_flag_enable(bm, e, SPLIT_INPUT);
|
||||
}
|
||||
|
||||
for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
|
||||
found = 0;
|
||||
e = BM_iter_new(&iter2, bm, BM_EDGES_OF_VERT, v);
|
||||
for ( ; e; e = BM_iter_step(&iter2)) {
|
||||
if (!BMO_elem_flag_test(bm, e, SPLIT_INPUT)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) BMO_elem_flag_enable(bm, v, SPLIT_INPUT);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* connect outputs of dupe to delete, exluding keep geometr */
|
||||
|
||||
@@ -3627,7 +3627,7 @@ static int split_mesh_exec(bContext *C, wmOperator *op)
|
||||
BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh;
|
||||
BMOperator bmop;
|
||||
|
||||
EDBM_InitOpf(em, &bmop, op, "split geom=%hvef", BM_ELEM_SELECT);
|
||||
EDBM_InitOpf(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
BM_mesh_elem_flag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL, TRUE);
|
||||
|
||||
Reference in New Issue
Block a user