[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16028] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Fix for [#13697] Reactor particles with children doesn't render

Janne Karhu jhkarh at utu.fi
Fri Aug 8 18:40:41 CEST 2008


Revision: 16028
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16028
Author:   jhk
Date:     2008-08-08 18:40:41 +0200 (Fri, 08 Aug 2008)

Log Message:
-----------
Fix for [#13697] Reactor particles with children doesn't render
-Particles were being recalculated a bit too aggressively. Normal particles didn't care, but since reactor particles have dynamic birth times they lost crucial information in the recalculation.

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	2008-08-08 15:54:04 UTC (rev 16027)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-08-08 16:40:41 UTC (rev 16028)
@@ -4653,7 +4653,7 @@
 	PTCacheID pid;
 	int totpart, oldtotpart, totchild, oldtotchild, p;
 	float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0;
-	int init= 0, distr= 0, alloc= 0, usecache= 0;
+	int init= 0, distr= 0, alloc= 0, usecache= 0, only_children_changed= 0;
 	int framenr, framedelta, startframe, endframe;
 
 	part= psys->part;
@@ -4720,6 +4720,7 @@
 	totchild = get_psys_tot_child(psys);
 
 	if(oldtotpart != totpart || (psys->part->childtype && oldtotchild != totchild)) {
+		only_children_changed = (oldtotpart == totpart);
 		realloc_particles(ob, psys, totpart);
 		alloc = 1;
 		distr= 1;
@@ -4740,15 +4741,18 @@
 
 			if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
 			/* don't generate children while growing hair - waste of time */
-			psys_free_children(psys);
-		else if(get_psys_tot_child(psys))
-			distribute_particles(ob, psys, PART_FROM_CHILD);
+				psys_free_children(psys);
+			else if(get_psys_tot_child(psys))
+				distribute_particles(ob, psys, PART_FROM_CHILD);
 		}
-		initialize_all_particles(ob, psys, psmd);
 
-		if(alloc)
-			reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
+		if(only_children_changed==0) {
+			initialize_all_particles(ob, psys, psmd);
 
+			if(alloc)
+				reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
+		}
+
 		/* flag for possible explode modifiers after this system */
 		psmd->flag |= eParticleSystemFlag_Pars;
 	}





More information about the Bf-blender-cvs mailing list