From 8234f24838ec87a82891e56b1bcc92529d38bbf3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Feb 2018 21:00:26 +1100 Subject: Object Mode: Loop over objects for ED_editors_exit We could loop over active objects but this ensures don't miss any and avoids complicated context checks. --- source/blender/editors/util/ed_util.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/util/ed_util.c') diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 02443af0bfc..a5a26cf4d57 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" @@ -109,7 +110,6 @@ void ED_editors_init(bContext *C) void ED_editors_exit(bContext *C) { Main *bmain = CTX_data_main(C); - Scene *sce; if (!bmain) return; @@ -117,23 +117,20 @@ void ED_editors_exit(bContext *C) /* frees all editmode undos */ undo_editmode_clear(); ED_undo_paint_free(); - - for (sce = bmain->scene.first; sce; sce = sce->id.next) { - if (sce->obedit) { - Object *ob = sce->obedit; - - if (ob) { - if (ob->type == OB_MESH) { - Mesh *me = ob->data; - if (me->edit_btmesh) { - EDBM_mesh_free(me->edit_btmesh); - MEM_freeN(me->edit_btmesh); - me->edit_btmesh = NULL; - } - } - else if (ob->type == OB_ARMATURE) { - ED_armature_edit_free(ob->data); - } + + for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { + if (ob->type == OB_MESH) { + Mesh *me = ob->data; + if (me->edit_btmesh) { + EDBM_mesh_free(me->edit_btmesh); + MEM_freeN(me->edit_btmesh); + me->edit_btmesh = NULL; + } + } + else if (ob->type == OB_ARMATURE) { + bArmature *arm = ob->data; + if (arm->edbo) { + ED_armature_edit_free(ob->data); } } } -- cgit v1.2.3