Timline goodies;

- Mkey while ALT+A inserts markers.
  Note for Matt; You forgot to check for 'val'. The delay in tuho I brought
  back to max 1 frame. Delays are common in realtime gfx apps, the picture
  you see is old, and its possible you press a key while next frame is
  already drawing, and then it has to increase the frame value still... :)

- RMB escapes from anim playback

- on activate object, Timeline redraws too

- Added keyline drawing for Material Ipos. The CTRL+Page keys work with it.

Softbody:

- Renamed buttons to call "Spring constant" now "Stiff(ness)" and the
  "Friction" became "Damping".
This commit is contained in:
2005-05-08 20:10:59 +00:00
parent eec4e32714
commit ef2855bcab
6 changed files with 98 additions and 81 deletions

View File

@@ -2071,6 +2071,20 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
icu= icu->next; icu= icu->next;
} }
} }
else {
for(icu= ipo->curve.first; icu; icu= icu->next) {
if(icu->flag & IPO_VISIBLE) {
bezt= icu->bezt;
if(bezt) {
a= icu->totvert;
while(a--) {
add_to_cfra_elem(elems, bezt);
bezt++;
}
}
}
}
}
if(ipo->showkey==0) { if(ipo->showkey==0) {
/* deselect all keys */ /* deselect all keys */

View File

@@ -1644,18 +1644,18 @@ static void object_softbodies(Object *ob)
} }
MEM_freeN (menustr); MEM_freeN (menustr);
uiDefButF(block, NUM, B_DIFF, "GSpring:", 10,80,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) Spring Constant"); uiDefButF(block, NUM, B_DIFF, "G Stiff:", 10,80,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) spring stiffness");
uiDefButF(block, NUM, B_DIFF, "GFrict:", 160,80,150,20, &sb->goalfrict , 0.0, 10.0, 10, 0, "Goal (vertex target position) Friction Constant"); uiDefButF(block, NUM, B_DIFF, "G Damp:", 160,80,150,20, &sb->goalfrict , 0.0, 10.0, 10, 0, "Goal (vertex target position) friction");
uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMin:", 10,60,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Min Goal bound"); uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Min:", 10,60,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Min Goal bound");
uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMax:", 160,60,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Max Goal bound"); uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Max:", 160,60,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Max Goal bound");
uiBlockEndAlign(block); uiBlockEndAlign(block);
/* EDGE SPRING STUFF */ /* EDGE SPRING STUFF */
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges", 10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Use Robust 2nd order solver"); uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges", 10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Use Robust 2nd order solver");
uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads", 160,30,150,20, &ob->softflag, 0, 0, 0, 0, "Sets object to have diagonal springs on 4-gons"); uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads", 160,30,150,20, &ob->softflag, 0, 0, 0, 0, "Sets object to have diagonal springs on 4-gons");
uiDefButF(block, NUM, B_DIFF, "ESpring:", 10,10,150,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge Spring Constant"); uiDefButF(block, NUM, B_DIFF, "E Stiff:", 10,10,150,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge spring stiffness");
uiDefButF(block, NUM, B_DIFF, "EFrict:", 160,10,150,20, &sb->infrict, 0.0, 10.0, 10, 0, "Edge Friction Constant"); uiDefButF(block, NUM, B_DIFF, "E Damp:", 160,10,150,20, &sb->infrict, 0.0, 10.0, 10, 0, "Edge friction");
uiBlockEndAlign(block); uiBlockEndAlign(block);
} }
} }

View File

