FIX: Select operators in Sequencer Preview

Behavior of select all operator invoked by shortcut was inconsistent
with menu. This was, because operator context was not set.

Also the selection in timeline is cleared when running this operator
as not doing it may cause unexpected behavior for users.
Selection invert also follows the same behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/137713
This commit is contained in:
Mukhesh
2025-05-03 02:20:56 +02:00
committed by Richard Antalik
parent 7d97ba4c5f
commit 5055a4e5a3
2 changed files with 15 additions and 10 deletions

View File

@@ -584,7 +584,10 @@ class SEQUENCER_MT_select(Menu):
context.scene.sequence_editor is not None and
context.scene.sequence_editor.selected_retiming_keys
)
if has_preview:
layout.operator_context = 'INVOKE_REGION_PREVIEW'
else:
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("sequencer.select_all", text="All").action = 'SELECT'
layout.operator("sequencer.select_all", text="None").action = 'DESELECT'
layout.operator("sequencer.select_all", text="Invert").action = 'INVERT'

View File

@@ -443,24 +443,26 @@ static wmOperatorStatus sequencer_de_select_all_exec(bContext *C, wmOperator *op
}
}
}
if (action == SEL_INVERT || action == SEL_SELECT) {
if (action == SEL_INVERT) {
for (Strip *strip : strips) {
if (strip->flag & STRIP_ALLSEL) {
strips.remove(strip);
}
}
}
deselect_all_strips(scene);
}
for (Strip *strip : strips) {
switch (action) {
case SEL_SELECT:
strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
strip->flag |= SELECT;
break;
case SEL_DESELECT:
strip->flag &= ~STRIP_ALLSEL;
break;
case SEL_INVERT:
if (strip->flag & STRIP_ALLSEL) {
strip->flag &= ~STRIP_ALLSEL;
}
else {
strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
strip->flag |= SELECT;
}
strip->flag |= SELECT;
break;
}
}