diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-12 22:15:10 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-12 22:15:10 +0400 |
commit | ea4a315f3d0f4addcb70ce91a26f1cf584a3e2dc (patch) | |
tree | d7842093d9ece4cd7742108ba83ad20768e0cae4 /source | |
parent | 98741e0392dd159d8f4039d570a79e1e3b90736b (diff) |
Fix for bug #8936: particle system crash with vertex groups and
zero vertices in a mesh.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 9aa866eaf13..0db8294bf86 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1010,7 +1010,7 @@ void psys_interpolate_mcol(MCol *mcol, int quad, float *w, MCol *mc) float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, float *fw, float *values) { - if(values==0) + if(values==0 || index==-1) return 0.0; switch(from){ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 602c13008df..1e58ff56409 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1116,7 +1116,8 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm if(tot==0){ no_distr=1; if(children){ - fprintf(stderr,"Particle child distribution error: Nothing to emit from!\n"); + if(G.f & G_DEBUG) + fprintf(stderr,"Particle child distribution error: Nothing to emit from!\n"); for(p=0,cpa=psys->child; p<totpart; p++,cpa++){ cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0; cpa->foffset= 0.0f; @@ -1126,7 +1127,8 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm } } else { - fprintf(stderr,"Particle distribution error: Nothing to emit from!\n"); + if(G.f & G_DEBUG) + fprintf(stderr,"Particle distribution error: Nothing to emit from!\n"); for(p=0,pa=psys->particles; p<totpart; p++,pa++){ pa->fuv[0]=pa->fuv[1]=pa->fuv[2]= pa->fuv[3]= 0.0; pa->foffset= 0.0f; @@ -1737,9 +1739,8 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi /* get possible textural influence */ psys_get_texture(ob,give_current_material(ob,part->omat),psmd,psys,pa,&ptex,MAP_PA_IVEL); - if(vg_vel){ + if(vg_vel && pa->num != -1) ptex.ivel*=psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_vel); - } /* particles live in global space so */ /* let's convert: */ |