VSE: Hide-Reveal strips operator in sequencer preview

This pull request adds options to hide and show strips in the Sequencer
Preview, using the same shortcuts. Included "Show/Hide" operators in the Strips
menu of preview mode. It only works on strips that are visible in the preview
at the current frame. The Unmute operator now shows all hidden strips in
the preview at the current  frame, since it's not possible to select hidden strips
in sequencer preview.

See video in PR description.

Pull Request: https://projects.blender.org/blender/blender/pulls/137781
This commit is contained in:
Mukhesh
2025-04-22 08:18:21 +02:00
committed by Pratik Borhade
parent 720b00ae50
commit 541e2b3cdd
3 changed files with 35 additions and 4 deletions

View File

@@ -3217,6 +3217,12 @@ def km_sequencer_preview(params):
{"properties": [("property", 'ROTATION')]}),
("sequencer.preview_duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
("sequencer.mute", {"type": 'H', "value": 'PRESS'},
{"properties": [("unselected", False)]}),
("sequencer.mute", {"type": 'H', "value": 'PRESS', "shift": True},
{"properties": [("unselected", True)]}),
("sequencer.unmute", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": [("unselected", False)]}),
("sequencer.delete", {"type": 'X', "value": 'PRESS'}, None),
("sequencer.delete", {"type": 'DEL', "value": 'PRESS'}, None),

View File

@@ -941,6 +941,18 @@ class SEQUENCER_MT_strip_text(Menu):
layout.operator("sequencer.text_deselect_all")
class SEQUENCER_MT_strip_show_hide(Menu):
bl_label = "Show/Hide"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_PREVIEW'
layout.operator("sequencer.unmute", text="Show Hidden Strips").unselected = False
layout.separator()
layout.operator("sequencer.mute", text="Hide Selected").unselected = False
layout.operator("sequencer.mute", text="Hide Unselected").unselected = True
class SEQUENCER_MT_strip_input(Menu):
bl_label = "Inputs"
@@ -1061,6 +1073,8 @@ class SEQUENCER_MT_strip(Menu):
layout.separator()
layout.operator("sequencer.preview_duplicate_move", text="Duplicate")
layout.separator()
layout.menu("SEQUENCER_MT_strip_show_hide")
layout.separator()
if strip and strip.type == 'TEXT':
layout.menu("SEQUENCER_MT_strip_text")
@@ -3114,6 +3128,7 @@ classes = (
SEQUENCER_MT_strip_transform,
SEQUENCER_MT_strip_retiming,
SEQUENCER_MT_strip_text,
SEQUENCER_MT_strip_show_hide,
SEQUENCER_MT_strip_input,
SEQUENCER_MT_strip_lock_mute,
SEQUENCER_MT_image,

View File

@@ -888,9 +888,9 @@ void SEQUENCER_OT_slip(wmOperatorType *ot)
static wmOperatorStatus sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq::editing_get(scene);
blender::VectorSet strips = all_strips_from_context(C);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
for (Strip *strip : strips) {
if (!RNA_boolean_get(op->ptr, "unselected")) {
if (strip->flag & SELECT) {
strip->flag |= SEQ_MUTE;
@@ -939,9 +939,19 @@ static wmOperatorStatus sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq::editing_get(scene);
ARegion *region = CTX_wm_region(C);
const bool is_preview = (region->regiontype == RGN_TYPE_PREVIEW) &&
sequencer_view_preview_only_poll(C);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
if (!RNA_boolean_get(op->ptr, "unselected")) {
if (is_preview) {
if (seq::time_strip_intersects_frame(scene, strip, scene->r.cfra) &&
strip->type != STRIP_TYPE_SOUND_RAM)
{
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
}
else if (!RNA_boolean_get(op->ptr, "unselected")) {
if (strip->flag & SELECT) {
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);