diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-20 14:32:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-20 14:32:11 +0300 |
commit | d99d68684b990a833c6fe222e5e718ac245338b0 (patch) | |
tree | 328fff1c3bdda80f0df389a7240a30cd78839c17 | |
parent | 6307c65534f6d5cf29d08220cea0dbcca9a0e118 (diff) |
only reallocate memory for child particles if the size changes.
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index acdab80bb37..19187ed35af 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -263,6 +263,12 @@ static int get_psys_tot_child(struct Scene *scene, ParticleSystem *psys) 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; |