[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35660] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Half way fix for [#25385] Particles Emitter only interpolates IPOs & [#26493] Particle system animates incorrectly when emitting mesh is parented

Janne Karhu jhkarh at gmail.com
Mon Mar 21 09:47:05 CET 2011


Revision: 35660
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35660
Author:   jhk
Date:     2011-03-21 08:47:04 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
Half way fix for [#25385] Particles Emitter only interpolates IPOs & [#26493] Particle system animates incorrectly when emitting mesh is parented
* Particle emission now updates all parent objects too to the exact emission time.
* This only does object level animation as updating the object data for every particle would be too slow.
* A better fix could be to interpolate the emission location directly from the current particle emission location and the location from the previous frame, but for this some point cache changes have to be made, so it will have to wait.

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	2011-03-21 06:22:09 UTC (rev 35659)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2011-03-21 08:47:04 UTC (rev 35660)
@@ -1579,8 +1579,12 @@
 	/* get precise emitter matrix if particle is born */
 	if(part->type!=PART_HAIR && pa->time < cfra && pa->time >= sim->psys->cfra) {
 		/* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */
-		BKE_animsys_evaluate_animdata(&sim->ob->id, sim->ob->adt, pa->time, ADT_RECALC_ANIM);
-		where_is_object_time(sim->scene, sim->ob, pa->time);
+		while(ob) {
+			BKE_animsys_evaluate_animdata(&ob->id, ob->adt, pa->time, ADT_RECALC_ANIM);
+			ob = ob->parent;
+		}
+		ob = sim->ob;
+		where_is_object_time(sim->scene, ob, pa->time);
 	}
 
 	/* get birth location from object		*/
@@ -4333,6 +4337,14 @@
 	psys->cfra = cfra;
 	psys->recalc = 0;
 
+	/* make sure emitter is left at correct time (particle emission can change this) */
+	while(ob) {
+		BKE_animsys_evaluate_animdata(&ob->id, ob->adt, cfra, ADT_RECALC_ANIM);
+		ob = ob->parent;
+	}
+	ob = sim.ob;
+	where_is_object_time(scene, ob, cfra);
+
 	/* save matrix for duplicators, at rendertime the actual dupliobject's matrix is used so don't update! */
 	if(psys->renderdata==0)
 		invert_m4_m4(psys->imat, ob->obmat);




More information about the Bf-blender-cvs mailing list