More Orange NLA/Action fixes;

- NLA: Hotkey ALT+S resets (synchs) action start/end in selected Strips
- NLA: Panel for Strips allow setting negative "Action start"
- NLA: When transforming strips, the selected keys for that action don't
  get included (caused weird errors)
- Action: cleanup of drawing horizontal bars.
- Action: Pulldown menu option "Lock time" was in different location than
  for the other pulldowns
This commit is contained in:
Ton Roosendaal 2005-10-26 21:13:00 +00:00
parent 79f6a4b822
commit f59827f346
4 changed files with 111 additions and 59 deletions

@ -370,7 +370,7 @@ static void draw_channel_strips(SpaceAction *saction)
bActionChannel *chan; bActionChannel *chan;
bConstraintChannel *conchan; bConstraintChannel *conchan;
float y; float y;
int act_end, dummy; int act_start, act_end, dummy;
char col1[3], col2[3]; char col1[3], col2[3];
BIF_GetThemeColor3ubv(TH_SHADE2, col2); BIF_GetThemeColor3ubv(TH_SHADE2, col2);
@ -390,46 +390,60 @@ static void draw_channel_strips(SpaceAction *saction)
if (G.saction->pin==0 && OBACT) if (G.saction->pin==0 && OBACT)
map_active_strip(di, OBACT, 0); map_active_strip(di, OBACT, 0);
y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); /* start and end of action itself */
gla2DDrawTranslatePt(di, calc_action_start(act), 0, &act_start, &dummy);
/* end of action itself */
gla2DDrawTranslatePt(di, calc_action_end(act), 0, &act_end, &dummy); gla2DDrawTranslatePt(di, calc_action_end(act), 0, &act_end, &dummy);
if (G.saction->pin==0 && OBACT)
map_active_strip(di, OBACT, 1);
/* first backdrop strips */
y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP);
glEnable(GL_BLEND);
for (chan=act->chanbase.first; chan; chan=chan->next){ for (chan=act->chanbase.first; chan; chan=chan->next){
int frame1_x, channel_y; int frame1_x, channel_y;
gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); gla2DDrawTranslatePt(di, G.v2d->cur.xmin, y, &frame1_x, &channel_y);
glEnable(GL_BLEND);
if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22); if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
else glColor4ub(col2[0], col2[1], col2[2], 0x22); else glColor4ub(col2[0], col2[1], col2[2], 0x22);
glRectf(0, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2); glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2);
if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x44); if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
else glColor4ub(col2[0], col2[1], col2[2], 0x44); else glColor4ub(col2[0], col2[1], col2[2], 0x22);
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2); glRectf(act_start, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2);
glDisable(GL_BLEND);
draw_ipo_channel(di, chan->ipo, 0, y);
/* Increment the step */ /* Increment the step */
y-=CHANNELHEIGHT+CHANNELSKIP; y-=CHANNELHEIGHT+CHANNELSKIP;
/* Draw constraint channels */ /* Draw constraint channels */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){ for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
glEnable(GL_BLEND);
if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22); if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
else glColor4ub(col2[0], col2[1], col2[2], 0x22); else glColor4ub(col2[0], col2[1], col2[2], 0x22);
glRectf(0, channel_y-CHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2-4); glRectf(frame1_x, channel_y-CHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2-4);
if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x44); if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
else glColor4ub(col2[0], col2[1], col2[2], 0x44); else glColor4ub(col2[0], col2[1], col2[2], 0x22);
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2+4, act_end, channel_y+CHANNELHEIGHT/2-4); glRectf(act_start, channel_y-CHANNELHEIGHT/2+4, act_end, channel_y+CHANNELHEIGHT/2-4);
glDisable(GL_BLEND);
y-=CHANNELHEIGHT+CHANNELSKIP;
}
}
glDisable(GL_BLEND);
if (G.saction->pin==0 && OBACT)
map_active_strip(di, OBACT, 0);
/* dot thingies */
y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP);
for (chan=act->chanbase.first; chan; chan=chan->next){
draw_ipo_channel(di, chan->ipo, 0, y);
y-=CHANNELHEIGHT+CHANNELSKIP;
/* Draw constraint channels */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
draw_ipo_channel(di, conchan->ipo, 0, y); draw_ipo_channel(di, conchan->ipo, 0, y);
y-=CHANNELHEIGHT+CHANNELSKIP; y-=CHANNELHEIGHT+CHANNELSKIP;
} }

