Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-03 16:44:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-03 17:28:59 +0300
commit48d7cf680ebe8ea7c09ef3e0e4abd1dc93d3fa5f (patch)
tree1ac4900663508c2d735d794768bca842c7d1ac59 /source/blender/editors/space_nla
parent69e512243c781129a7eca853a7a0c2c2d58dd709 (diff)
Keymap: Select/De-Select support for anim-editors
Also update menu items, adding select/de-select.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_intern.h2
-rw-r--r--source/blender/editors/space_nla/nla_ops.c14
-rw-r--r--source/blender/editors/space_nla/nla_select.c31
3 files changed, 30 insertions, 17 deletions
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index a00e71a192d..e59395cac6b 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -65,7 +65,7 @@ enum eNlaEdit_LeftRightSelect_Mode {
/* --- */
-void NLA_OT_select_all_toggle(wmOperatorType *ot);
+void NLA_OT_select_all(wmOperatorType *ot);
void NLA_OT_select_border(wmOperatorType *ot);
void NLA_OT_select_leftright(wmOperatorType *ot);
void NLA_OT_click_select(wmOperatorType *ot);
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 5bfd73b8163..c5dd85b7c4d 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -124,7 +124,7 @@ void nla_operatortypes(void)
/* select */
WM_operatortype_append(NLA_OT_click_select);
WM_operatortype_append(NLA_OT_select_border);
- WM_operatortype_append(NLA_OT_select_all_toggle);
+ WM_operatortype_append(NLA_OT_select_all);
WM_operatortype_append(NLA_OT_select_leftright);
/* view */
@@ -223,13 +223,13 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap)
RNA_boolean_set(kmi->ptr, "extend", false);
RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
-
/* deselect all */
- /* TODO: uniformize with other select_all ops? */
- kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "invert", false);
- kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "invert", true);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", AKEY, KM_PRESS, 0, 0);
+ RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
+ RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
+ RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
/* borderselect */
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_border", BKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index f22c211af64..5d32b23ad67 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -167,10 +167,24 @@ static int nlaedit_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"))
- deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_INVERT);
- else
- deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_ADD);
+ const int action = RNA_enum_get(op->ptr, "action");
+ switch (action) {
+ case SEL_TOGGLE:
+ deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_ADD);
+ break;
+ case SEL_SELECT:
+ deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_ADD);
+ break;
+ case SEL_DESELECT:
+ deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_SUBTRACT);
+ break;
+ case SEL_INVERT:
+ deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_INVERT);
+ break;
+ default:
+ BLI_assert(0);
+ break;
+ }
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
@@ -178,11 +192,11 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_select_all_toggle(wmOperatorType *ot)
+void NLA_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "(De)select All";
- ot->idname = "NLA_OT_select_all_toggle";
+ ot->idname = "NLA_OT_select_all";
ot->description = "Select or deselect all NLA-Strips";
/* api callbacks */
@@ -192,9 +206,8 @@ void NLA_OT_select_all_toggle(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
- /* props */
- ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
- RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
+ /* properties */
+ WM_operator_properties_select_all(ot);
}
/* ******************** Border Select Operator **************************** */