diff options
author | Ton Roosendaal <ton@blender.org> | 2005-10-10 21:42:48 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-10-10 21:42:48 +0400 |
commit | 87365d8d407d5cfddcfa48f1dc3902f7f1a3fa5b (patch) | |
tree | a43ae94a544511409f44b9d08e828a6eedfcf123 /source/blender/src/drawnla.c | |
parent | ad915277a0d7be10889cf8d00ce392b4800ca0d5 (diff) |
Stage two of the giant animation recode project; Ipo/Action/NLA cleanup
-> Note; added 2 new c files (split editipo.c). MSVC needs upgrade.
Impatient people can check the goodies in CMS:
http://www.blender3d.org/cms/Action_and_NLA_editor.706.0.html
Most work was on trying to unwind the spaghetti for editing ipos. Too much
history and bad design got added here. Most evident changes:
- made generic 'context' for detecting which Ipo is being edited, or to
assign ipos or to retrieve ipo curves.
- made generic insertkey() for all ipo types, including actions
- shuffled a lot of code around to make things more logical. Also made
sure local functions are not exported
It is far from ready... when action/nla was added in Blender, a lot of
duplicate code was generated. That's for another time.
Now the goodies;
- made Actions to allow any Ipo type
- made NLA to define active actions, for Action window too
- corrected timing for active action, so it shows the 'real time', as
defined in NLA editor.
I did update python code, but that would require testing. Testing is
needed for this commit in general, too many changes happened on all
levels of the animation system. :)
Will keep track of all reports this evening, hopefully it doesnt break
the pre-release schedule!
Diffstat (limited to 'source/blender/src/drawnla.c')
-rw-r--r-- | source/blender/src/drawnla.c | 419 |
1 files changed, 190 insertions, 229 deletions
diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index 98969f795bf..120ce5c3d8d 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -56,6 +56,8 @@ #include "BLI_blenlib.h" #include "MEM_guardedalloc.h" + +#include "BKE_action.h" #include "BKE_global.h" #include "BSE_drawnla.h" @@ -77,24 +79,16 @@ #include "blendef.h" #include "mydevice.h" -/* Local function prototypes */ -static void draw_nlastrips(SpaceNla *snla); -static void draw_nlatree(void); - -int count_nla_levels(void); -int nla_filter (Base* base, int flags); - #define TESTBASE_SAFE(base) ((base)->flag & SELECT) -/* Implementation */ -static void draw_nlatree(void) +/* the left hand side with channels only */ +static void draw_nla_channels(void) { - - short ofsx, ofsy = 0; + bActionStrip *strip; Base *base; + Object *ob; float x, y; - bActionStrip *strip; - bConstraintChannel *conchan; + short ofsx, ofsy = 0; myortho2(0, NLAWIDTH, G.v2d->cur.ymin, G.v2d->cur.ymax); // Scaling @@ -111,14 +105,13 @@ static void draw_nlatree(void) glColor3ub(0x00, 0x00, 0x00); x = 0.0; - y = count_nla_levels(); - y*= (NLACHANNELHEIGHT+NLACHANNELSKIP); - for (base=G.scene->base.first; base; base=base->next){ - if (nla_filter(base, 0)){ + if (nla_filter(base)) { + ob= base->object; + BIF_ThemeColorShade(TH_HEADER, 20); glRectf(x, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2); @@ -127,63 +120,56 @@ static void draw_nlatree(void) BIF_ThemeColor(TH_TEXT_HI); else BIF_ThemeColor(TH_TEXT); - glRasterPos2f(x+16, y-4); + glRasterPos2f(x+21, y-4); - BMF_DrawString(G.font, base->object->id.name+2); + BMF_DrawString(G.font, ob->id.name+2); - /* Draw the constraint ipos */ - for (conchan = base->object->constraintChannels.first; conchan; conchan=conchan->next){ - y-=NLACHANNELHEIGHT+NLACHANNELSKIP; - BIF_ThemeColorShade(TH_HEADER, -30); + /* icon to indicate nla or action */ + if(ob->nlastrips.first && ob->action) { + if(ob->nlaflag & OB_NLA_OVERRIDE) + BIF_draw_icon(x+5, y-8, ICON_NLA); + else + BIF_draw_icon(x+5, y-8, ICON_ACTION); + } + y-=NLACHANNELHEIGHT+NLACHANNELSKIP; + + /* Draw the action timeline */ + if (ob->action){ + BIF_ThemeColorShade(TH_HEADER, -20); glRectf(x+16, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2); - - if (conchan->flag & CONSTRAINT_CHANNEL_SELECT) + + if (TESTBASE_SAFE(base)) BIF_ThemeColor(TH_TEXT_HI); else BIF_ThemeColor(TH_TEXT); - glRasterPos2f(x+32, y-4); - BMF_DrawString(G.font, conchan->name); - } - - /* Draw the action timeline */ - if (ACTIVE_ARMATURE(base)){ - BIF_draw_icon(x, y-8, ICON_DOWNARROW_HLT); - y-=NLACHANNELHEIGHT+NLACHANNELSKIP; + BMF_DrawString(G.font, ob->action->id.name+2); - if (base->object->action){ - BIF_ThemeColorShade(TH_HEADER, -30); - glRectf(x+16, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2); - - if (TESTBASE_SAFE(base)) - BIF_ThemeColor(TH_TEXT_HI); - else - BIF_ThemeColor(TH_TEXT); - glRasterPos2f(x+32, y-4); - BMF_DrawString(G.font, base->object->action->id.name+2); - } + y-=NLACHANNELHEIGHT+NLACHANNELSKIP; } - y-=NLACHANNELHEIGHT+NLACHANNELSKIP; /* Draw the nla strips */ - if (base->object->type==OB_ARMATURE){ - for (strip = base->object->nlastrips.first; strip; strip=strip->next){ - BIF_ThemeColorShade(TH_HEADER, -50); - glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2); - - if (TESTBASE_SAFE(base)) - BIF_ThemeColor(TH_TEXT_HI); - else - BIF_ThemeColor(TH_TEXT); - - // why this test? check freeing mem when deleting strips? (ton) - if(strip->act) { - glRasterPos2f(x+48, y-4); - BMF_DrawString(G.font, strip->act->id.name+2); - - y-=(NLACHANNELHEIGHT+NLACHANNELSKIP); + for (strip = ob->nlastrips.first; strip; strip=strip->next){ + BIF_ThemeColorShade(TH_HEADER, -40); + glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2); + + if (TESTBASE_SAFE(base)) + BIF_ThemeColor(TH_TEXT_HI); + else + BIF_ThemeColor(TH_TEXT); + + // why this test? check freeing mem when deleting strips? (ton) + if(strip->act) { + glRasterPos2f(x+48, y-4); + BMF_DrawString(G.font, strip->act->id.name+2); + + if(strip->flag & ACTSTRIP_ACTIVE) { + glEnable(GL_BLEND); + BIF_draw_icon_blended(x+16, y-8, ICON_DOT, TH_BACK, 0); + glDisable(GL_BLEND); } } + y-=(NLACHANNELHEIGHT+NLACHANNELSKIP); } } } @@ -191,12 +177,29 @@ static void draw_nlatree(void) myortho2(0, NLAWIDTH, 0, ( ofsy+G.v2d->mask.ymax)-( ofsy+G.v2d->mask.ymin)); // Scaling } -static void draw_nlastrips(SpaceNla *snla) +void map_active_strip(gla2DDrawInfo *di, Object *ob, int restore) { + static rctf stored; + + if(restore) + gla2DSetMap(di, &stored); + else { + rctf map; + + gla2DGetMap(di, &stored); + map= stored; + map.xmin= get_action_frame(ob, map.xmin); + map.xmax= get_action_frame(ob, map.xmax); + gla2DSetMap(di, &map); + } +} + +/* the right hand side, with strips and keys */ +static void draw_nla_strips_keys(SpaceNla *snla) +{ + Base *base; rcti scr_rct; gla2DDrawInfo *di; - Base *base; - bConstraintChannel *conchan; float y; char col1[3], col2[3]; @@ -205,7 +208,7 @@ static void draw_nlastrips(SpaceNla *snla) /* Draw strips */ - scr_rct.xmin= snla->area->winrct.xmin + NLAWIDTH; + scr_rct.xmin= snla->area->winrct.xmin + snla->v2d.mask.xmin; scr_rct.ymin= snla->area->winrct.ymin + snla->v2d.mask.ymin; scr_rct.xmax= snla->area->winrct.xmin + snla->v2d.hor.xmax; scr_rct.ymax= snla->area->winrct.ymin + snla->v2d.mask.ymax; @@ -215,13 +218,12 @@ static void draw_nlastrips(SpaceNla *snla) y*= (NLACHANNELHEIGHT+NLACHANNELSKIP); for (base=G.scene->base.first; base; base=base->next){ - Object *ob; + Object *ob= base->object; bActionStrip *strip; int frame1_x, channel_y; - ob=base->object; - - if (nla_filter(base, 0)){ + if (nla_filter(base)) { + /* Draw the field */ glEnable (GL_BLEND); if (TESTBASE_SAFE(base)) @@ -241,42 +243,14 @@ static void draw_nlastrips(SpaceNla *snla) glDisable (GL_BLEND); - /* Draw the ipo */ + /* Draw the ipo keys */ draw_object_channel(di, ob, 0, y); - y-=NLACHANNELHEIGHT+NLACHANNELSKIP; - /* Draw the constraints */ - for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next){ - glEnable (GL_BLEND); - if (conchan->flag & CONSTRAINT_CHANNEL_SELECT) - glColor4ub (col1[0], col1[1], col1[2], 0x22); - else - glColor4ub (col2[0], col2[1], col2[2], 0x22); - - gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); - glRectf(0, channel_y-NLACHANNELHEIGHT/2+4, frame1_x, channel_y+NLACHANNELHEIGHT/2-4); - - - if (conchan->flag & CONSTRAINT_CHANNEL_SELECT) - glColor4ub (col1[0], col1[1], col1[2], 0x44); - else - glColor4ub (col2[0], col2[1], col2[2], 0x44); - glRectf(frame1_x, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-4); - - glDisable (GL_BLEND); - - /* Draw the ipo */ - draw_ipo_channel(di, conchan->ipo, 0, y); - y-=NLACHANNELHEIGHT+NLACHANNELSKIP; - - } + y-=NLACHANNELHEIGHT+NLACHANNELSKIP; } - - - - + /* Draw the action strip */ - if (ACTIVE_ARMATURE(base)){ + if (ob->action){ /* Draw the field */ glEnable (GL_BLEND); @@ -284,10 +258,10 @@ static void draw_nlastrips(SpaceNla *snla) glColor4ub (col1[0], col1[1], col1[2], 0x22); else glColor4ub (col2[0], col2[1], col2[2], 0x22); + gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y); glRectf(0, channel_y-NLACHANNELHEIGHT/2+4, frame1_x, channel_y+NLACHANNELHEIGHT/2-4); - if (TESTBASE_SAFE(base)) glColor4ub (col1[0], col1[1], col1[2], 0x44); else @@ -296,107 +270,108 @@ static void draw_nlastrips(SpaceNla *snla) glDisable (GL_BLEND); - /* Draw the action keys */ + /* Draw the action keys, optionally corrected for active strip */ + map_active_strip(di, ob, 0); draw_action_channel(di, ob->action, 0, y); - + map_active_strip(di, ob, 1); + y-=NLACHANNELHEIGHT+NLACHANNELSKIP; } /* Draw the nla strips */ - if (ob->type==OB_ARMATURE){ - for (strip=ob->nlastrips.first; strip; strip=strip->next){ - int stripstart, stripend; - int blendstart, blendend; - unsigned char r, g, b; - - /* Draw rect */ - if (strip->flag & ACTSTRIP_SELECT){ - r= 0xff; g= 0xff; b= 0xaa; - } - else{ - r= 0xe4; g= 0x9c; b= 0xc6; - } - - glColor4ub (r, g, b, 0xFF); + for (strip=ob->nlastrips.first; strip; strip=strip->next){ + int stripstart, stripend; + int blendstart, blendend; + + /* Draw rect */ + if (strip->flag & ACTSTRIP_SELECT) + BIF_ThemeColor(TH_STRIP_SELECT); + else + BIF_ThemeColor(TH_STRIP); + + gla2DDrawTranslatePt(di, strip->start+strip->blendin, y, &stripstart, &channel_y); + gla2DDrawTranslatePt(di, strip->end-strip->blendout, y, &stripend, &channel_y); + glRectf(stripstart, channel_y-NLACHANNELHEIGHT/2+3, stripend, channel_y+NLACHANNELHEIGHT/2-3); + + if (strip->flag & ACTSTRIP_SELECT) + BIF_ThemeColorShade(TH_STRIP_SELECT, -60); + else + BIF_ThemeColorShade(TH_STRIP, -60); + + /* Draw blendin */ + if (strip->blendin>0){ + glBegin(GL_TRIANGLES); - gla2DDrawTranslatePt(di, strip->start+strip->blendin, y, &stripstart, &channel_y); - gla2DDrawTranslatePt(di, strip->end-strip->blendout, y, &stripend, &channel_y); - glRectf(stripstart, channel_y-NLACHANNELHEIGHT/2+3, stripend, channel_y+NLACHANNELHEIGHT/2-3); + gla2DDrawTranslatePt(di, strip->start, y, &blendstart, &channel_y); + glVertex2f(blendstart, channel_y-NLACHANNELHEIGHT/2+3); + glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3); + glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); - /* Draw blendin */ - if (strip->blendin>0){ - glBegin(GL_TRIANGLES); - - gla2DDrawTranslatePt(di, strip->start, y, &blendstart, &channel_y); - - glColor4ub (r*0.75, g*0.75, b*0.75, 0xFF); - glVertex2f(blendstart, channel_y-NLACHANNELHEIGHT/2+3); - glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3); - glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); - - - glEnd(); - } - if (strip->blendout>0){ - glBegin(GL_TRIANGLES); - gla2DDrawTranslatePt(di, strip->end, y, &blendend, &channel_y); - glColor4ub (r*0.75, g*0.75, b*0.75, 0xFF); - glVertex2f(blendend, channel_y-NLACHANNELHEIGHT/2+3); - glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3); - glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3); - glEnd(); - } - /* Draw border */ - glBegin(GL_LINE_STRIP); - glColor4f(1, 1, 1, 0.5); - gla2DDrawTranslatePt(di, strip->start, y, &stripstart, &channel_y); - gla2DDrawTranslatePt(di, strip->end, y, &stripend, &channel_y); + glEnd(); + } + if (strip->blendout>0){ + glBegin(GL_TRIANGLES); - glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); - glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3); + gla2DDrawTranslatePt(di, strip->end, y, &blendend, &channel_y); + + glVertex2f(blendend, channel_y-NLACHANNELHEIGHT/2+3); glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3); - glColor4f(0, 0, 0, 0.5); glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3); - glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); glEnd(); - - glEnable (GL_BLEND); + } + + /* Draw border */ + glBegin(GL_LINE_STRIP); + glColor4f(1, 1, 1, 0.5); + gla2DDrawTranslatePt(di, strip->start, y, &stripstart, &channel_y); + gla2DDrawTranslatePt(di, strip->end, y, &stripend, &channel_y); + + glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); + glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3); + glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3); + glColor4f(0, 0, 0, 0.5); + glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3); + glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3); + glEnd(); + + glEnable (GL_BLEND); - /* Show strip extension */ - if (strip->flag & ACTSTRIP_HOLDLASTFRAME){ - glColor4ub (r, g, b, 0x55); - - glRectf(stripend, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-2); - } + /* Show strip extension */ + if (strip->flag & ACTSTRIP_HOLDLASTFRAME){ + if (strip->flag & ACTSTRIP_SELECT) + BIF_ThemeColorShadeAlpha(TH_STRIP_SELECT, 0, -180); + else + BIF_ThemeColorShadeAlpha(TH_STRIP, 0, -180); - /* Show repeat */ - if (strip->repeat > 1.0 && !(strip->flag & ACTSTRIP_USESTRIDE)){ - float rep = 1; - glBegin(GL_LINES); - while (rep<strip->repeat){ - /* Draw line */ - glColor4f(0, 0, 0, 0.5); - gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y); - glVertex2f(frame1_x, channel_y-NLACHANNELHEIGHT/2+4); - glVertex2f(frame1_x, channel_y+NLACHANNELHEIGHT/2-2); - - glColor4f(1.0, 1.0, 1.0, 0.5); - gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y); - glVertex2f(frame1_x+1, channel_y-NLACHANNELHEIGHT/2+4); - glVertex2f(frame1_x+1, channel_y+NLACHANNELHEIGHT/2-2); - rep+=1.0; - } - glEnd(); + glRectf(stripend, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-2); + } + + /* Show repeat */ + if (strip->repeat > 1.0 && !(strip->flag & ACTSTRIP_USESTRIDE)){ + float rep = 1; + glBegin(GL_LINES); + while (rep<strip->repeat){ + /* Draw line */ + glColor4f(0, 0, 0, 0.5); + gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y); + glVertex2f(frame1_x, channel_y-NLACHANNELHEIGHT/2+4); + glVertex2f(frame1_x, channel_y+NLACHANNELHEIGHT/2-2); + glColor4f(1.0, 1.0, 1.0, 0.5); + gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y); + glVertex2f(frame1_x+1, channel_y-NLACHANNELHEIGHT/2+4); + glVertex2f(frame1_x+1, channel_y+NLACHANNELHEIGHT/2-2); + rep+=1.0; } - glDisable (GL_BLEND); + glEnd(); - y-=(NLACHANNELHEIGHT+NLACHANNELSKIP); } + glDisable (GL_BLEND); + y-=(NLACHANNELHEIGHT+NLACHANNELSKIP); } } glaEnd2DDraw(di); @@ -407,18 +382,16 @@ static void draw_nlastrips(SpaceNla *snla) #define B_NLA_PANEL 121 -static bActionStrip *get_active_nlastrip(void) /* For now just returns the first selected strip */ +bActionStrip *get_active_nlastrip(void) { Base *base; bActionStrip *strip; for (base=G.scene->base.first; base; base=base->next){ - if (nla_filter(base, 0) && base->object->type==OB_ARMATURE){ - for (strip=base->object->nlastrips.first; strip; strip=strip->next){ - if (strip->flag & ACTSTRIP_SELECT) - return strip; - } + for (strip=base->object->nlastrips.first; strip; strip=strip->next){ + if (strip->flag & ACTSTRIP_SELECT) + return strip; } } @@ -478,30 +451,30 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES strip = get_active_nlastrip(); if (!strip) return; - // first labels, for simpler align code :) + /* first labels, for simpler align code :) */ uiDefBut(block, LABEL, 0, "Timeline Range:", 10,180,300,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "Action Range:", 10,140,300,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "Blending:", 10,100,300,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "Options:", 10,60,300,19, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, 1.0, MAXFRAMEF, 100, 0, "First frame in the timeline"); - uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, 1.0, MAXFRAMEF, 100, 0, "Last frame in the timeline"); + uiDefButF(block, NUM, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, -1000.0, MAXFRAMEF, 100, 0, "First 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); 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"); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-in"); - uiDefButF(block, NUM, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-out"); + 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, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, strip->actend-strip->actstart, 100, 0, "Number of frames of ease-out"); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, MAXFRAMEF, 100, 0, "Number of times the action should repeat"); - uiDefButF(block, NUM, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, MAXFRAMEF, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range"); + uiDefButF(block, NUM, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, 1000.0f, 100, 0, "Number of times the action should repeat"); + uiDefButF(block, NUM, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, 1000.0, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range"); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride. Only armatures parented to a path"); + uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride"); uiDefButBitS(block, TOG, ACTSTRIP_HOLDLASTFRAME, B_REDR, "Hold", 110,0,100,19, &strip->flag, 0, 0, 0, 0, "Toggles whether to continue displaying the last frame past the end of the strip"); uiDefButS(block, TOG, B_REDR, "Add", 210,0,100,19, &strip->mode, 0, 0, 0, 0, "Toggles additive blending mode"); } @@ -563,8 +536,8 @@ void drawnlaspace(ScrArea *sa, void *spacedata) calc_ipogrid(); draw_ipogrid(); - /* Draw channel strips */ - draw_nlastrips(G.snla); + /* the right hand side, with strips and keys */ + draw_nla_strips_keys(G.snla); /* Draw current frame */ glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); @@ -578,10 +551,10 @@ void drawnlaspace(ScrArea *sa, void *spacedata) myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375); if(G.v2d->scroll) drawscroll(0); } - - /* Draw channel names */ - draw_nlatree(); - + if(G.v2d->mask.xmin!=0) { + /* Draw channel names */ + draw_nla_channels(); + } mywinset(curarea->win); // reset scissor too myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375); draw_area_emboss(sa); @@ -598,48 +571,36 @@ int count_nla_levels(void) Base *base; int y=0; - for (y=0, base=G.scene->base.first; base; base=base->next) - { - if (nla_filter(base,0 )){ - /* Ipo */ + for (y=0, base=G.scene->base.first; base; base=base->next) { + if (nla_filter(base)) { + /* object level */ y++; - /* Constraint channels */ - y+=BLI_countlist(&base->object->constraintChannels); - - if (base->object->type==OB_ARMATURE){ - /* Action */ - if(base->object->action){ - // bActionChannel *achan; - y++; - - // for (achan=base->object->action->chanbase.first; achan; achan=achan->next){ - // y+=BLI_countlist(&achan->constraintChannels); - // } - } - /* Nla strips */ - y+= BLI_countlist(&base->object->nlastrips); - } + + if(base->object->action) + y++; + + /* Nla strips */ + y+= BLI_countlist(&base->object->nlastrips); } } return y; } -int nla_filter (Base* base, int flags) +int nla_filter (Base *base) { Object *ob = base->object; + + if(ob->action || ob->nlastrips.first) + return 1; - /* Only objects with ipos */ + /* should become option */ if (ob->ipo) return 1; if (ob->constraintChannels.first) return 1; - /* Only armatures */ - if (ob->type==OB_ARMATURE) - return 1; - - else return 0; + return 0; } |