diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-30 23:08:05 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-30 23:38:06 +0300 |
commit | 61f0608b4ab60bc52a4d9bf339285416ee79ca03 (patch) | |
tree | b775622bfbd805703fb74b78c110bd0f2d775476 | |
parent | b93a76fe7554001ef2f1780296aa85aa88da306e (diff) |
Edit Mesh: multi-object mark seams
Note that I'm using bm->totedgesel instead of bm->totfacesel to skip objects.
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fc524cbffb5..99c83935552 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -914,37 +914,51 @@ void MESH_OT_edge_face_add(wmOperatorType *ot) static int edbm_mark_seam_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Object *obedit = CTX_data_edit_object(C); - Mesh *me = ((Mesh *)obedit->data); - BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMesh *bm = em->bm; + ViewLayer *view_layer = CTX_data_view_layer(C); BMEdge *eed; BMIter iter; const bool clear = RNA_boolean_get(op->ptr, "clear"); - /* auto-enable seams drawing */ - if (clear == 0) { - me->drawflag |= ME_DRAWSEAMS; - } + 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); + BMesh *bm = em->bm; - if (clear) { - BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { - if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) - continue; + if (bm->totedgesel == 0) { + continue; + } + + Mesh *me = ((Mesh *)obedit->data); - BM_elem_flag_disable(eed, BM_ELEM_SEAM); + /* auto-enable seams drawing */ + if (clear == 0) { + me->drawflag |= ME_DRAWSEAMS; } - } - else { - BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { - if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) - continue; - BM_elem_flag_enable(eed, BM_ELEM_SEAM); + + if (clear) { + BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { + if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + continue; + } + + BM_elem_flag_disable(eed, BM_ELEM_SEAM); + } + } + else { + BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { + if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + continue; + } + BM_elem_flag_enable(eed, BM_ELEM_SEAM); + } } - } - ED_uvedit_live_unwrap(scene, obedit); - EDBM_update_generic(em, true, false); + ED_uvedit_live_unwrap(scene, obedit); + EDBM_update_generic(em, true, false); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |