diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-07 12:26:00 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-07 12:26:07 +0300 |
commit | 2349b9777a551ac062f7ef9e93a64cfc228d0071 (patch) | |
tree | 1d4470cc8515e0dc1fa9675b1f586c41d1b85b62 | |
parent | 83345b463edba7db15a30c33d0f44a55c9d173a1 (diff) |
Multi-object edge collapse
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index b54f0d5d8e8..90bd6bed47e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -625,13 +625,24 @@ void MESH_OT_delete_loose(wmOperatorType *ot) static int edbm_collapse_edge_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_unique_data(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 (!EDBM_op_callf(em, op, "collapse edges=%he uvs=%b", BM_ELEM_SELECT, true)) - return OPERATOR_CANCELLED; + if (em->bm->totedgesel == 0) { + continue; + } - EDBM_update_generic(em, true, true); + if (!EDBM_op_callf(em, op, "collapse edges=%he uvs=%b", BM_ELEM_SELECT, true)) { + continue; + } + + EDBM_update_generic(em, true, true); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |