diff options
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/include/BSE_drawnla.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawnla.c | 90 | ||||
-rw-r--r-- | source/blender/src/editnla.c | 28 | ||||
-rw-r--r-- | source/blender/src/interface.c | 6 |
5 files changed, 100 insertions, 31 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1d7668af5d1..6d8272f7a48 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4154,6 +4154,12 @@ static void do_versions(Main *main) SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { if(sl->blockscale==0.0) sl->blockscale= 0.7; + + /* added: 5x better zoom in for nla */ + if(sl->spacetype==SPACE_NLA) { + SpaceNla *snla= (SpaceNla *)sl; + snla->v2d.maxzoom= 50; + } } } } diff --git a/source/blender/include/BSE_drawnla.h b/source/blender/include/BSE_drawnla.h index d9d27204e28..e46f4217de7 100644 --- a/source/blender/include/BSE_drawnla.h +++ b/source/blender/include/BSE_drawnla.h @@ -36,6 +36,7 @@ struct ScrArea; void drawnlaspace(struct ScrArea *sa, void *spacedata); +void do_nlabuts(unsigned short event); #endif /* BSE_DRAWNLA */ diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index 0c086d5b03c..9f8883f33e3 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -62,6 +62,7 @@ #include "BSE_drawnla.h" #include "BSE_drawipo.h" #include "BSE_editnla_types.h" +#include "BSE_headerbuttons.h" #include "BIF_gl.h" #include "BIF_resources.h" @@ -413,21 +414,68 @@ static void draw_nlastrips(SpaceNla *snla) /* ******* panel *********** */ +#define B_NLA_PANEL 121 + +static bActionStrip *get_active_nlastrip(void) +/* For now just returns the first selected strip */ +{ + 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; + } + } + } + + return NULL; +} + void do_nlabuts(unsigned short event) { + bActionStrip *strip; + + /* Determine if an nla strip has been selected */ + strip = get_active_nlastrip(); + if (!strip) return; + switch(event) { - case REDRAWVIEW3D: - allqueue(REDRAWVIEW3D, 0); - break; case B_REDR: + allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWNLA, 0); break; + case B_NLA_PANEL: + if (strip->end<strip->start) + strip->end=strip->start; + + + if (strip->blendin>(strip->end-strip->start)) + strip->blendin = strip->end-strip->start; + + if (strip->blendout>(strip->end-strip->start)) + strip->blendout = strip->end-strip->start; + + if (strip->blendin > (strip->end-strip->start-strip->blendout)) + strip->blendin = (strip->end-strip->start-strip->blendout); + + if (strip->blendout > (strip->end-strip->start-strip->blendin)) + strip->blendout = (strip->end-strip->start-strip->blendin); + + + update_for_newframe_muted(); + allqueue (REDRAWNLA, 0); + allqueue (REDRAWVIEW3D, 0); + + break; } } - static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES { + bActionStrip *strip; uiBlock *block; block= uiNewBlock(&curarea->uiblocks, "nla_panel_properties", UI_EMBOSS, UI_HELV, curarea->win); @@ -435,8 +483,36 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES uiSetPanelHandler(NLA_HANDLER_PROPERTIES); // for close and esc if(uiNewPanel(curarea, block, "Transform Properties", "NLA", 10, 230, 318, 204)==0) return; - uiDefBut(block, LABEL, 0, "test text", 10,180,300,19, 0, 0, 0, 0, 0, ""); - + /* Determine if an nla strip has been selected */ + strip = get_active_nlastrip(); + if (!strip) return; + + // 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); + uiDefBut(block, NUM|FLO, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, 1.0, 18000.0, 100, 0, "First frame in the timeline"); + uiDefBut(block, NUM|FLO, B_REDR, "Strip End:", 160,160,150,19, &strip->end, 1.0, 18000.0, 100, 0, "Last frame in the timeline"); + + uiBlockBeginAlign(block); + uiDefBut(block, NUM|FLO, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, 1.0, 18000.0, 100, 0, "First frame of the action to map to the playrange"); + uiDefBut(block, NUM|FLO, B_REDR, "Action End:", 160,120,150,19, &strip->actend, 1.0, 18000.0, 100, 0, "Last frame of the action to map to the playrange"); + + uiBlockBeginAlign(block); + uiDefBut(block, NUM|FLO, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 1.0, 18000.0, 100, 0, "Number of frames of ease-in"); + uiDefBut(block, NUM|FLO, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 1.0, 18000.0, 100, 0, "Number of frames of ease-out"); + + uiBlockBeginAlign(block); + uiDefBut(block, NUM|FLO, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 1.0, 18000.0, 100, 0, "Number of times the action should repeat"); + uiDefBut(block, NUM|FLO, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 1.0, 18000.0, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range"); + + uiBlockBeginAlign(block); + uiDefBut(block, TOG|SHO|BIT|ACTSTRIP_USESTRIDEBIT, 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"); + uiDefBut(block, TOG|SHO|BIT|ACTSTRIP_HOLDLASTFRAMEBIT, 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"); + uiDefBut(block, TOG|SHO, B_REDR, "Add", 210,0,100,19, &strip->mode, 0, 0, 0, 0, "Toggles additive blending mode"); } static void nla_blockhandlers(ScrArea *sa) @@ -464,6 +540,8 @@ void drawnlaspace(ScrArea *sa, void *spacedata) float col[3]; short ofsx = 0, ofsy = 0; + uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ; calc_scrollrcts(G.v2d, curarea->winx, curarea->winy); diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 6b59f3c6b8e..f6ba41a6c9f 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -78,6 +78,7 @@ #include "BSE_edit.h" #include "BSE_filesel.h" #include "BDR_editobject.h" +#include "BSE_drawnla.h" #include "blendef.h" #include "mydevice.h" @@ -96,7 +97,6 @@ static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel); static Base *get_nearest_nlastrip (bActionStrip **rstrip, short *sel); static void mouse_nlachannels(short mval[2]); static void add_nlablock(short mval[2]); -static bActionStrip *get_active_nlastrip(void); static void convert_nla(short mval[2]); extern int count_nla_levels(void); /* From drawnla.c */ extern int nla_filter (Base* base, int flags); /* From drawnla.c */ @@ -123,7 +123,7 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) switch(event) { case UI_BUT_EVENT: - do_butspace(val); // abuse! + do_nlabuts(val); // in drawnla.c break; case HOMEKEY: @@ -609,7 +609,7 @@ void init_nlaspace(ScrArea *sa) snla->v2d.max[1]= 1000.0; snla->v2d.minzoom= 0.1F; - snla->v2d.maxzoom= 10; + snla->v2d.maxzoom= 50; snla->v2d.scroll= R_SCROLL+B_SCROLL; snla->v2d.keepaspect= 0; @@ -1521,30 +1521,12 @@ static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel) return firstact; } -static bActionStrip *get_active_nlastrip(void) -/* For now just returns the first selected strip */ -{ - 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; - } - } - } - - return NULL; -} - void clever_numbuts_nla(void){ - bActionStrip *strip; + bActionStrip *strip=NULL; int but=0; /* Determine if an nla strip has been selected */ - strip = get_active_nlastrip(); + //strip = get_active_nlastrip(); if (!strip) return; diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index d544bf9d02f..d3eb368607a 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2523,8 +2523,10 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) // added this for panels in windows with buttons... // maybe speed optimize should require test if((block->flag & UI_BLOCK_LOOP)==0) { - //bwin_load_winmatrix(block->win, block->winmat); - //glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + bwin_load_winmatrix(block->win, block->winmat); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); } Mat4CpyMat4(UIwinmat, block->winmat); |