diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-03-10 15:36:11 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-03-10 15:36:11 +0300 |
commit | f13ae69bcd9fdb4fc0964d922acc5d8d84329c93 (patch) | |
tree | 3e9ba8825f88ed8b8998f70e0896db53bc8c1601 /source/blender | |
parent | 695f35387bbfcb613c270aaa2e727fd4844d5e3c (diff) |
Fix for [#26441] Child Hair Crash
* Silly mistakes in my last particle distribution code commit.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 81d97d4f8c5..b8535d36368 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -411,13 +411,14 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *finaldm, ParticleSystem *psys) { - ChildParticle *cpa = psys->child; + ChildParticle *cpa = NULL; int i, p; int child_nbr= get_psys_child_number(scene, psys); int totpart= get_psys_tot_child(scene, psys); alloc_child_particles(psys, totpart); + cpa = psys->child; for(i=0; i<child_nbr; i++){ for(p=0; p<psys->totpart; p++,cpa++){ float length=2.0; @@ -1076,9 +1077,6 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D dm= finaldm; children=1; - totpart = get_psys_tot_child(scene, psys); - cfrom = from = PART_FROM_FACE; - tree=BLI_kdtree_new(totpart); for(p=0,pa=psys->particles; p<totpart; p++,pa++){ @@ -1088,6 +1086,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D } BLI_kdtree_balance(tree); + + totpart = get_psys_tot_child(scene, psys); + cfrom = from = PART_FROM_FACE; } else { distr = part->distr; |