diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 11:12:17 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 11:13:44 +0300 |
commit | 9fc0c0c3deea9c560f3a67e55c722019fd384eab (patch) | |
tree | 9c6aaa15b6620f98faef14de15198cfe554d2624 /source | |
parent | 853e55b0436fea35ad18746a4e972e845caa4c62 (diff) |
Edit Mesh: multi-object faces_shade_flat support by Pablo Dobarro
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3219
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index f07f1a2272d..8f59e64600f 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2294,12 +2294,21 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(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); - mesh_set_smooth_faces(em, 0); + if (em->bm->totfacesel == 0) { + continue; + } - EDBM_update_generic(em, false, false); + mesh_set_smooth_faces(em, 0); + EDBM_update_generic(em, false, false); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |