From 2803d6ec6dc95b05d927508ed49abe6c54593ca8 Mon Sep 17 00:00:00 2001 From: Hare Date: Fri, 6 Feb 2026 21:28:33 +0900 Subject: [PATCH] Meta Strip --- operators/apply_blur.py | 54 ++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/operators/apply_blur.py b/operators/apply_blur.py index a3f891b..fa39b55 100644 --- a/operators/apply_blur.py +++ b/operators/apply_blur.py @@ -88,13 +88,16 @@ class SEQUENCER_OT_apply_mask_blur(Operator): def _apply_with_mask_modifier(self, context, video_strip: "bpy.types.Strip", mask_strip: "bpy.types.Strip"): """ - Apply blur using Mask Modifier. + Apply blur using Mask Modifier, grouped in a Meta Strip. Workflow: 1. Duplicate the video strip 2. Create Gaussian Blur effect on the duplicate 3. Add Mask modifier to the blur effect (references mask strip) - 4. Composite with Alpha Over effect + 4. Group all into a Meta Strip + + The blur effect with mask will automatically composite over the original + video due to VSE's channel layering system. """ seq_editor = context.scene.sequence_editor @@ -108,10 +111,6 @@ class SEQUENCER_OT_apply_mask_blur(Operator): while blur_channel in used_channels: blur_channel += 1 - composite_channel = blur_channel + 1 - while composite_channel in used_channels: - composite_channel += 1 - # Step 1: Duplicate the video strip if video_strip.type == 'MOVIE': video_copy = seq_editor.strips.new_movie( @@ -168,22 +167,37 @@ class SEQUENCER_OT_apply_mask_blur(Operator): mask_mod.input_mask_type = 'STRIP' mask_mod.input_mask_id = mask_strip - # Step 4: Composite with Alpha Over effect - alpha_over = seq_editor.strips.new_effect( - name=f"{video_strip.name}_composite", - type='ALPHA_OVER', - channel=composite_channel, - frame_start=video_strip.frame_final_start, - length=strip_length, - input1=video_strip, # Base (original) - input2=blur_effect, # Blurred with mask - ) - - # Hide intermediate strips (but keep them active) - video_copy.mute = True + # Hide the mask strip (but keep it active for the modifier) mask_strip.mute = True - self.report({'INFO'}, f"Applied blur with Mask Modifier (composite on channel {composite_channel})") + # Step 4: Create Meta Strip to group everything + # Deselect all first + for strip in seq_editor.strips: + strip.select = False + + # Select the strips to group + video_copy.select = True + blur_effect.select = True + mask_strip.select = True + + # Set active strip for context + seq_editor.active_strip = blur_effect + + # Create meta strip using operator + bpy.ops.sequencer.meta_make() + + # Find the newly created meta strip (it will be selected) + meta_strip = None + for strip in seq_editor.strips: + if strip.select and strip.type == 'META': + meta_strip = strip + break + + if meta_strip: + meta_strip.name = f"{video_strip.name}_blurred_meta" + self.report({'INFO'}, f"Applied blur with Mask Modifier (grouped in Meta Strip)") + else: + self.report({'INFO'}, f"Applied blur with Mask Modifier (blur on channel {blur_channel})") def _apply_with_meta_strip(self, context, video_strip: "bpy.types.Strip", mask_strip: "bpy.types.Strip"): """