diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-21 23:18:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-21 23:26:33 +0300 |
commit | 207b549d400c005195b045aee4e646f9c04f228c (patch) | |
tree | d81e7d42be79e1b8f6fbb07fbeffb55a5656c720 /source | |
parent | 5ddcfd2456469b138c9fd34f2ec6665afb17e504 (diff) |
Edit Mesh: multi-object edge split support
D3161 by @JacquesLucke
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 88a4e1d148a..131fb343d0d 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1530,23 +1530,32 @@ void MESH_OT_face_make_planar(wmOperatorType *ot) static int edbm_edge_split_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); + ViewLayer *view_layer = CTX_data_view_layer(C); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + BMEditMesh *em = BKE_editmesh_from_object(obedit); + if (em->bm->totedgesel == 0) { + continue; + } - if (!EDBM_op_call_and_selectf( - em, op, - "edges.out", false, - "split_edges edges=%he", - BM_ELEM_SELECT)) - { - return OPERATOR_CANCELLED; - } + if (!EDBM_op_call_and_selectf( + em, op, + "edges.out", false, + "split_edges edges=%he", + BM_ELEM_SELECT)) + { + continue; + } - if (em->selectmode == SCE_SELECT_FACE) { - EDBM_select_flush(em); - } + if (em->selectmode == SCE_SELECT_FACE) { + EDBM_select_flush(em); + } - EDBM_update_generic(em, true, true); + EDBM_update_generic(em, true, true); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |