From bfddf7f4af6175c90d594db910f648de9f9c2eee Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 10 Nov 2005 19:00:10 +0000 Subject: [PATCH] - Static particles now draw shaded too! http://www.blender.org/bf/rt3.jpg It uses Material color and specular, like for the solid faces. - Depgraph Fix for changing object layers, should re-evaluate dependencies - Fix for setting curves to 3D by default (on adding a Guide field) --- source/blender/src/buttons_editing.c | 6 ++- source/blender/src/buttons_object.c | 3 ++ source/blender/src/buttons_scene.c | 7 ++- source/blender/src/drawobject.c | 71 +++++++++++++++++----------- source/blender/src/editobject.c | 2 + 5 files changed, 59 insertions(+), 30 deletions(-) diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 77570ed688f..e670970461f 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -644,8 +644,10 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an /* optimal redraw */ if( (ob->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) ); else if( (ob->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 ); - else allqueue(REDRAWVIEW3D, 0); - + else { + allqueue(REDRAWVIEW3D, 0); + DAG_scene_sort(G.scene); + } ob->lay= BASACT->lay; } } diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index c12fd3165df..a520ccc84c4 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1629,7 +1629,10 @@ void do_effects_panels(unsigned short event) DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) { Curve *cu= ob->data; + cu->flag |= (CU_PATH|CU_3D); + do_curvebuts(B_CU3D); /* all curves too */ + DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); } allqueue(REDRAWVIEW3D, 0); diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 17760fcfa93..c12d1c6962f 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -1457,8 +1457,13 @@ void sound_panels() { bSound *sound; + /* paranoia check */ sound = G.buts->lockpoin; - + if( GS(sound->id.name)!=ID_SO) { + sound= NULL; + G.buts->lockpoin= NULL; + } + sound_panel_sound(sound); sound_panel_listener(); sound_panel_sequencer(); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 60383de8b14..03d1eaaea9e 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -2384,11 +2384,11 @@ static void draw_particle_system(Object *ob, PartEff *paf) mymultmatrix(ob->obmat); // bring back local matrix for dtx } -static void draw_static_particle_system(Object *ob, PartEff *paf) +static void draw_static_particle_system(Object *ob, PartEff *paf, int dt) { Particle *pa; - float ctime, mtime, vec[3], vec1[3]; - int a; + float ctime, mtime, vec[3], veco[3]; + int a, use_norm=0; pa= paf->keys; if(pa==NULL) { @@ -2397,40 +2397,57 @@ static void draw_static_particle_system(Object *ob, PartEff *paf) if(pa==NULL) return; } - glPointSize(1.0); - if(paf->stype!=PAF_VECT) glBegin(GL_POINTS); - + if(paf->stype==PAF_VECT) { + if(dt>OB_WIRE) { + glEnable(GL_LIGHTING); + set_gl_material(paf->omat); + use_norm= 1; + } + } + else { + glPointSize(1.0); + glBegin(GL_POINTS); + } + for(a=0; atotpart; a++, pa+=paf->totkey) { - where_is_particle(paf, pa, pa->time, vec1); - - mtime= pa->time+pa->lifetime+paf->staticstep-1; - - for(ctime= pa->time; ctimestaticstep) { + if(paf->stype==PAF_VECT) { - /* make sure hair grows until the end.. */ - if(ctime>pa->time+pa->lifetime) ctime= pa->time+pa->lifetime; - - if(paf->stype==PAF_VECT) { - where_is_particle(paf, pa, ctime+1, vec); + glBegin(GL_LINE_STRIP); + where_is_particle(paf, pa, pa->time, veco); - glBegin(GL_LINE_STRIP); - glVertex3fv(vec); - glVertex3fv(vec1); - glEnd(); + mtime= pa->time+pa->lifetime+paf->staticstep; + for(ctime= pa->time+paf->staticstep; ctimestaticstep) { - VECCOPY(vec1, vec); - } - else { where_is_particle(paf, pa, ctime, vec); + if(use_norm) { + float no[3]; + VECSUB(no, vec, veco); + glNormal3fv(no); + } + glVertex3fv(veco); + VECCOPY(veco, vec); + } + + glVertex3fv(veco); + glEnd(); + } + else { + mtime= pa->time+pa->lifetime+paf->staticstep-1; + for(ctime= pa->time; ctimestaticstep) { + where_is_particle(paf, pa, ctime, vec); glVertex3fv(vec); - } } } - if(paf->stype!=PAF_VECT) glEnd(); - + if(paf->stype==PAF_VECT) { + glDisable(GL_LIGHTING); + } + else { + glEnd(); + } + } unsigned int nurbcol[8]= { @@ -3515,7 +3532,7 @@ void draw_object(Base *base) if(paf) { if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */ - if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf); + if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf, dt); else if((G.f & G_PICKSEL) == 0) draw_particle_system(ob, paf); // selection errors happen to easy if(col) cpack(col); } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 5fdd2aa3980..efaadf1615c 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -1865,6 +1865,8 @@ void movetolayer(void) if(islamp && G.vd->drawtype == OB_SHADED) reshadeall_displist(); countall(); + DAG_scene_sort(G.scene); + allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWOOPS, 0);