[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31735] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Fix for [#23642] Particle system " Lifetime" setting does not animate

Janne Karhu jhkarh at gmail.com
Fri Sep 3 08:12:41 CEST 2010


Revision: 31735
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31735
Author:   jhk
Date:     2010-09-03 08:12:40 +0200 (Fri, 03 Sep 2010)

Log Message:
-----------
Fix for [#23642] Particle system "Lifetime" setting does not animate

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2010-09-03 05:54:09 UTC (rev 31734)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2010-09-03 06:12:40 UTC (rev 31735)
@@ -1573,8 +1573,6 @@
 		/* TODO: needs some work to make most blendtypes generally usefull */
 		psys_get_texture(sim,ma,pa,&ptex,MAP_PA_INIT);
 	}
-	
-	pa->lifetime= part->lifetime*ptex.life;
 
 	if(part->type==PART_HAIR)
 		pa->time= 0.0f;
@@ -1590,25 +1588,6 @@
 		pa->time= part->sta + (part->end - part->sta)*ptex.time;
 	}
 
-
-	if(part->type==PART_HAIR){
-		pa->lifetime=100.0f;
-	}
-	else{
-#if 0 // XXX old animation system
-		icu=find_ipocurve(psys->part->ipo,PART_EMIT_LIFE);
-		if(icu){
-			calc_icu(icu,100*ptex.time);
-			pa->lifetime*=icu->curval;
-		}
-#endif // XXX old animation system
-
-		if(part->randlife!=0.0)
-			pa->lifetime*= 1.0f - part->randlife * BLI_frand();
-	}
-
-	pa->dietime= pa->time+pa->lifetime;
-
 	if(part->type!=PART_HAIR && part->distr!=PART_DISTR_GRID && part->from != PART_FROM_VERT){
 		if(ptex.exist < BLI_frand())
 			pa->flag |= PARS_UNEXIST;
@@ -1701,6 +1680,7 @@
 	part=psys->part;
 
 	ptex.ivel=1.0;
+	ptex.life=1.0;
 
 	/* we need to get every random even if they're not used so that they don't effect eachother */
 	r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
@@ -1758,7 +1738,7 @@
 			psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
 		
 		/* get possible textural influence */
-		psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL);
+		psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL|MAP_PA_LIFE);
 
 		//if(vg_vel && pa->num != -1)
 		//	ptex.ivel*=psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_vel);
@@ -1981,6 +1961,17 @@
 		}
 	}
 
+
+	if(part->type == PART_HAIR){
+		pa->lifetime = 100.0f;
+	}
+	else{
+		pa->lifetime = part->lifetime*ptex.life;
+
+		if(part->randlife != 0.0)
+			pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21);
+	}
+
 	pa->dietime = pa->time + pa->lifetime;
 
 	if(sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&





More information about the Bf-blender-cvs mailing list