applyの選択を自動化
This commit is contained in:
parent
2803d6ec6d
commit
97c6b288e0
|
|
@ -26,55 +26,34 @@ class SEQUENCER_OT_apply_mask_blur(Operator):
|
||||||
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):
|
# Check if corresponding mask strip exists
|
||||||
"""Show dialog to select mask strip."""
|
mask_name = f"{strip.name}_mask"
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
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:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user