@@ -43,12 +43,14 @@
#include "DNA_action_types.h" #include "DNA_action_types.h"
#include "DNA_ipo_types.h" #include "DNA_ipo_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
#include "DNA_space_types.h" #include "DNA_space_types.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "BKE_ipo.h" #include "BKE_ipo.h"
#include "BKE_object.h" #include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "BKE_global.h" #include "BKE_global.h"
@@ -200,7 +202,8 @@ static void draw_ob_keys()
Object *ob; Object *ob;
bActionChannel *achan; bActionChannel *achan;
bAction *act; bAction *act;
int ipoflag; ListBase elems;
int a;
char col[3]; char col[3];
if (OBACT) { if (OBACT) {
@@ -210,27 +213,14 @@ static void draw_ob_keys()
if(ob!=G.obedit) { if(ob!=G.obedit) {
if(ob->ipo) { if(ob->ipo) {
/* convert the ipo to a list of 'current frame elements' */ /* convert the ipo to a list of 'current frame elements' */
ListBase elems;
elems.first= elems.last= NULL; elems.first= elems.last= NULL;
make_cfra_list(ob->ipo, &elems); make_cfra_list(ob->ipo, &elems);
/* disable time offset for the purposes of drawing the frame ticks */
ipoflag= ob->ipoflag;
ob->ipoflag &= ~OB_OFFS_OB;
set_no_parent_ipo(1);
disable_speed_curve(1);
/* draw the list of current frame elements */ /* draw the list of current frame elements */
col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00; col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00;
draw_key_list(elems, col); draw_key_list(elems, col);
set_no_parent_ipo(0);
disable_speed_curve(0);
ob->ipoflag= ipoflag;
BLI_freelistN(&elems); BLI_freelistN(&elems);
} }
@@ -240,7 +230,6 @@ static void draw_ob_keys()
/* go through each channel in the action */ /* go through each channel in the action */
for (achan=act->chanbase.first; achan; achan=achan->next){ for (achan=act->chanbase.first; achan; achan=achan->next){
/* convert the ipo to a list of 'current frame elements' */ /* convert the ipo to a list of 'current frame elements' */
ListBase elems;
elems.first= elems.last= NULL; elems.first= elems.last= NULL;
make_cfra_list(achan->ipo, &elems); make_cfra_list(achan->ipo, &elems);
@@ -251,6 +240,21 @@ static void draw_ob_keys()
BLI_freelistN(&elems); BLI_freelistN(&elems);
} }
} }
for(a=0; a<ob->totcol; a++) {
Material *ma= give_current_material(ob, a+1);
if(ma && ma->ipo) {
elems.first= elems.last= NULL;
make_cfra_list(ma->ipo, &elems);
col[0] = 0xDD; col[1] = 0xA7; col[2] = 0x00;
draw_key_list(elems, col);
BLI_freelistN(&elems);
}
}
} }
} }
} }

View File

@@ -110,12 +110,13 @@
#include "BDR_editobject.h" #include "BDR_editobject.h"
#include "BDR_vpaint.h" #include "BDR_vpaint.h"
#include "BSE_view.h"
#include "BSE_drawview.h" #include "BSE_drawview.h"
#include "BSE_filesel.h"
#include "BSE_headerbuttons.h" #include "BSE_headerbuttons.h"
#include "BSE_seqaudio.h" #include "BSE_seqaudio.h"
#include "BSE_filesel.h"
#include "BSE_trans_types.h" #include "BSE_trans_types.h"
#include "BSE_time.h"
#include "BSE_view.h"
#include "RE_renderconverter.h" #include "RE_renderconverter.h"
@@ -2389,12 +2390,10 @@ int play_anim(int mode)
while(TRUE) { while(TRUE) {
inner_play_anim_loop(0, 0);
screen_swapbuffers();
while(qtest()) { while(qtest()) {
/* we test events first because of MKEY event */
event= extern_qread(&val); event= extern_qread(&val);
if(event==ESCKEY) break; if(event==ESCKEY) break;
else if(event==MIDDLEMOUSE) { else if(event==MIDDLEMOUSE) {
@@ -2409,8 +2408,14 @@ int play_anim(int mode)
else viewmove(0); else viewmove(0);
} }
} }
else if(event==MKEY) {
if(val) add_timeline_marker(CFRA-1);
}
} }
if(event==ESCKEY || event==SPACEKEY) break; if(ELEM3(event, ESCKEY, SPACEKEY, RIGHTMOUSE)) break;
inner_play_anim_loop(0, 0);
screen_swapbuffers();
if((mode > 1) && CFRA==EFRA) break; /* no replay */ if((mode > 1) && CFRA==EFRA) break; /* no replay */
} }

View File

@@ -48,6 +48,7 @@
#include "DNA_action_types.h" #include "DNA_action_types.h"
#include "DNA_ipo_types.h" #include "DNA_ipo_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_space_types.h" #include "DNA_space_types.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
@@ -57,6 +58,7 @@
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_library.h" #include "BKE_library.h"
#include "BIF_space.h" #include "BIF_space.h"
@@ -221,15 +223,38 @@ static int float_to_frame(float frame)
return to; return to;
} }
static float find_closest_cfra_elem(ListBase elems, int dir, float closest)
{
CfraElem *ce;
for(ce= elems.first; ce; ce= ce->next) {
if (dir==-1) {
if( float_to_frame(ce->cfra)<CFRA) {
if ((ce->cfra > closest) || (closest == CFRA)) {
closest= ce->cfra;
}
}
}
else {
if(float_to_frame(ce->cfra)>CFRA) {
if ((ce->cfra < closest) || (closest == CFRA)) {
closest= ce->cfra;
}
}
}
}
return closest;
}
void nextprev_timeline_key(short dir) void nextprev_timeline_key(short dir)
{ {
/*mostly copied from drawobject.c, draw_object() AND editipo.c, movekey_obipo() */ /*mostly copied from drawobject.c, draw_object() AND editipo.c, movekey_obipo() */
Object *ob; Object *ob;
bActionChannel *achan; bActionChannel *achan;
bAction *act; bAction *act;
CfraElem *ce; ListBase elems;
float closest= CFRA;
int a; int a;
float toframe= CFRA;
if (OBACT) { if (OBACT) {
ob = OBACT; ob = OBACT;
@@ -238,37 +263,12 @@ void nextprev_timeline_key(short dir)
if(ob!=G.obedit) { if(ob!=G.obedit) {
if(ob->ipo) { if(ob->ipo) {
/* convert the ipo to a list of 'current frame elements' */ /* convert the ipo to a list of 'current frame elements' */
ListBase elems;
elems.first= elems.last= 0; elems.first= elems.last= NULL;
make_cfra_list(ob->ipo, &elems); make_cfra_list(ob->ipo, &elems);
/* disable time offset for the purposes of drawing the frame ticks */ closest= find_closest_cfra_elem(elems, dir, closest);
/* ipoflag= ob->ipoflag;
ob->ipoflag &= ~OB_OFFS_OB;
set_no_parent_ipo(1);
disable_speed_curve(1); */
/* go through the list and decide if we can find a new keyframe to visit */
if(elems.first) {
ce= elems.first;
if (dir==-1) {
while (ce && float_to_frame(ce->cfra)<CFRA) {
toframe= ce->cfra;
ce= ce->next;
}
} else {
while (ce && float_to_frame(ce->cfra)<=CFRA) {
ce= ce->next;
}
if (ce) toframe= ce->cfra;
}
}
/*set_no_parent_ipo(0);
disable_speed_curve(0);
ob->ipoflag= ipoflag; */
BLI_freelistN(&elems); BLI_freelistN(&elems);
} }
@@ -277,38 +277,31 @@ void nextprev_timeline_key(short dir)
/* go through each channel in the action */ /* go through each channel in the action */
for (achan=act->chanbase.first; achan; achan=achan->next){ for (achan=act->chanbase.first; achan; achan=achan->next){
/* convert the ipo to a list of 'current frame elements' */ /* convert the ipo to a list of 'current frame elements' */
ListBase elems;
elems.first= elems.last= 0; elems.first= elems.last= NULL;
make_cfra_list(achan->ipo, &elems); make_cfra_list(achan->ipo, &elems);
/* go through the list and decide if we can find a new keyframe to visit */ closest= find_closest_cfra_elem(elems, dir, closest);
if(elems.first) {
ce= elems.first; BLI_freelistN(&elems);
if (dir==-1) { }
while (ce && float_to_frame(ce->cfra)<CFRA) { }
if ((ce->cfra > toframe) || (toframe == CFRA)) {
toframe= ce->cfra; for(a=0; a<ob->totcol; a++) {
} Material *ma= give_current_material(ob, a+1);
ce= ce->next; if(ma && ma->ipo) {
} elems.first= elems.last= NULL;
} else { make_cfra_list(ma->ipo, &elems);
while (ce && float_to_frame(ce->cfra)<=CFRA) {
ce= ce->next; closest= find_closest_cfra_elem(elems, dir, closest);
}
if (ce) {
if ((ce->cfra < toframe) || (toframe == CFRA))
toframe= ce->cfra;
}
}
}
BLI_freelistN(&elems); BLI_freelistN(&elems);
} }
} }
} }
} }
a= float_to_frame(toframe); a= float_to_frame(closest);
if (a!=CFRA) { if (a!=CFRA) {
CFRA= a; CFRA= a;

View File

@@ -1170,6 +1170,7 @@ void mouse_select(void)
allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWACTION, 0); allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
allqueue(REDRAWTIME, 0);
allqueue(REDRAWHEADERS, 0); /* To force display update for the posebutton */ allqueue(REDRAWHEADERS, 0); /* To force display update for the posebutton */
} }