/* 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; /* global in meshtools... */ mesh_octree_table(NULL, NULL, NULL, 'e'); mesh_mirrtopo_table(NULL, 'e'); if(ob) { if(ob->type==OB_MESH) { Mesh *me= ob->data; if(me->edit_mesh) { free_editMesh(me->edit_mesh); MEM_freeN(me->edit_mesh); me->edit_mesh= NULL; } } else if(ob->type==OB_ARMATURE) { ED_armature_edit_free(ob); } else if(ob->type==OB_FONT) { // free_editText(); } // else if(ob->type==OB_MBALL) // BLI_freelistN(&editelems); // free_editLatt(); // free_posebuf(); // XXX this is still a global... } } else if(sce->basact && sce->basact->object) { Object *ob= sce->basact->object; /* if weight-painting is on, free mesh octree data */ if(ob->mode & OB_MODE_WEIGHT_PAINT) { mesh_octree_table(NULL, NULL, NULL, 'e'); mesh_mirrtopo_table(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'); }