diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-05-23 13:21:32 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-05-23 13:21:32 +0400 |
commit | 80914f22ae8ea65c6560202ec05f05150fff6f53 (patch) | |
tree | 0c37578f28f5b590030b90a17174f66100eb1bc3 /source/blender/src | |
parent | 2a63a47a56b01aef20fc389b25471eb68bd3e9b6 (diff) |
== Action Editor ==
Now Action/IPO-Curve/Constraint Channels draw so that they open downwards. The only noticeable differences are that when expanding/collapsing channels, all the channels above won't get shunted out of the way again. Also, on loading some older files, all the channels may be out of view (TODO: make version patch for this...)
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/drawaction.c | 13 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 48 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 8 |
3 files changed, 19 insertions, 50 deletions
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index 52d9f59ae88..fd6f5f8f0b4 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -280,7 +280,7 @@ static void action_icu_buts(SpaceAction *saction) UI_EMBOSS, UI_HELV, curarea->win); x = NAMEWIDTH + 1; - y = count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); + y = 0.0; uiBlockSetEmboss(block, UI_EMBOSSN); @@ -379,7 +379,7 @@ static void draw_action_channel_names(bAction *act) float x, y; x = 0.0; - y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); + y = 0.0f; for (achan=act->chanbase.first; achan; achan= achan->next) { if(VISIBLE_ACHAN(achan)) { @@ -706,7 +706,7 @@ static void draw_channel_strips(SpaceAction *saction) map_active_strip(di, OBACT, 1); /* first backdrop strips */ - y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); + y = 0.0; glEnable(GL_BLEND); for (achan=act->chanbase.first; achan; achan= achan->next) { if(VISIBLE_ACHAN(achan)) { @@ -776,8 +776,8 @@ static void draw_channel_strips(SpaceAction *saction) if (G.saction->pin==0 && OBACT) map_active_strip(di, OBACT, 0); - /* dot thingies */ - y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); + /* keyframes */ + y = 0.0; for (achan= act->chanbase.first; achan; achan= achan->next) { if(VISIBLE_ACHAN(achan)) { @@ -828,8 +828,7 @@ static void draw_channel_strips(SpaceAction *saction) static void draw_mesh_strips(SpaceAction *saction, Key *key) { - /* draw the RVK keyframes as those little square button things - */ + /* draw the RVK keyframes */ rcti scr_rct; gla2DDrawInfo *di; float y, ybase; diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index ea6e65c8ce9..4c698674bbf 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -305,7 +305,6 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_ float xmin, xmax, x, y; float xrange[2]; int clickmin, clickmax; - int wsize; short mval[2]; getmouseco_areawin (mval); @@ -317,16 +316,9 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_ *ret_type= ACTTYPE_NONE; return NULL; } - - /* wsize is the greatest possible height (in pixels) that would be - * needed to draw all of the action channels, ipo-curve channels and constraint - * channels. - */ - wsize = count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); - wsize += CHANNELHEIGHT/2; areamouseco_to_ipoco(G.v2d, mval, &x, &y); - clickmin = (int) ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); clickmax = clickmin; mval[0]-=7; @@ -908,8 +900,7 @@ void borderselect_action(void) rectf.xmax= get_action_frame(OBACT, rectf.xmax); } - ymax = count_action_levels(act) * (CHANNELHEIGHT+CHANNELSKIP); - ymax += CHANNELHEIGHT/2; + ymax = CHANNELHEIGHT/2; for (achan=act->chanbase.first; achan; achan= achan->next) { if(VISIBLE_ACHAN(achan)) { @@ -1865,7 +1856,6 @@ static void borderselect_actionchannels(bAction *act, short *mval, IpoCurve *icu; float click, x,y; int clickmin, clickmax; - int wsize; if (!act) return; @@ -1875,15 +1865,8 @@ static void borderselect_actionchannels(bAction *act, short *mval, selectmode = SELECT_ADD; } - /* wsize is the greatest possible height (in pixels) that would be - * needed to draw all of the action channels and constraint - * channels. - */ - wsize = count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); - wsize += CHANNELHEIGHT/2; - areamouseco_to_ipoco(G.v2d, mval, &x, &y); - clickmin = (int) ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); /* Only one click */ if (mvalo == NULL) { @@ -1892,7 +1875,7 @@ static void borderselect_actionchannels(bAction *act, short *mval, /* Two click values (i.e., border select */ else { areamouseco_to_ipoco(G.v2d, mvalo, &x, &y); - click = ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + click = (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); if ( ((int) click) < clickmin) { clickmax = clickmin; @@ -2781,7 +2764,6 @@ static void select_all_keys_channels(bAction *act, short *mval, bConstraintChannel *conchan; float click, x,y; int clickmin, clickmax; - int wsize; /* This function selects all the action keys that * are in the mouse selection range defined by @@ -2800,17 +2782,9 @@ static void select_all_keys_channels(bAction *act, short *mval, deselect_actionchannel_keys(act, 0, 0); selectmode = SELECT_ADD; } - - /* wsize is the greatest possible height (in pixels) that would be - * needed to draw all of the action channels and constraint - * channels. - */ - - wsize = count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); - wsize += CHANNELHEIGHT/2; areamouseco_to_ipoco(G.v2d, mval, &x, &y); - clickmin = (int) ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); /* Only one click */ if (mvalo == NULL) { @@ -2819,7 +2793,7 @@ static void select_all_keys_channels(bAction *act, short *mval, /* Two click values (i.e., border select) */ else { areamouseco_to_ipoco(G.v2d, mvalo, &x, &y); - click = ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + click = (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); if ( ((int) click) < clickmin) { clickmax = clickmin; @@ -3611,22 +3585,14 @@ void *get_nearest_act_channel(short mval[], short *ret_type) float x,y; int clickmin, clickmax; - int wsize; if (act == NULL) { *ret_type= ACTTYPE_NONE; return NULL; } - /* wsize is the greatest possible height (in pixels) that would be - * needed to draw all of the groups, action channels and constraint - * channels. - */ - wsize = count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); - wsize += CHANNELHEIGHT/2; - areamouseco_to_ipoco(G.v2d, mval, &x, &y); - clickmin = (int) ((wsize - y) / (CHANNELHEIGHT+CHANNELSKIP)); + clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP)); clickmax = clickmin; if (clickmax < 0) { diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index ee2bb71d9e1..14a62d67231 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -69,6 +69,7 @@ #include "BKE_main.h" #include "BKE_utildefines.h" +#include "BDR_drawaction.h" #include "BSE_drawipo.h" #include "BSE_headerbuttons.h" #include "BSE_time.h" @@ -173,13 +174,16 @@ void do_action_buttons(unsigned short event) G.v2d->cur.xmax= -5; G.v2d->cur.xmax= 100; } + + G.v2d->cur.ymin= -(count_action_levels(G.saction->action)*(CHANNELHEIGHT+CHANNELSKIP)); + G.v2d->cur.ymax= 0; } else { /* shapekeys and/or no action */ G.v2d->cur.xmax= -5; G.v2d->cur.xmax= 100; + G.v2d->cur.ymax= 1000; + G.v2d->cur.ymin= 0; } - G.v2d->cur.ymin= 0.0f; - G.v2d->cur.ymax= 1000.0f; G.v2d->tot= G.v2d->cur; test_view2d(G.v2d, curarea->winx, curarea->winy); |