[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34153] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Bug fix: particle point cache was reset on start frame if particles had grid distribution even if there were no changes .

Janne Karhu jhkarh at gmail.com
Fri Jan 7 12:38:29 CET 2011


Revision: 34153
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34153
Author:   jhk
Date:     2011-01-07 11:38:28 +0000 (Fri, 07 Jan 2011)
Log Message:
-----------
Bug fix: particle point cache was reset on start frame if particles had grid distribution even if there were no changes.

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-01-07 11:24:34 UTC (rev 34152)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2011-01-07 11:38:28 UTC (rev 34153)
@@ -130,6 +130,16 @@
 	return psys->part->disp;
 }
 
+static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
+{
+	if(pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
+		return pid->cache->totpoint;
+	else if(psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT)
+		return psys->part->grid_res * psys->part->grid_res * psys->part->grid_res;
+	else
+		return psys->part->totpart;
+}
+
 void psys_reset(ParticleSystem *psys, int mode)
 {
 	PARTICLE_P;
@@ -137,7 +147,7 @@
 	if(ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
 		if(mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
 			/* don't free if not absolutely necessary */
-			if(psys->totpart != psys->part->totpart) {
+			if(psys->totpart != tot_particles(psys, NULL)) {
 				psys_free_particles(psys);
 				psys->totpart= 0;
 			}
@@ -3633,15 +3643,8 @@
 	ParticleSystem *psys = sim->psys;
 	ParticleSettings *part = psys->part;
 	int oldtotpart = psys->totpart;
-	int totpart = oldtotpart;
+	int totpart = tot_particles(psys, pid);
 
-	if(pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
-		totpart = pid->cache->totpoint;
-	else if(part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT)
-		totpart = part->grid_res*part->grid_res*part->grid_res;
-	else
-		totpart = psys->part->totpart;
-
 	if(totpart != oldtotpart)
 		realloc_particles(sim, totpart);
 




More information about the Bf-blender-cvs mailing list