diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-14 16:11:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-14 16:11:22 +0300 |
commit | 87a5ce06f349f3c79b4f6ae1c75c35987776f69e (patch) | |
tree | 138f2bc31e3c9ded572c2274749eee38932f8519 /source | |
parent | b1a39375e5f57723baeb4004a53219f2ecb1181a (diff) |
Fix #20372: crash when strand render enabled with child hairs.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index d0f7b2d60a5..c89811a62e0 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1707,14 +1707,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem totface= psmd->dm->getNumFaces(psmd->dm); origindex= psmd->dm->getFaceDataArray(psmd->dm, CD_ORIGINDEX); - if(origindex) { - for(a=0; a<totface; a++) - strandbuf->totbound= MAX2(strandbuf->totbound, origindex[a]); - } - else { - for(a=0; a<totface; a++) - strandbuf->totbound= MAX2(strandbuf->totbound, a); - } + for(a=0; a<totface; a++) + strandbuf->totbound= MAX2(strandbuf->totbound, (origindex)? origindex[a]: a); strandbuf->totbound++; strandbuf->bound= MEM_callocN(sizeof(StrandBound)*strandbuf->totbound, "StrandBound"); @@ -1856,8 +1850,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem dosimplify = psys_render_simplify_params(psys, cpa, simplify); if(strandbuf) { - if(origindex[cpa->num]+1 > sbound - strandbuf->bound) { - sbound= strandbuf->bound + origindex[cpa->num]+1; + int orignum= (origindex)? origindex[cpa->num]: cpa->num; + + if(orignum > sbound - strandbuf->bound) { + sbound= strandbuf->bound + orignum; sbound->start= sbound->end= obr->totstrand; } } |