diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 16:44:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 17:28:59 +0300 |
commit | 48d7cf680ebe8ea7c09ef3e0e4abd1dc93d3fa5f (patch) | |
tree | 1ac4900663508c2d735d794768bca842c7d1ac59 /source/blender/editors/animation | |
parent | 69e512243c781129a7eca853a7a0c2c2d58dd709 (diff) |
Keymap: Select/De-Select support for anim-editors
Also update menu items, adding select/de-select.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f629c20b04a..f11c850a12b 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2339,10 +2339,24 @@ static int animchannels_deselectall_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* 'standard' behavior - check if selected, then apply relevant selection */ - if (RNA_boolean_get(op->ptr, "invert")) - ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_INVERT); - else - ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_ADD); + const int action = RNA_enum_get(op->ptr, "action"); + switch (action) { + case SEL_TOGGLE: + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_ADD); + break; + case SEL_SELECT: + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_ADD); + break; + case SEL_DESELECT: + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_CLEAR); + break; + case SEL_INVERT: + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_INVERT); + break; + default: + BLI_assert(0); + break; + } /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL); @@ -2350,11 +2364,11 @@ static int animchannels_deselectall_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void ANIM_OT_channels_select_all_toggle(wmOperatorType *ot) +static void ANIM_OT_channels_select_all(wmOperatorType *ot) { /* identifiers */ ot->name = "Select All"; - ot->idname = "ANIM_OT_channels_select_all_toggle"; + ot->idname = "ANIM_OT_channels_select_all"; ot->description = "Toggle selection of all animation channels"; /* api callbacks */ @@ -2364,8 +2378,8 @@ static void ANIM_OT_channels_select_all_toggle(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* props */ - ot->prop = RNA_def_boolean(ot->srna, "invert", false, "Invert", ""); + /* properties */ + WM_operator_properties_select_all(ot); } /* ******************** Borderselect Operator *********************** */ @@ -3146,7 +3160,7 @@ static void ANIM_OT_channel_select_keys(wmOperatorType *ot) void ED_operatortypes_animchannels(void) { - WM_operatortype_append(ANIM_OT_channels_select_all_toggle); + WM_operatortype_append(ANIM_OT_channels_select_all); WM_operatortype_append(ANIM_OT_channels_select_border); WM_operatortype_append(ANIM_OT_channels_click); @@ -3199,8 +3213,12 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0); /* deselect all */ - WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", AKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", true); + kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_SELECT); + kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", AKEY, KM_PRESS, KM_ALT, 0); + RNA_enum_set(kmi->ptr, "action", SEL_DESELECT); + kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); /* borderselect */ WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0); |