/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ void BKE_libblock_free(ListBase *lb, void *idv) { ID *id = idv; #ifdef WITH_PYTHON BPY_id_release(id); #endif switch (GS(id->name) ) { /* GetShort from util.h */ case ID_SCE: BKE_scene_free((Scene *)id); break; case ID_LI: BKE_library_free((Library *)id); break; case ID_OB: BKE_object_free((Object *)id); break; case ID_ME: BKE_mesh_free((Mesh *)id, 1); break; case ID_CU: BKE_curve_free((Curve *)id); break; case ID_MB: BKE_mball_free((MetaBall *)id); break; case ID_MA: BKE_material_free((Material *)id); break; case ID_TE: BKE_texture_free((Tex *)id); break; case ID_IM: BKE_image_free((Image *)id); break; case ID_LT: BKE_lattice_free((Lattice *)id); break; case ID_LA: BKE_lamp_free((Lamp *)id); break; case ID_CA: BKE_camera_free((Camera *) id); break; case ID_IP: BKE_ipo_free((Ipo *)id); break; case ID_KE: BKE_key_free((Key *)id); break; case ID_WO: BKE_world_free((World *)id); break; case ID_SCR: BKE_screen_free((bScreen *)id); break; case ID_VF: BKE_vfont_free((VFont *)id); break; case ID_TXT: BKE_text_free((Text *)id); break; case ID_SCRIPT: //XXX free_script((Script *)id); break; case ID_SPK: BKE_speaker_free((Speaker *)id); break; case ID_SO: BKE_sound_free((bSound *)id); break; case ID_GR: BKE_group_free((Group *)id); break; case ID_AR: BKE_armature_free((bArmature *)id); break; case ID_AC: BKE_action_free((bAction *)id); break; case ID_NT: ntreeFreeTree((bNodeTree *)id); break; case ID_BR: BKE_brush_free((Brush *)id); break; case ID_PA: BKE_particlesettings_free((ParticleSettings *)id); break; case ID_WM: if (free_windowmanager_cb) free_windowmanager_cb(NULL, (wmWindowManager *)id); break; case ID_GD: BKE_gpencil_free((bGPdata *)id); break; case ID_MC: BKE_movieclip_free((MovieClip *)id); break; } if (id->properties) { IDP_FreeProperty(id->properties); MEM_freeN(id->properties); } BLI_remlink(lb, id); /* this ID may be a driver target! */ BKE_animdata_main_cb(G.main, animdata_dtar_clear_cb, (void *)id); MEM_freeN(id); }
/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ void free_libblock(ListBase *lb, void *idv) { ID *id= idv; #ifdef WITH_PYTHON BPY_id_release(id); #endif switch( GS(id->name) ) { /* GetShort from util.h */ case ID_SCE: free_scene((Scene *)id); break; case ID_LI: free_library((Library *)id); break; case ID_OB: free_object((Object *)id); break; case ID_ME: free_mesh((Mesh *)id); break; case ID_CU: free_curve((Curve *)id); break; case ID_MB: free_mball((MetaBall *)id); break; case ID_MA: free_material((Material *)id); break; case ID_TE: free_texture((Tex *)id); break; case ID_IM: free_image((Image *)id); break; case ID_LT: free_lattice((Lattice *)id); break; case ID_LA: free_lamp((Lamp *)id); break; case ID_CA: free_camera((Camera*) id); break; case ID_IP: free_ipo((Ipo *)id); break; case ID_KE: free_key((Key *)id); break; case ID_WO: free_world((World *)id); break; case ID_SCR: free_screen((bScreen *)id); break; case ID_VF: free_vfont((VFont *)id); break; case ID_TXT: free_text((Text *)id); break; case ID_SCRIPT: //XXX free_script((Script *)id); break; case ID_SPK: free_speaker((Speaker *)id); break; case ID_SO: sound_free((bSound*)id); break; case ID_GR: free_group_objects((Group *)id); break; case ID_AR: free_armature((bArmature *)id); break; case ID_AC: free_action((bAction *)id); break; case ID_NT: ntreeFreeTree((bNodeTree *)id); break; case ID_BR: free_brush((Brush *)id); break; case ID_PA: psys_free_settings((ParticleSettings *)id); break; case ID_WM: if(free_windowmanager_cb) free_windowmanager_cb(NULL, (wmWindowManager *)id); break; case ID_GD: free_gpencil_data((bGPdata *)id); break; } if (id->properties) { IDP_FreeProperty(id->properties); MEM_freeN(id->properties); } BLI_remlink(lb, id); /* this ID may be a driver target! */ BKE_animdata_main_cb(G.main, animdata_dtar_clear_cb, (void *)id); MEM_freeN(id); }
/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ void BKE_libblock_free_ex(Main *bmain, void *idv, bool do_id_user) { ID *id = idv; short type = GS(id->name); ListBase *lb = which_libbase(bmain, type); DAG_id_type_tag(bmain, type); #ifdef WITH_PYTHON BPY_id_release(id); #endif switch (type) { /* GetShort from util.h */ case ID_SCE: BKE_scene_free((Scene *)id); break; case ID_LI: BKE_library_free((Library *)id); break; case ID_OB: BKE_object_free_ex((Object *)id, do_id_user); break; case ID_ME: BKE_mesh_free((Mesh *)id, 1); break; case ID_CU: BKE_curve_free((Curve *)id); break; case ID_MB: BKE_mball_free((MetaBall *)id); break; case ID_MA: BKE_material_free((Material *)id); break; case ID_TE: BKE_texture_free((Tex *)id); break; case ID_IM: BKE_image_free((Image *)id); break; case ID_LT: BKE_lattice_free((Lattice *)id); break; case ID_LA: BKE_lamp_free((Lamp *)id); break; case ID_CA: BKE_camera_free((Camera *) id); break; case ID_IP: BKE_ipo_free((Ipo *)id); break; case ID_KE: BKE_key_free((Key *)id); break; case ID_WO: BKE_world_free((World *)id); break; case ID_SCR: BKE_screen_free((bScreen *)id); break; case ID_VF: BKE_vfont_free((VFont *)id); break; case ID_TXT: BKE_text_free((Text *)id); break; case ID_SCRIPT: /* deprecated */ break; case ID_SPK: BKE_speaker_free((Speaker *)id); break; case ID_SO: BKE_sound_free((bSound *)id); break; case ID_GR: BKE_group_free((Group *)id); break; case ID_AR: BKE_armature_free((bArmature *)id); break; case ID_AC: BKE_action_free((bAction *)id); break; case ID_NT: ntreeFreeTree_ex((bNodeTree *)id, do_id_user); break; case ID_BR: BKE_brush_free((Brush *)id); break; case ID_PA: BKE_particlesettings_free((ParticleSettings *)id); break; case ID_WM: if (free_windowmanager_cb) free_windowmanager_cb(NULL, (wmWindowManager *)id); break; case ID_GD: BKE_gpencil_free((bGPdata *)id); break; case ID_MC: BKE_movieclip_free((MovieClip *)id); break; case ID_MSK: BKE_mask_free(bmain, (Mask *)id); break; case ID_LS: BKE_free_linestyle((FreestyleLineStyle *)id); break; } /* avoid notifying on removed data */ if (free_notifier_reference_cb) free_notifier_reference_cb(id); BLI_remlink(lb, id); BKE_libblock_free_data(id); MEM_freeN(id); }