applyの選択を自動化

This commit is contained in:
Keisuke Hirata 2026-02-07 05:57:39 +09:00
parent 2803d6ec6d
commit 97c6b288e0

View File

@ -25,56 +25,35 @@ class SEQUENCER_OT_apply_mask_blur(Operator):
min=1, min=1,
max=500, max=500,
) )
mask_strip_name: StringProperty(
name="Mask Strip",
description="Name of the mask strip to use",
default="",
)
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
"""Check if operator can run.""" """Check if operator can run."""
if not context.scene.sequence_editor: if not context.scene.sequence_editor:
return False return False
strip = context.scene.sequence_editor.active_strip seq_editor = context.scene.sequence_editor
strip = seq_editor.active_strip
if not strip: if not strip:
return False return False
return strip.type in {'MOVIE', 'IMAGE'} if strip.type not in {'MOVIE', 'IMAGE'}:
return False
def invoke(self, context, event):
"""Show dialog to select mask strip.""" # Check if corresponding mask strip exists
return context.window_manager.invoke_props_dialog(self) mask_name = f"{strip.name}_mask"
return mask_name in seq_editor.strips
def draw(self, context):
"""Draw the operator dialog."""
layout = self.layout
layout.prop(self, "blur_size")
layout.prop_search(
self, "mask_strip_name",
context.scene.sequence_editor, "strips",
text="Mask Strip",
)
def execute(self, context): def execute(self, context):
seq_editor = context.scene.sequence_editor seq_editor = context.scene.sequence_editor
video_strip = seq_editor.active_strip video_strip = seq_editor.active_strip
# Find mask strip # Auto-detect mask strip
if not self.mask_strip_name: mask_name = f"{video_strip.name}_mask"
# Try to find auto-generated mask mask_strip = seq_editor.strips.get(mask_name)
auto_mask_name = f"{video_strip.name}_mask"
if auto_mask_name in seq_editor.strips:
self.mask_strip_name = auto_mask_name
else:
self.report({'ERROR'}, "Please select a mask strip")
return {'CANCELLED'}
mask_strip = seq_editor.strips.get(self.mask_strip_name)
if not mask_strip: if not mask_strip:
self.report({'ERROR'}, f"Mask strip not found: {self.mask_strip_name}") self.report({'ERROR'}, f"Mask strip not found: {mask_name}")
return {'CANCELLED'} return {'CANCELLED'}
try: try: