[Bf-blender-cvs] [e245f7c09c6] blender2.8: Edit-Mesh: multi-object un-subdivide
Dalai Felinto
noreply at git.blender.org
Thu May 3 21:57:26 CEST 2018
Commit: e245f7c09c6405f9e7197163d1fc37c7dc5d90f7
Author: Dalai Felinto
Date: Thu May 3 21:56:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe245f7c09c6405f9e7197163d1fc37c7dc5d90f7
Edit-Mesh: multi-object un-subdivide
===================================================================
M source/blender/editors/mesh/editmesh_tools.c
===================================================================
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9b96936c43e..75a3d41ef18 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -290,27 +290,39 @@ void MESH_OT_subdivide_edgering(wmOperatorType *ot)
static int edbm_unsubdivide_exec(bContext *C, wmOperator *op)
{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMOperator bmop;
-
const int iterations = RNA_int_get(op->ptr, "iterations");
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode(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);
- EDBM_op_init(em, &bmop, op,
- "unsubdivide verts=%hv iterations=%i", BM_ELEM_SELECT, iterations);
+ if ((em->bm->totvertsel == 0) &&
+ (em->bm->totedgesel == 0) &&
+ (em->bm->totfacesel == 0))
+ {
+ continue;
+ }
- BMO_op_exec(em->bm, &bmop);
+ BMOperator bmop;
+ EDBM_op_init(em, &bmop, op,
+ "unsubdivide verts=%hv iterations=%i", BM_ELEM_SELECT, iterations);
- if (!EDBM_op_finish(em, &bmop, op, true)) {
- return 0;
- }
+ BMO_op_exec(em->bm, &bmop);
- if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
- EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); /* need to flush vert->face first */
- }
- EDBM_selectmode_flush(em);
+ if (!EDBM_op_finish(em, &bmop, op, true)) {
+ continue;
+ }
- EDBM_update_generic(em, true, true);
+ if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
+ EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); /* need to flush vert->face first */
+ }
+ EDBM_selectmode_flush(em);
+
+ EDBM_update_generic(em, true, true);
+ }
+ MEM_freeN(objects);
return OPERATOR_FINISHED;
}
More information about the Bf-blender-cvs
mailing list