Revision: 18514 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18514 Author: harkyman Date: 2009-01-15 04:12:21 +0100 (Thu, 15 Jan 2009)
Log Message: ----------- Action Editor header menu structure ported, but menu items not yet linked up to functionality. Just wanted to get this committed in case I skid off a cliff in the snow tomorrow. Modified Paths: -------------- branches/blender2.5/blender/source/blender/editors/space_action/action_header.c Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_header.c =================================================================== --- branches/blender2.5/blender/source/blender/editors/space_action/action_header.c 2009-01-15 03:10:01 UTC (rev 18513) +++ branches/blender2.5/blender/source/blender/editors/space_action/action_header.c 2009-01-15 03:12:21 UTC (rev 18514) @@ -30,6 +30,7 @@ #include <stdio.h> #include "DNA_action_types.h" +#include "DNA_key_types.h" #include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -212,11 +213,14 @@ /* test if active action editor is showing any markers */ #if 0 - #define G_SACTION_HASMARKERS \ - ((G.saction->action && G.saction->action->markers.first) \ - || (G.scene->markers.first)) + #define SACTION_HASMARKERS \ + ((saction->action && saction->action->markers.first) \ + || (scene->markers.first)) #endif +/* need to find out how to get scene from context */ +#define SACTION_HASMARKERS (saction->action && saction->action->markers.first) + /* ------------------------------- */ /* *************************************************************** */ @@ -224,23 +228,421 @@ /* Key menu --------------------------- */ -static void do_keymenu(bContext *C, void *arg, int event) +static void do_keymenu_transformmenu(bContext *C, void *arg, int event) { + switch (event) + { + case ACTMENU_KEY_TRANSFORM_MOVE: + //transform_action_keys('g', 0); + break; + case ACTMENU_KEY_TRANSFORM_SCALE: + //transform_action_keys('s', 0); + break; + case ACTMENU_KEY_TRANSFORM_SLIDE: + //transform_action_keys('t', 0); + break; + case ACTMENU_KEY_TRANSFORM_EXTEND: + //transform_action_keys('e', 0); + break; + } +} + +static uiBlock *action_keymenu_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + block= uiBeginBlock(C, handle->region, "action_keymenu_transformmenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_transformmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_TRANSFORM_MOVE, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Grab/Extend from Frame|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_TRANSFORM_EXTEND, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_TRANSFORM_SCALE, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Time Slide|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_TRANSFORM_SLIDE, ""); + + uiBlockSetDirection(block, UI_RIGHT); + + uiTextBoundsBlock(block, 60); + uiEndBlock(C, block); + + return block; } +static void do_keymenu_snapmenu(bContext *C, void *arg, int event) +{ + switch(event) + { + case ACTMENU_KEY_SNAP_NEARFRAME: + case ACTMENU_KEY_SNAP_CURFRAME: + case ACTMENU_KEY_SNAP_NEARMARK: + case ACTMENU_KEY_SNAP_NEARTIME: + //snap_action_keys(event); + break; + + case ACTMENU_KEY_SNAP_CFRA2KEY: + //snap_cfra_action(); + break; + } +} + +static uiBlock *action_keymenu_snapmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C); + uiBlock *block; + short yco= 0, menuwidth=120; + + + block= uiBeginBlock(C, handle->region, "action_keymenu_snapmenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_snapmenu, NULL); + + if (saction->flag & SACTION_DRAWTIME) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Key -> Nearest Second|Shift S, 1", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_NEARTIME, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Key -> Current Time|Shift S, 2", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_CURFRAME, ""); + + } + else { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Key -> Nearest Frame|Shift S, 1", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_NEARFRAME, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Key -> Current Frame|Shift S, 2", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_CURFRAME, ""); + } + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Key -> Nearest Marker|Shift S, 3", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_NEARMARK, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Current Frame -> Key|Ctrl Shift S", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_NEARMARK, ""); + + uiBlockSetDirection(block, UI_RIGHT); + + uiTextBoundsBlock(block, 60); + uiEndBlock(C, block); + + return block; +} + +static void do_keymenu_mirrormenu(bContext *C, void *arg, int event) +{ + switch(event) + { + case ACTMENU_KEY_MIRROR_CURFRAME: + case ACTMENU_KEY_MIRROR_YAXIS: + //mirror_action_keys(event); + break; + } + +} + +static uiBlock *action_keymenu_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, handle->region, "action_keymenu_mirrormenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_mirrormenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Current Frame|Shift M, 1", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_MIRROR_CURFRAME, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Vertical Axis|Shift M, 2", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_MIRROR_YAXIS, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Horizontal Axis|Shift M, 3", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_MIRROR_XAXIS, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Selected Marker|Shift M, 4", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_MIRROR_MARKER, ""); + + uiBlockSetDirection(block, UI_RIGHT); + + uiTextBoundsBlock(block, 60); + uiEndBlock(C, block); + + return block; +} + +static void do_keymenu_handlemenu(bContext *C, void *arg, int event) +{ + switch (event) { + case ACTMENU_KEY_HANDLE_AUTO: + //sethandles_action_keys(HD_AUTO); + break; + + case ACTMENU_KEY_HANDLE_ALIGN: + case ACTMENU_KEY_HANDLE_FREE: + /* OK, this is kinda dumb, need to fix the + * toggle crap in sethandles_ipo_keys() + */ + //sethandles_action_keys(HD_ALIGN); + break; + + case ACTMENU_KEY_HANDLE_VECTOR: + //sethandles_action_keys(HD_VECT); + break; + } +} + +static uiBlock *action_keymenu_handlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, handle->region, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_handlemenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Auto|Shift H", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_HANDLE_AUTO, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Aligned|H", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_HANDLE_ALIGN, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Free|H", 0, yco-=20, menuwidth, + 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_HANDLE_FREE, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Vector|V", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_HANDLE_VECTOR, ""); + + uiBlockSetDirection(block, UI_RIGHT); + + uiTextBoundsBlock(block, 60); + uiEndBlock(C, block); + + return block; +} + +static void do_keymenu_extendmenu(bContext *C, void *arg, int event) +{ + switch(event) + { + case ACTMENU_KEY_EXTEND_CONST: + //action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CONSTANT); + break; + case ACTMENU_KEY_EXTEND_EXTRAPOLATION: + //action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_EXTRAPOLATION); + break; + case ACTMENU_KEY_EXTEND_CYCLIC: + //action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLIC); + break; + case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION: + //action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLICEXTRAPOLATION); + break; + } +} + +static uiBlock *action_keymenu_extendmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, handle->region, "action_keymenu_extendmenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_extendmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Constant", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_EXTEND_CONST, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Extrapolation", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_EXTEND_EXTRAPOLATION, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Cyclic", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_EXTEND_CYCLIC, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Cyclic Extrapolation", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION, ""); + + uiBlockSetDirection(block, UI_RIGHT); + + uiTextBoundsBlock(block, 60); + uiEndBlock(C, block); + + return block; +} + +static void do_keymenu_intpolmenu(bContext *C, void *arg, int event) +{ + switch(event) + { + case ACTMENU_KEY_INTERP_CONST: + //action_set_ipo_flags(SET_IPO_MENU, SET_IPO_CONSTANT); + break; + case ACTMENU_KEY_INTERP_LINEAR: + //action_set_ipo_flags(SET_IPO_MENU, SET_IPO_LINEAR); + break; + case ACTMENU_KEY_INTERP_BEZIER: + //action_set_ipo_flags(SET_IPO_MENU, SET_IPO_BEZIER); + break; + } +} + +static uiBlock *action_keymenu_intpolmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, handle->region, "action_keymenu_intpolmenu", UI_EMBOSSP, UI_HELV); + uiBlockSetButmFunc(block, do_keymenu_intpolmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Constant|Shift T, 1", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_INTERP_CONST, ""); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs