/** Free (or release) any data used by this texture (does not free the texure itself). */ void BKE_texture_free(Tex *tex) { BKE_animdata_free((ID *)tex, false); /* is no lib link block, but texture extension */ if (tex->nodetree) { ntreeFreeTree(tex->nodetree); MEM_freeN(tex->nodetree); tex->nodetree = NULL; } MEM_SAFE_FREE(tex->coba); if (tex->env) { BKE_texture_envmap_free(tex->env); tex->env = NULL; } if (tex->pd) { BKE_texture_pointdensity_free(tex->pd); tex->pd = NULL; } if (tex->vd) { BKE_texture_voxeldata_free(tex->vd); tex->vd = NULL; } if (tex->ot) { BKE_texture_ocean_free(tex->ot); tex->ot = NULL; } BKE_icon_id_delete((ID *)tex); BKE_previewimg_free(&tex->preview); }
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_animdata_free((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_id_delete(&la->id); la->id.icon_id = 0; }
void BKE_light_free(Light *la) { BKE_animdata_free((ID *)la, false); curvemapping_free(la->curfalloff); /* is no lib link block, but light extension */ if (la->nodetree) { ntreeFreeNestedTree(la->nodetree); MEM_freeN(la->nodetree); la->nodetree = NULL; } BKE_previewimg_free(&la->preview); BKE_icon_id_delete(&la->id); la->id.icon_id = 0; }