Cleanup of particle object visualization code. No new features and hopefully no new...
authorJanne Karhu <jhkarh@gmail.com>
Fri, 3 Apr 2009 14:54:29 +0000 (14:54 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Fri, 3 Apr 2009 14:54:29 +0000 (14:54 +0000)
source/blender/blenkernel/intern/anim.c
source/blender/makesdna/DNA_particle_types.h
source/blender/src/buttons_object.c
source/blender/src/edit.c

index 87d7bfc4853e3ff22ac8b9809d80387de8f92c3a..79c4d15b88e79f0ece6c35336b55af8171db6d78 100644 (file)
@@ -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];
        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;
        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((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)
                /* 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;
                        }
 
                                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 {
                                }
                                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);
 
                                        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);
                                }
                        }
                                        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 */
                }
 
                /* restore objects since they were changed in where_is_object_time */
index 52d427eda4e6b92f65321e04d2577bba643af439..e68f8515af103c8a3b12484604e54b68c2ae52b1 100644 (file)
@@ -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_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
 #define PART_DRAW_ADAPT                32
 #define PART_DRAW_COS          64
 #define PART_DRAW_BB_LOCK      128
index 6162a12d06d5ceabe7ae6cdbdee343d8a85788a0..04aa54f2526ae912e76d7e0331faa590f4f37c15 100644 (file)
@@ -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;
 
        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");
 
        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");
index f681b65925f2aeb9aecde776c82b29841e583b85..202d8a813f1686d680d6f06fc29fb82f8c996a01 100644 (file)
@@ -792,19 +792,13 @@ void countall()
                        if(ob->transflag & OB_DUPLIPARTS) {
                                ParticleSystem *psys;
                                ParticleSettings *part;
                        if(ob->transflag & OB_DUPLIPARTS) {
                                ParticleSystem *psys;
                                ParticleSettings *part;
-                               int step_nbr;
 
                                for(psys=ob->particlesystem.first; psys; psys=psys->next){
                                        part=psys->part;
 
                                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);
 
                                        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;
                                        }
                                        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);
                                                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;
                                                }
                                                        cur++;
                                                        go=go->next;
                                                }