diff options
author | Roland Hess <me@harkyman.com> | 2007-12-05 03:03:39 +0300 |
---|---|---|
committer | Roland Hess <me@harkyman.com> | 2007-12-05 03:03:39 +0300 |
commit | aa39d56692f63cfd9a6d61bbf813e8c570600037 (patch) | |
tree | a4b1ccaa9f8f8a303206d90b9cc5430559d3dbf9 /source/blender/src | |
parent | f90e4cae73c06ee2c50178cb7fb52f44c73bea76 (diff) |
Little workflow goody for animators. Adds Alt-RMB select to Action Editor. Alt-RMB in the key area selects all keys on that side of the current frame line. Shift-Alt-RMB builds selection. Commands are also in the headers.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/editaction.c | 59 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 25 |
2 files changed, 83 insertions, 1 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 48a39875cc2..1df17fb06b8 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -1968,6 +1968,59 @@ void markers_selectkeys_between (void) BLI_freelistN(&act_data); } +void selectkeys_leftright (short leftright, short select_mode) +{ + ListBase act_data = {NULL, NULL}; + bActListElem *ale; + int filter; + void *data; + short datatype; + float min, max; + + if (select_mode==SELECT_REPLACE) { + select_mode=SELECT_ADD; + deselect_action_keys(0, 0); + } + + /* determine what type of data we are operating on */ + data = get_action_context(&datatype); + if (data == NULL) return; + + if (leftright==1) { + min = -MAXFRAMEF; + max = (float)CFRA+0.1f; + } + else { + min = (float)CFRA-0.1f; + max = MAXFRAMEF; + } + + /* filter data */ + filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS); + actdata_filter(&act_data, filter, data, datatype); + + /* select keys to the right */ + for (ale= act_data.first; ale; ale= ale->next) { + if(NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) { + actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1); + borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD); + actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1); + } + else { + borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD); + } + } + + /* Cleanup */ + BLI_freelistN(&act_data); + + allqueue(REDRAWNLA, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWIPO, 0); + +} + + /* ----------------------------------------- */ /* This function makes a list of the selected keyframes @@ -2883,6 +2936,12 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) /* Clicking in the main area of the action window * selects keys and markers */ + else if (G.qual & LR_ALTKEY) { + areamouseco_to_ipoco(G.v2d, mval, &dx, &dy); + + /* sends a 1 for left and 0 for right */ + selectkeys_leftright((dx < (float)CFRA), select_mode); + } else mouse_action(select_mode); } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 4a803926a94..ada923c44eb 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -102,7 +102,9 @@ enum { ACTMENU_SEL_ALL_CHAN, ACTMENU_SEL_ALL_MARKERS, ACTMENU_SEL_INVERSE_KEYS, - ACTMENU_SEL_INVERSE_MARKERS + ACTMENU_SEL_INVERSE_MARKERS, + ACTMENU_SEL_LEFTKEYS, + ACTMENU_SEL_RIGHTKEYS }; enum { @@ -513,6 +515,14 @@ static void do_action_selectmenu(void *arg, int event) deselect_markers(0, 2); allqueue(REDRAWMARKER, 0); break; + + case ACTMENU_SEL_LEFTKEYS: + selectkeys_leftright(1, SELECT_REPLACE); + break; + + case ACTMENU_SEL_RIGHTKEYS: + selectkeys_leftright(0, SELECT_REPLACE); + break; } } @@ -565,6 +575,19 @@ static uiBlock *action_selectmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Back In Time|Alt RMB", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_SEL_LEFTKEYS, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Ahead In Time|Alt RMB", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_SEL_RIGHTKEYS, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBlockBut(block, action_selectmenu_columnmenu, NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, ""); |