diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 27 |
2 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 3204a1c38e7..d1d5c13c3dd 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -366,6 +366,8 @@ static void fluid_free_settings(SPHFluidSettings *fluid) void psys_free_settings(ParticleSettings *part) { + MTex *mtex; + int a; BKE_free_animdata(&part->id); free_partdeflect(part->pd); free_partdeflect(part->pd2); @@ -377,6 +379,12 @@ void psys_free_settings(ParticleSettings *part) boid_free_settings(part->boids); fluid_free_settings(part->fluid); + + for(a=0; a<MAX_MTEX; a++) { + mtex= part->mtex[a]; + if(mtex && mtex->tex) mtex->tex->id.us--; + if(mtex) MEM_freeN(mtex); + } } void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics) diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index cf4fcbb4def..c22b1d32849 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -779,6 +779,7 @@ void make_local_texture(Tex *tex) World *wrld; Lamp *la; Brush *br; + ParticleSettings *pa; int a, local=0, lib=0; /* - only lib users: do nothing @@ -841,6 +842,16 @@ void make_local_texture(Tex *tex) } br= br->id.next; } + pa= bmain->particle.first; + while(pa) { + for(a=0; a<MAX_MTEX; a++) { + if(pa->mtex[a] && pa->mtex[a]->tex==tex) { + if(pa->id.lib) lib= 1; + else local= 1; + } + } + pa= pa->id.next; + } if(local && lib==0) { tex->id.lib= NULL; @@ -901,6 +912,19 @@ void make_local_texture(Tex *tex) } br= br->id.next; } + pa= bmain->particle.first; + while(pa) { + for(a=0; a<MAX_MTEX; a++) { + if(pa->mtex[a] && pa->mtex[a]->tex==tex) { + if(pa->id.lib==NULL) { + pa->mtex[a]->tex= texn; + texn->id.us++; + tex->id.us--; + } + } + } + pa= pa->id.next; + } } } @@ -1079,6 +1103,9 @@ void set_active_mtex(ID *id, short act) case ID_LA: ((Lamp *)id)->texact= act; break; + case ID_PA: + ((ParticleSettings *)id)->texact= act; + break; } } |