Fix for [#26083] Animated Particle Textures have no effect
authorJanne Karhu <jhkarh@gmail.com>
Tue, 15 Feb 2011 15:03:49 +0000 (15:03 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Tue, 15 Feb 2011 15:03:49 +0000 (15:03 +0000)
* Duplicating particle settings didn't duplicate texture slots.

source/blender/blenkernel/intern/particle.c

index d1d5c13c3dd943bacad23c2b72808ced17e01ebf..5fc22bd842a281f13f12cf7fe2d0787fbdca4e5a 100644 (file)
@@ -3566,13 +3566,22 @@ ParticleSettings *psys_new_settings(const char *name, Main *main)
 ParticleSettings *psys_copy_settings(ParticleSettings *part)
 {
        ParticleSettings *partn;
-       
+       int a;
+
        partn= copy_libblock(part);
        if(partn->pd) partn->pd= MEM_dupallocN(part->pd);
        if(partn->pd2) partn->pd2= MEM_dupallocN(part->pd2);
        partn->effector_weights = MEM_dupallocN(part->effector_weights);
 
        partn->boids = boid_copy_settings(part->boids);
+
+       for(a=0; a<MAX_MTEX; a++) {
+               if(part->mtex[a]) {
+                       partn->mtex[a]= MEM_mallocN(sizeof(MTex), "psys_copy_tex");
+                       memcpy(partn->mtex[a], part->mtex[a], sizeof(MTex));
+                       id_us_plus((ID *)partn->mtex[a]->tex);
+               }
+       }
        
        return partn;
 }