applyの選択を自動化

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

View File

@ -26,55 +26,34 @@ class SEQUENCER_OT_apply_mask_blur(Operator):
max=500,
)
mask_strip_name: StringProperty(
name="Mask Strip",
description="Name of the mask strip to use",
default="",
)
@classmethod
def poll(cls, context):
"""Check if operator can run."""
if not context.scene.sequence_editor:
return False
strip = context.scene.sequence_editor.active_strip
seq_editor = context.scene.sequence_editor
strip = seq_editor.active_strip
if not strip:
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."""
return context.window_manager.invoke_props_dialog(self)
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",
)
# Check if corresponding mask strip exists
mask_name = f"{strip.name}_mask"
return mask_name in seq_editor.strips
def execute(self, context):
seq_editor = context.scene.sequence_editor
video_strip = seq_editor.active_strip
# Find mask strip
if not self.mask_strip_name:
# Try to find auto-generated mask
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'}
# Auto-detect mask strip
mask_name = f"{video_strip.name}_mask"
mask_strip = seq_editor.strips.get(mask_name)
mask_strip = seq_editor.strips.get(self.mask_strip_name)
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'}
try: