diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-13 13:00:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-13 13:00:26 +0300 |
commit | 8234f24838ec87a82891e56b1bcc92529d38bbf3 (patch) | |
tree | c096de57da679cff05260fa8ee93aad50dee30f9 /source/blender/editors | |
parent | c8597a465f22e020b1c0ce6fcfbb7b7308efdad1 (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 33 |
1 files changed, 15 insertions, 18 deletions
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); } } } |