[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26137] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: only reallocate memory for child particles if the size changes.

Campbell Barton ideasman42 at gmail.com
Wed Jan 20 12:32:11 CET 2010


Revision: 26137
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26137
Author:   campbellbarton
Date:     2010-01-20 12:32:11 +0100 (Wed, 20 Jan 2010)

Log Message:
-----------
only reallocate memory for child particles if the size 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	2010-01-20 11:20:20 UTC (rev 26136)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2010-01-20 11:32:11 UTC (rev 26137)
@@ -263,6 +263,12 @@
 static void alloc_child_particles(ParticleSystem *psys, int tot)
 {
 	if(psys->child){
+		/* only re-allocate if we have to */
+		if(psys->part->childtype && psys->totchild == tot) {
+			memset(psys->child, 0, tot*sizeof(ChildParticle));
+			return;
+		}
+
 		MEM_freeN(psys->child);
 		psys->child=0;
 		psys->totchild=0;





More information about the Bf-blender-cvs mailing list