void BKE_lamp_free(Lamp *la) { MTex *mtex; int a; for (a = 0; a < MAX_MTEX; a++) { mtex = la->mtex[a]; if (mtex && mtex->tex) mtex->tex->id.us--; if (mtex) MEM_freeN(mtex); } BKE_free_animdata((ID *)la); curvemapping_free(la->curfalloff); /* is no lib link block, but lamp extension */ if (la->nodetree) { ntreeFreeTree(la->nodetree); MEM_freeN(la->nodetree); } BKE_previewimg_free(&la->preview); BKE_icon_delete(&la->id); la->id.icon_id = 0; }
void BKE_world_free_ex(World *wrld, bool do_id_user) { MTex *mtex; int a; for (a = 0; a < MAX_MTEX; a++) { mtex = wrld->mtex[a]; if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--; if (mtex) MEM_freeN(mtex); } BKE_previewimg_free(&wrld->preview); BKE_animdata_free((ID *)wrld); /* is no lib link block, but world extension */ if (wrld->nodetree) { ntreeFreeTree_ex(wrld->nodetree, do_id_user); MEM_freeN(wrld->nodetree); } if (wrld->gpumaterial.first) GPU_material_free(&wrld->gpumaterial); BKE_icon_delete((struct ID *)wrld); wrld->id.icon_id = 0; }
/* not material itself */ void free_material(Material *ma) { MTex *mtex; int a; for(a=0; a<MAX_MTEX; a++) { mtex= ma->mtex[a]; if(mtex && mtex->tex) mtex->tex->id.us--; if(mtex) MEM_freeN(mtex); } if(ma->ramp_col) MEM_freeN(ma->ramp_col); if(ma->ramp_spec) MEM_freeN(ma->ramp_spec); BKE_free_animdata((ID *)ma); if(ma->preview) BKE_previewimg_free(&ma->preview); BKE_icon_delete((struct ID*)ma); ma->id.icon_id = 0; /* is no lib link block, but material extension */ if(ma->nodetree) { ntreeFreeTree(ma->nodetree); MEM_freeN(ma->nodetree); } if(ma->gpumaterial.first) GPU_material_free(ma); }
void BKE_previewimg_cached_release(const char *name) { PreviewImage *prv = BLI_ghash_popkey(gCachedPreviews, name, MEM_freeN); if (prv) { if (prv->icon_id) { BKE_icon_delete(prv->icon_id); } BKE_previewimg_freefunc(prv); } }
void free_world(World *wrld) { MTex *mtex; int a; for(a=0; a<MAX_MTEX; a++) { mtex= wrld->mtex[a]; if(mtex && mtex->tex) mtex->tex->id.us--; if(mtex) MEM_freeN(mtex); } BKE_previewimg_free(&wrld->preview); BKE_free_animdata((ID *)wrld); BKE_icon_delete((struct ID*)wrld); wrld->id.icon_id = 0; }
void BKE_texture_free(Tex *tex) { if (tex->coba) MEM_freeN(tex->coba); if (tex->env) BKE_free_envmap(tex->env); if (tex->pd) BKE_free_pointdensity(tex->pd); if (tex->vd) BKE_free_voxeldata(tex->vd); if (tex->ot) BKE_free_oceantex(tex->ot); BKE_free_animdata((struct ID *)tex); BKE_previewimg_free(&tex->preview); BKE_icon_delete((struct ID *)tex); tex->id.icon_id = 0; if (tex->nodetree) { ntreeFreeTree(tex->nodetree); MEM_freeN(tex->nodetree); } }