diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-14 14:43:20 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-14 14:47:53 +0300 |
commit | 3ebe389605feee1d6956b1d5f438fed55b235e7e (patch) | |
tree | f0f033e62f6069d07137330ae573e9811ff50cc8 /source/blender/editors/mesh | |
parent | bf73628978f4a0cc8aa9341eba4e459ae2759c1c (diff) |
Multi-Object: MESH_OT_select_mirror
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 0387f3e002e..0f25624a1f9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -3375,28 +3375,44 @@ void MESH_OT_select_loose(wmOperatorType *ot) static int edbm_select_mirror_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); const int axis_flag = RNA_enum_get(op->ptr, "axis"); const bool extend = RNA_boolean_get(op->ptr, "extend"); + Object *obedit_active = CTX_data_edit_object(C); + BMEditMesh *em_active = BKE_editmesh_from_object(obedit_active); + const int select_mode = em_active->bm->selectmode; + int tot_mirr = 0, tot_fail = 0; + + 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 (em->bm->totvert && em->bm->totvertsel) { - int totmirr, totfail; + if (em->bm->totvertsel == 0) { + continue; + } + + int tot_mirr_iter = 0, tot_fail_iter = 0; for (int axis = 0; axis < 3; axis++) { if ((1 << axis) & axis_flag) { - EDBM_select_mirrored(em, axis, extend, &totmirr, &totfail); + EDBM_select_mirrored(em, axis, extend, &tot_mirr_iter, &tot_fail_iter); } } - if (totmirr) { + if (tot_mirr_iter) { EDBM_selectmode_flush(em); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); } - ED_mesh_report_mirror_ex(op, totmirr, totfail, em->bm->selectmode); + tot_fail += tot_fail_iter; + tot_mirr += tot_mirr_iter; } + MEM_freeN(objects); + ED_mesh_report_mirror_ex(op, tot_mirr, tot_fail, select_mode); return OPERATOR_FINISHED; } |