Edit Mesh: multi-object support for 'Vertices Only' extrusion (Alt+E)
authorThomas Beck <software@plasmasolutions.de>
Wed, 18 Apr 2018 22:03:51 +0000 (00:03 +0200)
committerThomas Beck <software@plasmasolutions.de>
Wed, 18 Apr 2018 22:03:51 +0000 (00:03 +0200)
source/blender/editors/mesh/editmesh_extrude.c

index 6541f56de56f967f2be4997e0d62d7d7f881e60a..bedb3b614d1bcd61c07a6bdf33fd68912ee5e762 100644 (file)
@@ -446,12 +446,24 @@ void MESH_OT_extrude_region(wmOperatorType *ot)
 
 static int edbm_extrude_verts_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);
+       uint objects_len = 0;
+       Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
 
-       edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT);
 
-       EDBM_update_generic(em, true, true);
+       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->totvertsel == 0) {
+                       continue;
+               }
+
+               edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT);
+
+               EDBM_update_generic(em, true, true);
+       }
+       MEM_freeN(objects);
 
        return OPERATOR_FINISHED;
 }