== Action Editor - Keyframe Selection (Added tools) ==

* Ctrl-I now swaps the selection status of keyframes/channels depending on where the mouse cursor is located. Ctrl-Shift-I does so for markers.

* (De)selecting channels now clears the 'active' flags too, so there will be no more 'selected' items lingering around even after pressing AKEY
This commit is contained in:
Joshua Leung 2008-02-15 06:06:08 +00:00
parent 8c8d585079
commit 87494c0ad8
3 changed files with 88 additions and 25 deletions

@ -161,8 +161,8 @@ void action_set_ipo_flags(short mode, short event);
/* Select */
void borderselect_action(void);
void deselect_action_keys(short test, short sel);
void deselect_action_channels(short test);
void deselect_actionchannels(struct bAction *act, short test);
void deselect_action_channels(short mode);
void deselect_actionchannels(struct bAction *act, short mode);
int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
void select_actionchannel_by_name(struct bAction *act, char *name, int select);
void selectkeys_leftright (short leftright, short select_mode);

@ -2427,8 +2427,10 @@ int select_icu_channel(bAction *act, IpoCurve *icu, int selectmode)
/* ----------------------------------------- */
/* deselects action channels in given action */
void deselect_actionchannels (bAction *act, short test)
/* De-selects or inverts the selection of Channels in a given Action
* mode: 0 = default behaviour (select all), 1 = test if (de)select all, 2 = invert all
*/
void deselect_actionchannels (bAction *act, short mode)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@ -2439,7 +2441,7 @@ void deselect_actionchannels (bAction *act, short test)
actdata_filter(&act_data, filter, act, ACTCONT_ACTION);
/* See if we should be selecting or deselecting */
if (test) {
if (mode == 1) {
for (ale= act_data.first; ale; ale= ale->next) {
if (sel == 0)
break;
@ -2474,28 +2476,38 @@ void deselect_actionchannels (bAction *act, short test)
{
bActionGroup *agrp= (bActionGroup *)ale->data;
if (sel)
if (mode == 2)
agrp->flag ^= AGRP_SELECTED;
else if (sel)
agrp->flag |= AGRP_SELECTED;
else
agrp->flag &= ~AGRP_SELECTED;
agrp->flag &= ~AGRP_ACTIVE;
}
break;
case ACTTYPE_ACHAN:
{
bActionChannel *achan= (bActionChannel *)ale->data;
if (sel)
if (mode == 2)
achan->flag ^= AGRP_SELECTED;
else if (sel)
achan->flag |= ACHAN_SELECTED;
else
achan->flag &= ~ACHAN_SELECTED;
select_poseelement_by_name(achan->name, sel);
achan->flag &= ~ACHAN_HILIGHTED;
}
break;
case ACTTYPE_CONCHAN:
{
bConstraintChannel *conchan= (bConstraintChannel *)ale->data;
if (sel)
if (mode == 2)
conchan->flag ^= CONSTRAINT_CHANNEL_SELECT;
else if (sel)
conchan->flag |= CONSTRAINT_CHANNEL_SELECT;
else
conchan->flag &= ~CONSTRAINT_CHANNEL_SELECT;
@ -2505,10 +2517,14 @@ void deselect_actionchannels (bAction *act, short test)
{
IpoCurve *icu= (IpoCurve *)ale->data;
if (sel)
if (mode == 2)
icu->flag ^= IPO_SELECT;
else if (sel)
icu->flag |= IPO_SELECT;
else
icu->flag &= ~IPO_SELECT;
icu->flag &= ~IPO_ACTIVE;
}
break;
}
@ -2519,7 +2535,7 @@ void deselect_actionchannels (bAction *act, short test)
}
/* deselects channels in the action editor */
void deselect_action_channels (short test)
void deselect_action_channels (short mode)
{
void *data;
short datatype;
@ -2530,7 +2546,7 @@ void deselect_action_channels (short test)
/* based on type */
if (datatype == ACTCONT_ACTION)
deselect_actionchannels(data, test);
deselect_actionchannels(data, mode);
// should shapekey channels be allowed to do this?
}
@ -3980,16 +3996,17 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
switch(event) {
case UI_BUT_EVENT:
do_actionbuts(val); // window itself
do_actionbuts(val); /* window itself */
break;
case HOMEKEY:
do_action_buttons(B_ACTHOME); // header
do_action_buttons(B_ACTHOME); /* header */
break;
case AKEY:
if (mval[0]<NAMEWIDTH) {
if (mval[0] < NAMEWIDTH) {
deselect_action_channels(1);
BIF_undo_push("(De)Select Action Channels");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
@ -3998,6 +4015,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if (mval[0] > ACTWIDTH) {
if (G.qual == LR_CTRLKEY) {
deselect_markers(1, 0);
BIF_undo_push("(De)Select Markers");
allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
@ -4006,6 +4024,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
else {
deselect_action_keys(1, 1);
BIF_undo_push("(De)Select Keys");
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWIPO, 0);
@ -4018,7 +4037,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
borderselect_markers();
}
else {
if (mval[0]>ACTWIDTH)
if (mval[0] >= ACTWIDTH)
borderselect_action();
}
break;
@ -4093,6 +4112,31 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
sethandles_action_keys(HD_ALIGN);
}
break;
case IKEY:
if (G.qual & LR_CTRLKEY) {
if (mval[0] < ACTWIDTH) {
deselect_action_channels(2);
BIF_undo_push("Inverse Action Channels");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWIPO, 0);
}
else if (G.qual & LR_SHIFTKEY) {
deselect_markers(0, 2);
BIF_undo_push("Inverse Markers");
allqueue(REDRAWMARKER, 0);
}
else {
deselect_action_keys(0, 2);
BIF_undo_push("Inverse Keys");
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWIPO, 0);
}
}
break;
case KKEY:
if (G.qual == LR_ALTKEY)

@ -111,6 +111,7 @@ enum {
ACTMENU_SEL_ALL_MARKERS,
ACTMENU_SEL_INVERSE_KEYS,
ACTMENU_SEL_INVERSE_MARKERS,
ACTMENU_SEL_INVERSE_CHANNELS,
ACTMENU_SEL_LEFTKEYS,
ACTMENU_SEL_RIGHTKEYS
};
@ -565,33 +566,47 @@ static void do_action_selectmenu(void *arg, int event)
case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
deselect_action_keys(1, 1);
allqueue (REDRAWACTION, 0);
BIF_undo_push("(De)Select Keys");
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
allqueue(REDRAWIPO, 0);
break;
case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
deselect_action_channels(1);
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWACTION, 0);
BIF_undo_push("(De)Select Action Channels");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
allqueue(REDRAWIPO, 0);
break;
case ACTMENU_SEL_ALL_MARKERS: /* select/deselect all markers */
deselect_markers(1, 0);
BIF_undo_push("(De)Select Markers");
allqueue(REDRAWMARKER, 0);
break;
case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
deselect_action_keys(0, 2);
allqueue (REDRAWACTION, 0);
BIF_undo_push("Inverse Keys");
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
allqueue(REDRAWIPO, 0);
break;
case ACTMENU_SEL_INVERSE_CHANNELS: /* invert selection status of channels */
deselect_action_channels(2);
BIF_undo_push("Inverse Action Channels");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWIPO, 0);
break;
case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */
deselect_markers(0, 2);
BIF_undo_push("Inverse Action Channels");
allqueue(REDRAWMARKER, 0);
break;
@ -635,7 +650,7 @@ static uiBlock *action_selectmenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_ALL_MARKERS, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Select/Deselect All Channels", 0, yco-=20,
"Select/Deselect All Channels|A", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_ALL_CHAN, "");
@ -643,13 +658,17 @@ static uiBlock *action_selectmenu(void *arg_unused)
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Inverse Keys", 0, yco-=20,
"Inverse Keys|Ctrl I", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_INVERSE_KEYS, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Inverse Markers", 0, yco-=20,
"Inverse Markers|Ctrl Shift I", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_INVERSE_MARKERS, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Inverse All Channels|Ctrl I", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_INVERSE_CHANNELS, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");