Select: change Sequencer to match new behavior of 'deselect on nothing'.

Note that unlike some others, this is always enabled for sequencer,
since previous (2.7x) code was already deselecting everything when
clicking in an empty area...

Part of T63995.
This commit is contained in:
Bastien Montagne 2019-04-29 16:56:14 +02:00
parent e4b9836c53
commit 080d72a257
2 changed files with 17 additions and 7 deletions

View File

@ -2419,7 +2419,8 @@ def km_sequencer(params):
)
),
("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'},
{"properties": [("extend", False), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
{"properties": [("extend", False), ("deselect_all", True),
("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
{"properties": [("extend", True), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "alt": True},

View File

@ -318,6 +318,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
const bool extend = RNA_boolean_get(op->ptr, "extend");
const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
const bool linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
const bool linked_time = RNA_boolean_get(op->ptr, "linked_time");
int left_right = RNA_enum_get(op->ptr, "left_right");
@ -401,15 +402,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
}
}
else {
// seq = find_nearest_seq(scene, v2d, &hand, mval);
act_orig = ed->act_seq;
if (extend == 0 && linked_handle == 0) {
ED_sequencer_deselect_all(scene);
}
if (seq) {
if (!extend && !linked_handle) {
ED_sequencer_deselect_all(scene);
}
BKE_sequencer_active_set(scene, seq);
if ((seq->type == SEQ_TYPE_IMAGE) || (seq->type == SEQ_TYPE_MOVIE)) {
@ -535,6 +534,9 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
select_linked_time(ed->seqbasep, seq);
}
}
else if (deselect_all) {
ED_sequencer_deselect_all(scene);
}
}
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
@ -566,7 +568,14 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
PropertyRNA *prop;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
prop = RNA_def_boolean(ot->srna,
"deselect_all",
false,
"Deselect On Nothing",
"Deselect all when nothing under the cursor");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_boolean(
ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip");
/* for animation this is an enum but atm having an enum isn't useful for us */