diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-09 14:39:05 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-09 14:41:33 +0300 |
commit | df49155cfb7f1e33650d8fed34b12fde639df866 (patch) | |
tree | c8de697c1503d3d36cd4d21b4342946106ab8010 /source/blender/editors/mesh | |
parent | c0667c2f35a1be4c56fac21d48b3a19bd460cb8d (diff) |
Multi-object edit: MESH_OT_loop_multi_select by Oleg
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3245
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index a4ab2e3f12e..58ad7130a00 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1552,50 +1552,60 @@ static void walker_select(BMEditMesh *em, int walkercode, void *start, const boo static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMEdge *eed; - BMEdge **edarray; - int edindex; const bool is_ring = RNA_boolean_get(op->ptr, "ring"); + 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); - BMIter iter; - int totedgesel = 0; + if (em->bm->totedgesel == 0) { + continue; + } + + BMEdge *eed; + BMEdge **edarray; + int edindex; + BMIter iter; + int totedgesel = 0; - BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { - totedgesel++; + BM_ITER_MESH(eed, &iter, em->bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { + totedgesel++; + } } - } - edarray = MEM_mallocN(sizeof(BMEdge *) * totedgesel, "edge array"); - edindex = 0; + edarray = MEM_mallocN(sizeof(BMEdge *) * totedgesel, "edge array"); + edindex = 0; - BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { - edarray[edindex] = eed; - edindex++; + BM_ITER_MESH(eed, &iter, em->bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { + edarray[edindex] = eed; + edindex++; + } } - } - if (is_ring) { - for (edindex = 0; edindex < totedgesel; edindex += 1) { - eed = edarray[edindex]; - walker_select(em, BMW_EDGERING, eed, true); + if (is_ring) { + for (edindex = 0; edindex < totedgesel; edindex += 1) { + eed = edarray[edindex]; + walker_select(em, BMW_EDGERING, eed, true); + } + EDBM_selectmode_flush(em); } - EDBM_selectmode_flush(em); - } - else { - for (edindex = 0; edindex < totedgesel; edindex += 1) { - eed = edarray[edindex]; - walker_select(em, BMW_EDGELOOP, eed, true); + else { + for (edindex = 0; edindex < totedgesel; edindex += 1) { + eed = edarray[edindex]; + walker_select(em, BMW_EDGELOOP, eed, true); + } + EDBM_selectmode_flush(em); } - EDBM_selectmode_flush(em); - } - MEM_freeN(edarray); -// if (EM_texFaceCheck()) + MEM_freeN(edarray); + // if (EM_texFaceCheck()) - WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |