/* frees all editmode stuff */ void ED_editors_exit(bContext *C) { Main *bmain = CTX_data_main(C); Scene *sce; if (!bmain) return; /* frees all editmode undos */ if (G_MAIN->wm.first) { wmWindowManager *wm = G_MAIN->wm.first; /* normally we don't check for NULL undo stack, do here since it may run in different context. */ if (wm->undo_stack) { BKE_undosys_stack_destroy(wm->undo_stack); wm->undo_stack = NULL; } } 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); } } } } /* global in meshtools... */ ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e'); ED_mesh_mirror_topo_table(NULL, NULL, 'e'); }
/* frees all editmode stuff */ void ED_editors_exit(bContext *C) { Main *bmain = CTX_data_main(C); Scene *sce; if (!bmain) return; /* 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); } } } } /* global in meshtools... */ ED_mesh_mirror_spatial_table(NULL, NULL, NULL, 'e'); ED_mesh_mirror_topo_table(NULL, 'e'); }