diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index 8e6b1934f4d..f76bc3c7cbe 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -370,7 +370,7 @@ static void draw_channel_strips(SpaceAction *saction) bActionChannel *chan; bConstraintChannel *conchan; float y; - int act_end, dummy; + int act_start, act_end, dummy; char col1[3], col2[3]; BIF_GetThemeColor3ubv(TH_SHADE2, col2); @@ -390,46 +390,60 @@ static void draw_channel_strips(SpaceAction *saction) if (G.saction->pin==0 && OBACT) map_active_strip(di, OBACT, 0); - y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP); - - /* end of action itself */ + /* start and end of action itself */ + gla2DDrawTranslatePt(di, calc_action_start(act), 0, &act_start, &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){ int frame1_x, channel_y; - - gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); - - glEnable(GL_BLEND); + + gla2DDrawTranslatePt(di, G.v2d->cur.xmin, y, &frame1_x, &channel_y); + if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[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); - - if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x44); - else glColor4ub(col2[0], col2[1], col2[2], 0x44); - glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2); - glDisable(GL_BLEND); - - draw_ipo_channel(di, chan->ipo, 0, y); - + 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], 0x22); + else glColor4ub(col2[0], col2[1], col2[2], 0x22); + glRectf(act_start, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2); + /* Increment the step */ y-=CHANNELHEIGHT+CHANNELSKIP; - - + /* Draw constraint channels */ for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){ gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); - glEnable(GL_BLEND); if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[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); - else glColor4ub(col2[0], col2[1], col2[2], 0x44); - glRectf(frame1_x, channel_y-CHANNELHEIGHT/2+4, act_end, channel_y+CHANNELHEIGHT/2-4); - glDisable(GL_BLEND); + if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22); + else glColor4ub(col2[0], col2[1], col2[2], 0x22); + glRectf(act_start, channel_y-CHANNELHEIGHT/2+4, act_end, channel_y+CHANNELHEIGHT/2-4); + 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); y-=CHANNELHEIGHT+CHANNELSKIP; } diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index ed85e497dc2..daf66a23cfa 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -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"); 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 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 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, -1000.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange"); 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"); diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index a555686f1c9..a5b46dd0231 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -176,6 +176,23 @@ void shift_nlastrips_down(void) { 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) { unsigned short event= evt->event; @@ -273,9 +290,15 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case SKEY: - if (mval[0]>=NLAWIDTH) - transform_nlachannel_keys ('s', 0); - update_for_newframe_muted(); + if(G.qual==LR_ALTKEY) { + if(okee("Reset Action Strips start/end")) + reset_action_strips(); + } + else { + if (mval[0]>=NLAWIDTH) + transform_nlachannel_keys ('s', 0); + update_for_newframe_muted(); + } break; case DELKEY: @@ -789,21 +812,19 @@ void transform_nlachannel_keys(int mode, int dummy) { Base *base; 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; bActionStrip *strip; 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 */ 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 */ if (base->object->action){ - 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); + /* exclude if strip is selected too */ + 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+=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 */ @@ -852,12 +881,21 @@ void transform_nlachannel_keys(int mode, int dummy) /* Manipulate action ipos */ if (base->object->action){ - for (chan=base->object->action->chanbase.first; chan; chan=chan->next){ - tvtot=add_trans_ipo_keys(chan->ipo, tv, tvtot); + /* exclude if strip is selected too */ + 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 */ - for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) - tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot); + /* Manipulate action constraint ipos */ + for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) + tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot); + } } } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 0ace342a2ae..edd3ed8d164 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -237,11 +237,6 @@ static uiBlock *action_viewmenu(void *arg_unused) menuwidth, 19, NULL, 0.0, 0.0, 1, 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, 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, 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) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20,