diff options
author | Janne Karhu <jhkarh@gmail.com> | 2009-04-03 18:54:29 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2009-04-03 18:54:29 +0400 |
commit | bc789af5a9ee62978412b67fbe3313d6636b5499 (patch) | |
tree | 688b38a024011846e52d3017efc94c696b64bdae /source | |
parent | fd2b1156783d52dbb7c93c53fe008d9e14cbffdd (diff) |
Cleanup of particle object visualization code. No new features and hopefully no new bugs.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 104 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_particle_types.h | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 5 | ||||
-rw-r--r-- | source/blender/src/edit.c | 10 |
4 files changed, 51 insertions, 70 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 87d7bfc4853..79c4d15b88e 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -747,7 +747,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_ float ctime, pa_time, scale = 1.0f; float tmat[4][4], mat[4][4], pamat[4][4], size=0.0; float (*obmat)[4], (*oldobmat)[4]; - int lay, a, b, k, step_nbr = 0, counter, hair = 0; + int lay, a, b, k, counter, hair = 0; int totpart, totchild, totgroup=0, pa_num; if(psys==0) return; @@ -775,11 +775,6 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_ if((part->draw_as == PART_DRAW_OB && part->dup_ob) || (part->draw_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first)) { - if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) && part->draw & PART_DRAW_KEYS) - step_nbr = part->keys_step; - else - step_nbr = 0; - /* if we have a hair particle system, use the path cache */ if(part->type == PART_HAIR) { if(psys->flag & PSYS_HAIR_DONE) @@ -859,76 +854,65 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_ oldobmat= obcopy.obmat; } - for(k=0; k<=step_nbr; k++, counter++) { - if(hair) { - /* hair we handle separate and compute transform based on hair keys */ - if(a < totpart) { - cache = psys->pathcache[a]; - psys_get_dupli_path_transform(par, psys, psmd, pa, 0, cache, pamat, &scale); - } - else { - cache = psys->childcache[a-totpart]; - psys_get_dupli_path_transform(par, psys, psmd, 0, cpa, cache, pamat, &scale); - } - - VECCOPY(pamat[3], cache->co); - pamat[3][3]= 1.0f; - - } - else if(step_nbr) { - /* other keys */ - state.time = (float)k / (float)step_nbr; - psys_get_particle_on_path(par, psys, a, &state, 0); - - QuatToMat4(state.rot, pamat); - VECCOPY(pamat[3], state.co); - pamat[3][3]= 1.0f; + if(hair) { + /* hair we handle separate and compute transform based on hair keys */ + if(a < totpart) { + cache = psys->pathcache[a]; + psys_get_dupli_path_transform(par, psys, psmd, pa, 0, cache, pamat, &scale); } else { - /* first key */ - state.time = -1.0; - if(psys_get_particle_state(par, psys, a, &state, 0) == 0) - continue; - - QuatToMat4(state.rot, pamat); - VECCOPY(pamat[3], state.co); - pamat[3][3]= 1.0f; + cache = psys->childcache[a-totpart]; + psys_get_dupli_path_transform(par, psys, psmd, 0, cpa, cache, pamat, &scale); } - if(part->draw_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) { - for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) { - Mat4MulMat4(tmat, oblist[b]->obmat, pamat); - Mat4MulFloat3((float *)tmat, size*scale); - if(par_space_mat) - Mat4MulMat4(mat, tmat, par_space_mat); - else - Mat4CpyMat4(mat, tmat); + VECCOPY(pamat[3], cache->co); + pamat[3][3]= 1.0f; + + } + else { + /* first key */ + state.time = ctime; + if(psys_get_particle_state(par, psys, a, &state, 0) == 0) + continue; - dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated); - Mat4CpyMat4(dob->omat, obcopylist[b].obmat); - if(G.rendering) - psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco); - } - } - else { - /* to give ipos in object correct offset */ - where_is_object_time(ob, ctime-pa_time); - - Mat4CpyMat4(mat, pamat); + QuatToMat4(state.rot, pamat); + VECCOPY(pamat[3], state.co); + pamat[3][3]= 1.0f; + } - Mat4MulMat4(tmat, obmat, mat); + if(part->draw_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) { + for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) { + Mat4MulMat4(tmat, oblist[b]->obmat, pamat); Mat4MulFloat3((float *)tmat, size*scale); if(par_space_mat) Mat4MulMat4(mat, tmat, par_space_mat); else Mat4CpyMat4(mat, tmat); - dob= new_dupli_object(lb, ob, mat, par->lay, counter, OB_DUPLIPARTS, animated); - Mat4CpyMat4(dob->omat, oldobmat); + dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated); + Mat4CpyMat4(dob->omat, obcopylist[b].obmat); if(G.rendering) psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco); } } + else { + /* to give ipos in object correct offset */ + where_is_object_time(ob, ctime-pa_time); + + Mat4CpyMat4(mat, pamat); + + Mat4MulMat4(tmat, obmat, mat); + Mat4MulFloat3((float *)tmat, size*scale); + if(par_space_mat) + Mat4MulMat4(mat, tmat, par_space_mat); + else + Mat4CpyMat4(mat, tmat); + + dob= new_dupli_object(lb, ob, mat, par->lay, counter, OB_DUPLIPARTS, animated); + Mat4CpyMat4(dob->omat, oldobmat); + if(G.rendering) + psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco); + } } /* restore objects since they were changed in where_is_object_time */ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 52d427eda4e..e68f8515af1 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -304,7 +304,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_ANG 2 #define PART_DRAW_SIZE 4 #define PART_DRAW_EMITTER 8 /* render emitter also */ -#define PART_DRAW_KEYS 16 +//#define PART_DRAW_KEYS 16 /* not used anywhere */ #define PART_DRAW_ADAPT 32 #define PART_DRAW_COS 64 #define PART_DRAW_BB_LOCK 128 diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 6162a12d06d..04aa54f2526 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -4433,7 +4433,10 @@ static void object_panel_particle_visual(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_visual", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Visualization", "Particle", 640, 0, 318, 204)==0) return; - uiDefButS(block, MENU, B_PART_RECALC, "Billboard %x9|Group %x8|Object %x7|Path %x6|Line %x5|Axis %x4|Cross %x3|Circle %x2|Point %x1|None %x0", butx,buty,butw,buth, &part->draw_as, 14.0, 0.0, 0, 0, "How particles are visualized"); + if(part->type==PART_HAIR) + uiDefButS(block, MENU, B_PART_RECALC, "Group %x8|Object %x7|Path %x6|None %x0", butx,buty,butw,buth, &part->draw_as, 14.0, 0.0, 0, 0, "How hair is visualized"); + else + uiDefButS(block, MENU, B_PART_RECALC, "Billboard %x9|Group %x8|Object %x7|Path %x6|Line %x5|Axis %x4|Cross %x3|Circle %x2|Point %x1|None %x0", butx,buty,butw,buth, &part->draw_as, 14.0, 0.0, 0, 0, "How particles are visualized"); if(part->draw_as==PART_DRAW_NOT) { uiDefButBitS(block, TOG, PART_DRAW_EMITTER, B_PART_REDRAW, "Render emitter", butx,(buty-=2*buth),butw,buth, &part->draw, 0, 0, 0, 0, "Render emitter object"); diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c index f681b65925f..202d8a813f1 100644 --- a/source/blender/src/edit.c +++ b/source/blender/src/edit.c @@ -792,19 +792,13 @@ void countall() if(ob->transflag & OB_DUPLIPARTS) { ParticleSystem *psys; ParticleSettings *part; - int step_nbr; for(psys=ob->particlesystem.first; psys; psys=psys->next){ part=psys->part; - - //if(psys->flag&PSYS_BAKED && part->draw&PART_DRAW_KEYS) - // step_nbr=part->keys_step; - //else - step_nbr=1; if(part->draw_as==PART_DRAW_OB && part->dup_ob){ int tot=count_particles(psys); - count_object(part->dup_ob, 0, tot*step_nbr); + count_object(part->dup_ob, 0, tot); } else if(part->draw_as==PART_DRAW_GR && part->dup_group){ GroupObject *go; @@ -818,7 +812,7 @@ void countall() go= part->dup_group->gobject.first; while(go){ tot=count_particles_mod(psys,totgroup,cur); - count_object(go->ob, 0, tot*step_nbr); + count_object(go->ob, 0, tot); cur++; go=go->next; } |