diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-02-15 09:06:08 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-02-15 09:06:08 +0300 |
commit | 87494c0ad84794545ce03f7b39ddd365c3500a28 (patch) | |
tree | e3e4746219e91c6333994eb047cf93df9ae1629b /source/blender/src/editaction.c | |
parent | 8c8d585079e1888257c285ccfc4a4bf6e9a41f46 (diff) |
== 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
Diffstat (limited to 'source/blender/src/editaction.c')
-rw-r--r-- | source/blender/src/editaction.c | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 2732e2365d5..fb8ac5664d1 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -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) |