@ -465,8 +465,8 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES
uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, -1000.0, MAXFRAMEF, 100, 0, "Last frame in the timeline"); uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, -1000.0, MAXFRAMEF, 100, 0, "Last frame in the timeline");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, 1.0, MAXFRAMEF, 100, 0, "First frame of the action to map to the playrange"); uiDefButF(block, NUM, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, -1000.0, MAXFRAMEF, 100, 0, "First frame of the action to map to the playrange");
uiDefButF(block, NUM, B_REDR, "Action End:", 160,120,150,19, &strip->actend, 1.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange"); uiDefButF(block, NUM, B_REDR, "Action End:", 160,120,150,19, &strip->actend, -1000.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, strip->actend-strip->actstart, 100, 0, "Number of frames of ease-in"); uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, strip->actend-strip->actstart, 100, 0, "Number of frames of ease-in");

@ -176,6 +176,23 @@ void shift_nlastrips_down(void) {
allqueue (REDRAWNLA, 0); allqueue (REDRAWNLA, 0);
} }
static void reset_action_strips(void)
{
Base *base;
bActionStrip *strip;
for (base=G.scene->base.first; base; base=base->next) {
for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
if (strip->flag & ACTSTRIP_SELECT) {
strip->actstart = calc_action_start(strip->act);
strip->actend = calc_action_end(strip->act);
}
}
}
BIF_undo_push("Reset NLA strips");
allqueue (REDRAWNLA, 0);
}
void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
{ {
unsigned short event= evt->event; unsigned short event= evt->event;
@ -273,9 +290,15 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case SKEY: case SKEY:
if (mval[0]>=NLAWIDTH) if(G.qual==LR_ALTKEY) {
transform_nlachannel_keys ('s', 0); if(okee("Reset Action Strips start/end"))
update_for_newframe_muted(); reset_action_strips();
}
else {
if (mval[0]>=NLAWIDTH)
transform_nlachannel_keys ('s', 0);
update_for_newframe_muted();
}
break; break;
case DELKEY: case DELKEY:
@ -789,21 +812,19 @@ void transform_nlachannel_keys(int mode, int dummy)
{ {
Base *base; Base *base;
TransVert *tv; TransVert *tv;
int /*sel=0,*/ i;
short mvals[2], mvalc[2];
// short cent[2];
float sval[2], cval[2], lastcval[2];
short cancel=0;
float fac=0.0F;
int loop=1;
int tvtot=0;
float deltax, startx;
// float cenf[2];
int invert=0, firsttime=1;
char str[256];
bActionChannel *chan; bActionChannel *chan;
bActionStrip *strip; bActionStrip *strip;
bConstraintChannel *conchan; bConstraintChannel *conchan;
float sval[2], cval[2], lastcval[2];
float fac=0.0F;
float deltax, startx;
int i;
int loop=1;
int tvtot=0;
int invert=0, firsttime=1;
short mvals[2], mvalc[2];
short cancel=0;
char str[256];
/* Ensure that partial selections result in beztriple selections */ /* Ensure that partial selections result in beztriple selections */
for (base=G.scene->base.first; base; base=base->next){ for (base=G.scene->base.first; base; base=base->next){
@ -817,14 +838,22 @@ void transform_nlachannel_keys(int mode, int dummy)
/* Check action ipos */ /* Check action ipos */
if (base->object->action){ if (base->object->action){
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){ /* exclude if strip is selected too */
tvtot+=fullselect_ipo_keys(chan->ipo); for (strip=base->object->nlastrips.first; strip; strip=strip->next){
if (strip->flag & ACTSTRIP_SELECT)
/* Check action constraint ipos */ if(strip->act==base->object->action)
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) break;
tvtot+=fullselect_ipo_keys(conchan->ipo);
} }
if(strip==NULL) {
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
tvtot+=fullselect_ipo_keys(chan->ipo);
/* Check action constraint ipos */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
tvtot+=fullselect_ipo_keys(conchan->ipo);
}
}
} }
/* Check nlastrips */ /* Check nlastrips */
@ -852,12 +881,21 @@ void transform_nlachannel_keys(int mode, int dummy)
/* Manipulate action ipos */ /* Manipulate action ipos */
if (base->object->action){ if (base->object->action){
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){ /* exclude if strip is selected too */
tvtot=add_trans_ipo_keys(chan->ipo, tv, tvtot); for (strip=base->object->nlastrips.first; strip; strip=strip->next){
if (strip->flag & ACTSTRIP_SELECT)
if(strip->act==base->object->action)
break;
}
if(strip==NULL) {
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
tvtot=add_trans_ipo_keys(chan->ipo, tv, tvtot);
/* Manipulate action constraint ipos */ /* Manipulate action constraint ipos */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot); tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot);
}
} }
} }

@ -237,11 +237,6 @@ static uiBlock *action_viewmenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_CENTERVIEW, ""); ACTMENU_VIEW_CENTERVIEW, "");
uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Lock Time to Other Windows|", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_LOCK, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@ -270,6 +265,11 @@ static uiBlock *action_viewmenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_ALL, ""); ACTMENU_VIEW_ALL, "");
uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Lock Time to Other Windows|", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_LOCK, "");
if (!curarea->full) if (!curarea->full)
uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1,
"Maximize Window|Ctrl UpArrow", 0, yco-=20, "Maximize Window|Ctrl UpArrow", 0, yco-=20,