diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-16 23:23:00 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-16 23:23:00 +0300 |
commit | d7f63b40628b0371b3475f965187cd63f4c21db3 (patch) | |
tree | fdacf8ef2796b2d89d6acd2e146b898fe660296d | |
parent | 0de1fd9086019fc09ab4bc07d371af69acbee913 (diff) |
Plumiferos request (and useful :)
Static particle option: maximum length. Button is next to "Vect" in first
particle panel. This allows weird forcefields and wind to act without
extreme long strands.
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_effect_types.h | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 102bc479bed..ad3e2008b9f 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1017,7 +1017,7 @@ static void make_particle_keys(RNG *rng, Object *ob, int depth, int nr, PartEff { Particle *pa, *opa = NULL; float damp, deltalife, life; - float cur_time; + float cur_time, maxspeed= paf->maxlen/(float)paf->totkey; float opco[3], opno[3], npco[3], npno[3], new_force[3], new_speed[3]; int b, rt1, rt2, deflected, deflection, finish_defs, def_count; int last_ob, last_fc, same_fc; @@ -1100,6 +1100,13 @@ static void make_particle_keys(RNG *rng, Object *ob, int depth, int nr, PartEff pa->no[1]= deltalife * (new_speed[1] + new_force[1]); pa->no[2]= deltalife * (new_speed[2] + new_force[2]); + /* speed limitor */ + if((paf->flag & PAF_STATIC) && maxspeed!=0.0f) { + float len= VecLength(pa->no); + if(len > maxspeed) + VecMulf(pa->no, maxspeed/len); + } + /* new location */ pa->co[0]= opa->co[0] + pa->no[0]; pa->co[1]= opa->co[1] + pa->no[1]; diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h index 571f87ae33f..435a18e5ab2 100644 --- a/source/blender/makesdna/DNA_effect_types.h +++ b/source/blender/makesdna/DNA_effect_types.h @@ -117,7 +117,7 @@ typedef struct PartEff { float force[3]; float damp; - float nabla, vectsize, defvec[3]; + float nabla, vectsize, maxlen, pad, defvec[3]; float mult[4], life[4]; short child[4], mat[4]; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 1fdbfab4642..76c98056072 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -2616,7 +2616,10 @@ static void object_panel_particles(Object *ob) uiDefButBitS(block, TOG, PAF_UNBORN, B_DIFF, "Unborn",210,110,50,20, &paf->flag, 0, 0, 0, 0, "Make particles appear before they are emitted"); uiDefButBitS(block, TOG, PAF_DIED, B_DIFF, "Died", 260,110,50,20, &paf->flag, 0, 0, 0, 0, "Make particles appear after they have died"); uiDefButS(block, TOG, REDRAWVIEW3D, "Vect", 160,90,75,20, &paf->stype, 0, 0, 0, 0, "Give the particles a direction and rotation"); - uiDefButF(block, NUM, B_DIFF, "Size:", 235,90,75,20, &paf->vectsize, 0.0, 1.0, 10, 1, "The amount the Vect option influences halo size"); + if(paf->flag & PAF_STATIC) + uiDefButF(block, NUM, B_CALCEFFECT, "Max:", 235,90,75,20, &paf->maxlen, 0.0, 100.0, 10, 1, "The maximum length of a particle strand (zero is no limit)"); + else + uiDefButF(block, NUM, B_CALCEFFECT, "Size:", 235,90,75,20, &paf->vectsize, 0.0, 1.0, 10, 1, "The amount the Vect option influences halo size"); uiBlockEndAlign(block); uiDefBut(block, LABEL, 0, "Children:", 160,70,75,20, NULL, 0.0, 0, 0, 0, ""); |