diff options
author | Matt Ebb <matt@mke3.net> | 2004-01-03 16:13:51 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2004-01-03 16:13:51 +0300 |
commit | 66698313461cf96d8fab84a2f211fcdc060ad11a (patch) | |
tree | 1ca603e5f2d6294372d9fc0536535ea696883bef | |
parent | c9a7e4be1738e17fed741ee60482a697529e6251 (diff) |
* Preliminary NLA header menus
A couple of items are still commented out in the code, that still need to be implemented. I'm committing this now, so people can test/help ;)
-rw-r--r-- | source/blender/include/BIF_editnla.h | 10 | ||||
-rw-r--r-- | source/blender/src/editnla.c | 22 | ||||
-rw-r--r-- | source/blender/src/header_nla.c | 233 |
3 files changed, 242 insertions, 23 deletions
diff --git a/source/blender/include/BIF_editnla.h b/source/blender/include/BIF_editnla.h index c70969ed575..8661e8f98e5 100644 --- a/source/blender/include/BIF_editnla.h +++ b/source/blender/include/BIF_editnla.h @@ -35,5 +35,15 @@ void clever_numbuts_nla(void); +/* NLA channel operations */ +void delete_nlachannel_keys(void); +void delete_nlachannels(void); +void duplicate_nlachannel_keys(void); + +/* Select */ +void borderselect_nla(void); +void deselect_nlachannel_keys (int test); +void deselect_nlachannels(int test); + #endif diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index b50ddd46dfe..97afd9041e1 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -88,23 +88,15 @@ /* Note: A lot of these pretty much duplicate the behaviour of the action windows. The functions should be shared, not copy-pasted */ -static void deselect_nlachannel_keys (int test); -static void deselect_nlachannels(int test); -static void transform_nlachannel_keys(char mode); -static void delete_nlachannel_keys(void); -static void delete_nlachannels(void); -static void duplicate_nlachannel_keys(void); -static void borderselect_nla(void); +static void transform_nlachannel_keys(char mode); static void mouse_nla(int selectmode); static Base *get_nearest_nlachannel_ob_key (float *index, short *sel); 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 */ @@ -601,7 +593,7 @@ void init_nlaspace(ScrArea *sa) snla->lock = 0; }; -static void deselect_nlachannel_keys (int test) +void deselect_nlachannel_keys (int test) { Base *base; int sel=1; @@ -938,7 +930,7 @@ static void transform_nlachannel_keys(char mode) MEM_freeN (tv); } -static void delete_nlachannel_keys(void) +void delete_nlachannel_keys(void) { Base *base; bActionChannel *chan; @@ -987,7 +979,7 @@ static void delete_nlachannel_keys(void) allqueue(REDRAWIPO, 0); } -static void duplicate_nlachannel_keys(void) +void duplicate_nlachannel_keys(void) { Base *base; bActionChannel *chan; @@ -1037,7 +1029,7 @@ static void duplicate_nlachannel_keys(void) transform_nlachannel_keys ('g'); } -static void borderselect_nla(void) +void borderselect_nla(void) { Base *base; rcti rect; @@ -1578,7 +1570,7 @@ void clever_numbuts_nla(void){ allqueue (REDRAWVIEW3D, 0); } -static void deselect_nlachannels(int test){ +void deselect_nlachannels(int test){ int sel = 1; Base *base; bConstraintChannel *conchan; @@ -1625,7 +1617,7 @@ static void deselect_nlachannels(int test){ } } -static void delete_nlachannels(void){ +void delete_nlachannels(void){ Base *base; bConstraintChannel *conchan, *nextchan; int sel=0; diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c index 6f39cc93531..ee64c14a6ac 100644 --- a/source/blender/src/header_nla.c +++ b/source/blender/src/header_nla.c @@ -60,6 +60,9 @@ #include "BIF_interface.h" #include "BIF_resources.h" #include "BIF_screen.h" +#include "BIF_space.h" +#include "BIF_editnla.h" + #include "BKE_global.h" #include "BKE_main.h" #include "BSE_drawipo.h" @@ -96,10 +99,179 @@ void do_nla_buttons(unsigned short event) } } + +static void do_nla_viewmenu(void *arg, int event) +{ + extern int play_anim(int mode); + + switch(event) { + case 0: /* Update Automatically */ + if(BTST(G.snla->lock, 0)) G.snla->lock = BCLR(G.snla->lock, 0); + else G.snla->lock = BSET(G.snla->lock, 0); + break; + case 1: /* Play Back Animation */ + play_anim(0); + break; + case 2: /* Play Back Animation in 3D View */ + play_anim(1); + break; + case 3: /* View All */ + do_nla_buttons(B_NLAHOME); + break; + case 4: /* Maximize Window */ + /* using event B_FULL */ + break; + } +} + +static uiBlock *nla_viewmenu(void *arg_unused) +{ +/* static short tog=0; */ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "nla_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_nla_viewmenu, NULL); + + if(BTST(G.snla->lock, 0)) { + uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + } else { + uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + } + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + + if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + +static void do_nla_selectmenu(void *arg, int event) +{ + + switch(event) + { + case 0: /* Border Select */ + borderselect_nla(); + break; + case 1: /* Select/Deselect All Keys */ + deselect_nlachannel_keys(1); + allqueue (REDRAWNLA, 0); + allqueue (REDRAWIPO, 0); + break; + case 2: /* Select/Deselect All Channel */ + deselect_nlachannels(1); + allqueue (REDRAWVIEW3D, 0); + allqueue (REDRAWNLA, 0); + allqueue (REDRAWIPO, 0); + break; + } +} + +static uiBlock *nla_selectmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "nla_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_nla_selectmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Keys|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Channels", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + +static void do_nla_stripmenu(void *arg, int event) +{ + + switch(event) + { + case 0: /* Strip Properties */ + break; + case 1: /* Add Action Strip */ + break; + case 2: /* Duplicate */ + duplicate_nlachannel_keys(); + update_for_newframe_muted(); + break; + case 3: /* Delete Strips */ + delete_nlachannel_keys (); + update_for_newframe_muted(); + break; + case 5: /* Convert Action to NLA Strip */ + break; + } +} + +static uiBlock *nla_stripmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "nla_stripmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_nla_stripmenu, NULL); + + // uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strip Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + + // uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + // uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Action Strip|Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + // uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + // uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Action to NLA Strip|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + void nla_buttons(void) { SpaceNla *snla; - short xco; + short xco, xmax; char naam[20]; uiBlock *block; @@ -117,15 +289,58 @@ void nla_buttons(void) uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types."); - xco+= XIC+22; + xco+= XIC+14; + + uiBlockSetEmboss(block, UI_EMBOSSN); + if(curarea->flag & HEADER_NO_PULLDOWN) { + uiDefIconButS(block, TOG|BIT|0, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT, + xco,2,XIC,YIC-2, + &(curarea->flag), 0, 0, 0, 0, "Show pulldown menus"); + } else { + uiDefIconButS(block, TOG|BIT|0, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN, + xco,2,XIC,YIC-2, + &(curarea->flag), 0, 0, 0, 0, "Hide pulldown menus"); + } + uiBlockSetEmboss(block, UI_EMBOSS); + xco+=XIC; + + if((curarea->flag & HEADER_NO_PULLDOWN)==0) { + /* pull down menus */ + uiBlockSetEmboss(block, UI_EMBOSSP); + + xmax= GetButStringLength("View"); + uiDefBlockBut(block, nla_viewmenu, NULL, "View", xco, -2, xmax-3, 24, ""); + xco+= xmax; + + xmax= GetButStringLength("Select"); + uiDefBlockBut(block, nla_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, ""); + xco+= xmax; + + xmax= GetButStringLength("Strip"); + uiDefBlockBut(block, nla_stripmenu, NULL, "Strip", xco, -2, xmax-3, 24, ""); + xco+= xmax; + + } + + uiBlockSetEmboss(block, UI_EMBOSSX); + + + /* FULL WINDOW */ + + +// xco = 8; + +// uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types."); + +// xco+= XIC+22; /* FULL WINDOW */ - if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)"); - else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)"); +// if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)"); +// else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)"); /* HOME */ - uiDefIconBut(block, BUT, B_NLAHOME, ICON_HOME, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms window to home view showing all items (HOMEKEY)"); - xco+= XIC; +// uiDefIconBut(block, BUT, B_NLAHOME, ICON_HOME, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms window to home view showing all items (HOMEKEY)"); +// xco+= XIC; /* IMAGE */ // uiDefIconButS(block, TOG, B_REDR, ICON_IMAGE_COL, xco+=XIC,0,XIC,YIC, &sseq->mainb, 0, 0, 0, 0, "Toggles image display"); @@ -136,9 +351,11 @@ void nla_buttons(void) // uiDefIconBut(block, BUT, B_NLABORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zoom view to area"); /* draw LOCK */ - xco+= XIC/2; +// xco+= XIC/2; + + xco += 8; - uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco+=XIC,0,XIC,YIC, &(snla->lock), 0, 0, 0, 0, "Toggles forced redraw of other windows to reflect changes in real time"); + uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco,0,XIC,YIC, &(snla->lock), 0, 0, 0, 0, "Toggles forced redraw of other windows to reflect changes in real time"); uiDrawBlock(block); } |