Created
June 7, 2019 20:20
-
-
Save tin2tin/7bbba34bed2c8e76c9fef7c3a5eec301 to your computer and use it in GitHub Desktop.
VSE Reworked for official 2.80 - adds several functions integrated into the menus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ##### BEGIN GPL LICENSE BLOCK ##### | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; either version 2 | |
# of the License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software Foundation, | |
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
# | |
# ##### END GPL LICENSE BLOCK ##### | |
# <pep8 compliant> | |
import bpy | |
from bpy.types import ( | |
Header, | |
Menu, | |
Panel, | |
) | |
from bpy.app.translations import ( | |
contexts as i18n_contexts, | |
pgettext_iface as iface_, | |
) | |
#from .properties_grease_pencil_common import ( | |
# AnnotationDataPanel, | |
# GreasePencilToolsPanel, | |
#) | |
from rna_prop_ui import PropertyPanel | |
import time | |
from bpy.types import Operator | |
from operator import attrgetter | |
from bpy.props import ( | |
IntProperty, | |
BoolProperty, | |
EnumProperty, | |
StringProperty, | |
) | |
def act_strip(context): | |
try: | |
return context.scene.sequence_editor.active_strip | |
except AttributeError: | |
return None | |
def selected_sequences_len(context): | |
selected_sequences = getattr(context, "selected_sequences", None) | |
if selected_sequences is None: | |
return 0 | |
return len(selected_sequences) | |
def draw_color_balance(layout, color_balance): | |
layout.use_property_split = False | |
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) | |
col = flow.column() | |
box = col.box() | |
split = box.split(factor=0.35) | |
col = split.column(align=True) | |
col.label(text="Lift:") | |
col.separator() | |
col.separator() | |
col.prop(color_balance, "lift", text="") | |
col.prop(color_balance, "invert_lift", text="Invert", icon='ARROW_LEFTRIGHT') | |
split.template_color_picker(color_balance, "lift", value_slider=True, cubic=True) | |
col = flow.column() | |
box = col.box() | |
split = box.split(factor=0.35) | |
col = split.column(align=True) | |
col.label(text="Gamma:") | |
col.separator() | |
col.separator() | |
col.prop(color_balance, "gamma", text="") | |
col.prop(color_balance, "invert_gamma", text="Invert", icon='ARROW_LEFTRIGHT') | |
split.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True) | |
col = flow.column() | |
box = col.box() | |
split = box.split(factor=0.35) | |
col = split.column(align=True) | |
col.label(text="Gain:") | |
col.separator() | |
col.separator() | |
col.prop(color_balance, "gain", text="") | |
col.prop(color_balance, "invert_gain", text="Invert", icon='ARROW_LEFTRIGHT') | |
split.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True) | |
def is_2_input_effect(strip): | |
return strip.type in { | |
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', | |
'WIPE', 'COLORMIX', | |
} | |
def is_1_input_effect(strip): | |
return strip.type in { | |
'GLOW', 'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', | |
} | |
def is_effect(strip): | |
return is_2_input_effect(strip) or is_1_input_effect(strip) | |
class SEQUENCER_OT_select_strips_under_playhead(bpy.types.Operator): | |
"""Select strips under playhead""" | |
bl_idname = "sequencer.select_under_playhead" | |
bl_label = "Select strips under playhead" | |
bl_description = "Select strips under playhead" | |
bl_options = {"REGISTER", "UNDO"} | |
extend: BoolProperty( | |
name="Extend", | |
description="Extend selection", | |
default=False, | |
) | |
@classmethod | |
def poll(cls, context): | |
return bpy.context.area.type == 'SEQUENCE_EDITOR' and bpy.context.scene.sequence_editor | |
def execute(self, context): | |
cfra = bpy.context.scene.frame_current | |
strips = [s for s in context.sequences | |
if s.frame_final_end >= cfra and | |
s.frame_final_start <= cfra] | |
if not self.extend: | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for strip in strips: | |
strip.select = True | |
context.scene.sequence_editor.active_strip = strip | |
return {"FINISHED"} | |
class SEQUENCER_OT_select_strips_in_channel(Operator): | |
"""Select all strips in channels with selected strips""" | |
bl_idname = "sequencer.select_channel_strips" | |
bl_label = "Select Channel Strips" | |
bl_description = "Select all strips in channels with selected strips" | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
return act_strip(context) | |
def execute(self, context): | |
selection = bpy.context.selected_sequences | |
sequences = bpy.context.scene.sequence_editor.sequences_all | |
for s in selection: | |
for strip in sequences: | |
if strip.channel == s.channel: | |
strip.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_cut_hard_and_hold(bpy.types.Operator): | |
"""Freeze frames from playhead position""" | |
bl_idname = "sequencer.cut_hard_and_hold" | |
bl_label = "Freeze Frames" | |
bl_description = "Freeze frames from playhead position" | |
bl_options = {"REGISTER", "UNDO"} | |
@classmethod | |
def poll(cls, context): | |
return act_strip(context) | |
def execute(self, context): | |
scene = bpy.context.scene | |
sequencer = bpy.ops.sequencer | |
selection = bpy.context.selected_sequences | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
bpy.ops.sequencer.select_under_playhead(False) | |
cf_selection = bpy.context.selected_sequences | |
for s in cf_selection: | |
for sel in selection: | |
if s == sel and not is_effect(s): | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
s_end = s.frame_final_end | |
sequencer.cut(frame=scene.frame_current, type='HARD', side='RIGHT') | |
bpy.ops.sequencer.delete() | |
s.select = True | |
s.frame_final_end = s_end | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for s in selection: s.select = True | |
return {"FINISHED"} | |
class SEQUENCER_OT_audio_mute_toggle(bpy.types.Operator): | |
"""Toggle audio on/off""" | |
bl_idname = "screen.audio_mute_toggle" | |
bl_label = "Audio Mute Toggle" | |
bl_description = "Toggle all audio on/off" | |
bl_options = {"REGISTER", "UNDO"} | |
@classmethod | |
def poll(cls, context): | |
if context.sequences: | |
return True | |
return False | |
def execute(self, context): | |
bpy.context.scene.use_audio = not bpy.context.scene.use_audio | |
return {'FINISHED'} | |
class SEQUENCER_OT_range_selected(bpy.types.Operator): | |
"""Sets preview range to selected strips""" | |
bl_idname = "sequencer.range_selected" | |
bl_label = "Range Selected" | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
return bpy.context.scene is not None | |
def execute(self, context): | |
scene = bpy.context.scene | |
selectedStrips = bpy.context.selected_sequences | |
reference = 0 | |
for strip in selectedStrips: | |
if strip.frame_final_end > reference: | |
reference = strip.frame_final_end | |
for strip in selectedStrips: | |
stripStart = strip.frame_start + strip.frame_offset_start | |
if (stripStart < reference): | |
reference = stripStart | |
scene.frame_start = reference | |
scene.frame_preview_start = reference | |
for strip in selectedStrips: | |
if (strip.frame_final_end > reference): | |
reference = strip.frame_final_end - 1 | |
scene.frame_end = reference | |
scene.frame_preview_end = reference | |
return {'FINISHED'} | |
class SEQUENCER_OT_split_remove(bpy.types.Operator): | |
"""Splits selected strips and removes""" | |
bl_idname = "sequencer.split_remove" | |
bl_label = "Split Remove" | |
bl_options = {'REGISTER', 'UNDO'} | |
direction: EnumProperty( | |
name="Direction", description="Split Extract Direction", | |
items=( | |
('LEFT', "Left", "Split Extract Direction Left"), | |
('RIGHT', "Right", "Split Extract Direction Right"), | |
), | |
) | |
method: EnumProperty( | |
name="Method", description="Split Remove Method", | |
items=( | |
('EXTRACT', "Extract", "Split Extract"), | |
('LIFT', "Lift", "Split Lift"), | |
), | |
) | |
@classmethod | |
def poll(cls, context): | |
if context.sequences: | |
return True | |
return False | |
def execute(self, context): | |
scene = bpy.context.scene | |
sequencer = bpy.ops.sequencer | |
selection = bpy.context.selected_sequences | |
if not selection: | |
return {'CANCELLED'} | |
#Get current frame selection: | |
bpy.ops.sequencer.select_under_playhead(False) | |
cf_selection = bpy.context.selected_sequences | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for s in selection: | |
for i in cf_selection: | |
if not s.lock and s == i: | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
sequencer.cut(frame=scene.frame_current, type='SOFT', side=self.direction) | |
if self.method == "EXTRACT": | |
sequencer.ripple_delete() | |
else: | |
sequencer.delete_lift() | |
s.select = False | |
for s in selection: s.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_delete_lift(bpy.types.Operator): | |
"""Lift selected strips""" | |
bl_idname = "sequencer.delete_lift" | |
bl_label = "Lift Selection" | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
if context.sequences: | |
return True | |
return False | |
def execute(self, context): | |
selection = context.selected_sequences | |
if not selection: | |
return {'CANCELLED'} | |
for s in selection: | |
if not s.lock: | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
bpy.ops.sequencer.delete() | |
s.select = False | |
for s in selection: s.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_ripple_delete(bpy.types.Operator): | |
"""Ripple delete selected strips""" | |
bl_idname = "sequencer.ripple_delete" | |
bl_label = "Ripple Delete Selection" | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
if context.sequences: | |
return True | |
return False | |
def execute(self, context): | |
selection = context.selected_sequences | |
selection = sorted(selection, key=attrgetter('channel', 'frame_final_start')) | |
if not selection: | |
return {'CANCELLED'} | |
for seq in selection: | |
if seq.lock == False: | |
context.scene.sequence_editor.active_strip = seq # set as active or it won't work | |
distance = (seq.frame_final_end - seq.frame_final_start) | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
seq.select = True | |
bpy.ops.sequencer.select_active_side(side='RIGHT') # Select to the right | |
seq.select=False | |
seqs = context.selected_sequences | |
bpy.ops.sequencer.select_all(action='DESELECT') # cut only active strip | |
seq.select=True | |
seq_out=seq.frame_final_end | |
bpy.ops.sequencer.delete() | |
seqs=sorted(seqs, key=attrgetter('channel', 'frame_final_start')) | |
# delete effect strips(ex. dissolves) if they are adjoined selected strips: | |
if len(seqs)-1 > 1: | |
if seqs[1].type in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
seqs[1].select=True | |
#distance=distance + (seqs[1].frame_final_duration) # can't get the duration of the transition? | |
bpy.ops.sequencer.delete() | |
distance=-distance | |
for s in seqs: | |
if s.lock == True: | |
break | |
if s.type not in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
s.frame_start += distance | |
return {'FINISHED'} | |
class SEQUENCER_OT_move(bpy.types.Operator): | |
"""Move selection""" | |
bl_idname = "sequencer.move" | |
bl_label = "Move" | |
bl_options = {'REGISTER', 'UNDO'} | |
direction: EnumProperty( | |
name="Direction", description="Move", | |
items=( | |
('UP', "Up", "Move Selection Up"), | |
('DOWN', "Down", "Move Selection Down"), | |
('LEFT', "Left", "Move Selection Left"), | |
('RIGHT', "Right", "Move Selection Right"), | |
), | |
) | |
@classmethod | |
def poll(cls, context): | |
return bpy.context.scene is not None | |
def execute(self, context): | |
selection = context.selected_sequences | |
selection = sorted(selection, key=attrgetter('channel', 'frame_final_start')) | |
if self.direction == "UP": | |
selection.reverse() | |
if not selection: | |
return {'CANCELLED'} | |
for s in selection: | |
if not s.lock and s.type not in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
current_start = s.frame_final_start | |
current_channel = s.channel | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
context.scene.sequence_editor.active_strip = s | |
if self.direction == "UP": | |
if (s.channel < 32): | |
s.channel += 1 | |
elif self.direction == "DOWN": | |
if (s.channel > 1): | |
s.channel -= 1 | |
elif self.direction == "LEFT": | |
bpy.ops.transform.seq_slide(value=(-25, 0)) | |
if s.frame_final_start == current_start: | |
bpy.ops.sequencer.swap(side='LEFT') | |
elif self.direction == "RIGHT": | |
bpy.ops.transform.seq_slide(value=(25, 0)) | |
if s.frame_final_start == current_start: | |
bpy.ops.sequencer.swap(side='RIGHT') | |
s.select = False | |
for s in selection: s.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_match_frame(bpy.types.Operator): | |
"""Add full source to empty channel and match frame""" | |
bl_idname = "sequencer.match_frame" | |
bl_label = "Match Frame" | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
return bpy.context.scene is not None | |
def execute(self, context): | |
selection = context.selected_sequences | |
selection = sorted(selection, key=attrgetter('channel', 'frame_final_start')) | |
if not selection: | |
return {'CANCELLED'} | |
for seq in selection: | |
if seq.type not in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
# Find empty channel: | |
sequences = bpy.context.sequences | |
if not sequences: | |
return 1 | |
channels = [s.channel for s in sequences] | |
channels = sorted(list(set(channels))) | |
empty_channel = channels[-1] + 1 | |
# Duplicate strip to first empty channel and clear offsets | |
if empty_channel < 33: | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
seq.select = True | |
context.scene.sequence_editor.active_strip = seq # set as active or it won't work | |
bpy.ops.sequencer.duplicate_move( | |
SEQUENCER_OT_duplicate={"mode":'TRANSLATION'}, | |
TRANSFORM_OT_seq_slide={ | |
"value":(0, empty_channel-seq.channel), | |
"snap":False, | |
"snap_target":'CLOSEST', | |
"snap_point":(0, 0, 0), | |
"snap_align":False, | |
"snap_normal":(0, 0, 0), | |
"release_confirm":False, | |
"use_accurate":False}, | |
) | |
bpy.ops.sequencer.offset_clear() | |
#re-select previous selection | |
for seq in selection: | |
seq.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_split(bpy.types.Operator): | |
"""Split unlocked un/seleted strips""" | |
bl_idname = "sequencer.split" | |
bl_label = "Split Soft" | |
bl_options = {'REGISTER', 'UNDO'} | |
type: EnumProperty( | |
name="Type", description="Split Type", | |
items=( | |
('SOFT', "Soft", "Split Soft"), | |
('HARD', "Hard", "Split Hard"), | |
), | |
) | |
@classmethod | |
def poll(cls, context): | |
if context.sequences: | |
return True | |
return False | |
def execute(self, context): | |
selection = context.selected_sequences | |
sequences = bpy.context.scene.sequence_editor.sequences_all | |
cf = bpy.context.scene.frame_current | |
at_cursor = [] | |
cut_selected = False | |
#find unlocked strips at cursor | |
for s in sequences: | |
if s.frame_final_start<=cf and s.frame_final_end > cf: | |
if s.lock == False: | |
at_cursor.append(s) | |
if s.select == True: | |
cut_selected = True | |
for s in at_cursor: | |
if cut_selected: | |
if s.select: #only cut selected | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
bpy.ops.sequencer.cut(frame=bpy.context.scene.frame_current, type = self.type, side='RIGHT') | |
# add new strip to selection | |
for i in bpy.context.scene.sequence_editor.sequences_all: | |
if i.select: selection.append(i) | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for s in selection: s.select = True | |
else: #cut unselected | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
s.select = True | |
bpy.ops.sequencer.cut(frame=bpy.context.scene.frame_current, type = self.type) | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for s in selection: s.select = True | |
return {'FINISHED'} | |
class SEQUENCER_OT_extend_to_fill(bpy.types.Operator): | |
"""Extend to fill gaps after selected strips""" | |
bl_idname = 'sequencer.extend_to_fill' | |
bl_label = 'Extend to Fill' | |
bl_description = 'Extend selected strips forward to fill adjacent space' | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
current_scene = context.scene | |
if current_scene and current_scene.sequence_editor: | |
return True | |
else: | |
return False | |
def execute(self, context): | |
current_scene = context.scene | |
current_sequence = current_scene.sequence_editor | |
selection = context.selected_sequences | |
meta_level = len(current_sequence.meta_stack) | |
if meta_level > 0: | |
current_sequence = current_sequence.meta_stack[meta_level - 1] | |
if not selection: | |
return {'CANCELLED'} | |
error = False | |
for strip in selection: | |
if strip.lock == False and strip.type not in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
current_channel = strip.channel | |
current_end = strip.frame_final_end | |
new_end = 300000 | |
for i in current_sequence.sequences: | |
next_start = i.frame_final_start | |
if (i.channel == current_channel and next_start+1 > current_end): | |
if next_start < new_end: | |
new_end = next_start | |
if new_end == 300000 and current_end < current_scene.frame_end: | |
new_end = current_scene.frame_end | |
if new_end == 300000 or new_end == current_end: | |
error = True | |
else: | |
error = False | |
strip.frame_final_end = new_end | |
if error: | |
return {'CANCELLED'} | |
return {'FINISHED'} | |
class SEQUENCER_OT_concatenate(bpy.types.Operator): | |
"""Concatenate gaps after selected strips""" | |
bl_idname = 'sequencer.concatenate' | |
bl_label = 'Concatenate' | |
bl_description = 'Concatenate space after selected strips' | |
bl_options = {'REGISTER', 'UNDO'} | |
@classmethod | |
def poll(cls, context): | |
current_scene = context.scene | |
if current_scene and current_scene.sequence_editor: | |
return True | |
else: | |
return False | |
def execute(self, context): | |
current_scene = context.scene | |
current_sequence = current_scene.sequence_editor | |
selection = context.selected_sequences | |
meta_level = len(current_sequence.meta_stack) | |
if meta_level > 0: | |
current_sequence = current_sequence.meta_stack[meta_level - 1] | |
if not selection: | |
return {'CANCELLED'} | |
error = False | |
for strip in selection: | |
if strip.lock == False and strip.type not in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'SPEED', 'GAUSSIAN_BLUR', 'COLORMIX', | |
}: | |
current_channel = strip.channel | |
current_end = strip.frame_final_end | |
new_end = 300000 | |
for i in current_sequence.sequences: | |
next_start = i.frame_final_start | |
if (i.channel == current_channel and next_start-1 > current_end): | |
if next_start < new_end: | |
new_end = next_start | |
if new_end == 300000 and current_end < current_scene.frame_end: | |
new_end = current_scene.frame_end | |
if new_end == 300000 or new_end == current_end: | |
error = True | |
else: | |
# Add color strips in gaps and use ripple delete to extract them | |
error = False | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
bpy.ops.sequencer.effect_strip_add( | |
frame_start=current_end, | |
frame_end=new_end, | |
channel=current_channel, | |
type='COLOR', | |
) | |
bpy.ops.sequencer.ripple_delete() | |
bpy.ops.sequencer.select_all(action='DESELECT') | |
for s in selection: s.select = True | |
if error: | |
return {'CANCELLED'} | |
return {'FINISHED'} | |
class SEQUENCER_OT_split_mode(bpy.types.Operator): | |
"""Split either selected or all unselected strips at current frame with preview""" | |
bl_idname = "sequencer.split_mode" | |
bl_label = "Split Mode..." | |
@classmethod | |
def poll(cls, context): | |
current_scene = context.scene | |
if current_scene and current_scene.sequence_editor: | |
return True | |
else: | |
return False | |
def execute(self, context): | |
region = context.region | |
x, y = region.view2d.region_to_view(*self.mouse_path[-1] ) | |
context.scene.frame_set(x) | |
def modal(self, context, event): | |
context.area.tag_redraw() | |
region = context.region | |
if event.type == 'MOUSEMOVE': | |
self.mouse_path.append((event.mouse_region_x, event.mouse_region_y)) | |
self.execute(context) | |
elif event.type == 'LEFTMOUSE' and event.value == 'PRESS': | |
bpy.ops.sequencer.split(type = 'SOFT') | |
elif event.type in {'RIGHTMOUSE', 'ESC'}: | |
return {'FINISHED'} | |
return {'RUNNING_MODAL'} | |
def invoke(self, context, event): | |
args = (self, context) | |
self.mouse_path = [] | |
context.window_manager.modal_handler_add(self) | |
return {'RUNNING_MODAL'} | |
############################## | |
class SEQUENCER_HT_header(Header): | |
bl_space_type = 'SEQUENCE_EDITOR' | |
def draw(self, context): | |
layout = self.layout | |
st = context.space_data | |
layout.template_header() | |
layout.prop(st, "view_type", text="") | |
SEQUENCER_MT_editor_menus.draw_collapsible(context, layout) | |
layout.separator_spacer() | |
layout.template_running_jobs() | |
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}: | |
layout.separator() | |
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}: | |
layout.separator() | |
if(bpy.context.scene.use_audio): | |
icon = "MUTE_IPO_OFF" | |
else: | |
icon = "MUTE_IPO_ON" | |
layout.operator( "screen.audio_mute_toggle", text = "", icon = icon ) | |
layout.operator("sequencer.refresh_all", icon="FILE_REFRESH", text="") | |
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}: | |
layout.prop(st, "display_mode", text="", icon_only=True) | |
if st.view_type != 'SEQUENCER': | |
layout.prop(st, "preview_channels", text="", icon_only=True) | |
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}: | |
gpd = context.gpencil_data | |
tool_settings = context.tool_settings | |
# Proportional editing | |
if gpd and gpd.use_stroke_edit_mode: | |
row = layout.row(align=True) | |
row.prop(tool_settings, "use_proportional_edit", icon_only=True) | |
if tool_settings.use_proportional_edit: | |
row.prop(tool_settings, "proportional_edit_falloff", icon_only=True) | |
class SEQUENCER_MT_editor_menus(Menu): | |
bl_idname = "SEQUENCER_MT_editor_menus" | |
bl_label = "" | |
def draw(self, context): | |
layout = self.layout | |
st = context.space_data | |
layout.menu("SEQUENCER_MT_view") | |
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}: | |
layout.menu("SEQUENCER_MT_select") | |
#layout.menu("SEQUENCER_MT_marker") | |
layout.menu("SEQUENCER_MT_add") | |
layout.menu("SEQUENCER_MT_strip") | |
class SEQUENCER_MT_view_toggle(Menu): | |
bl_label = "View Type" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.view_toggle").type = 'SEQUENCER' | |
layout.operator("sequencer.view_toggle").type = 'PREVIEW' | |
layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW' | |
class SEQUENCER_MT_view_cache(Menu): | |
bl_label = "Cache" | |
def draw(self, context): | |
layout = self.layout | |
ed = context.scene.sequence_editor | |
layout.prop(ed, "show_cache") | |
layout.separator() | |
col = layout.column() | |
col.enabled = ed.show_cache | |
col.prop(ed, "show_cache_final_out") | |
col.prop(ed, "show_cache_raw") | |
col.prop(ed, "show_cache_preprocessed") | |
col.prop(ed, "show_cache_composite") | |
class SEQUENCER_MT_range(Menu): | |
bl_label = "Range" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("anim.previewrange_set", text="Set Preview Range") | |
layout.operator("anim.previewrange_clear", text="Clear Preview Range") | |
layout.separator() | |
layout.operator("sequencer.range_selected", text="Set Range to Selected") | |
layout.separator() | |
layout.operator("anim.start_frame_set", text="Set Start Frame") | |
layout.operator("anim.end_frame_set", text="Set End Frame") | |
class SEQUENCER_MT_view(Menu): | |
bl_label = "View" | |
def draw(self, context): | |
layout = self.layout | |
st = context.space_data | |
is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'} | |
is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'} | |
if st.view_type == 'PREVIEW': | |
# Specifying the REGION_PREVIEW context is needed in preview-only | |
# mode, else the lookup for the shortcut will fail in | |
# wm_keymap_item_find_props() (see #32595). | |
layout.operator_context = 'INVOKE_REGION_PREVIEW' | |
layout.prop(st, "show_region_ui") | |
layout.operator_context = 'INVOKE_DEFAULT' | |
if st.view_type == 'SEQUENCER': | |
layout.prop(st, "show_backdrop", text="Preview as Backdrop") | |
layout.separator() | |
if is_sequencer_view: | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
layout.operator("sequencer.view_selected", text="Frame Selected") | |
layout.operator("sequencer.view_all", text="Frame All") | |
layout.operator("view2d.zoom_border", text="Zoom") | |
layout.separator() | |
layout.operator_context = 'INVOKE_DEFAULT' | |
layout.menu("SEQUENCER_MT_navigation") | |
layout.menu("SEQUENCER_MT_range") | |
layout.separator() | |
if is_preview: | |
layout.operator_context = 'INVOKE_REGION_PREVIEW' | |
layout.operator("sequencer.view_all_preview", text="Fit Preview in window") | |
layout.operator("view2d.zoom_border", text="Zoom") | |
layout.separator() | |
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) | |
for a, b in ratios: | |
layout.operator( | |
"sequencer.view_zoom_ratio", | |
text=iface_("Zoom %d:%d") % (a, b), | |
translate=False, | |
).ratio = a / b | |
layout.separator() | |
layout.operator_context = 'INVOKE_DEFAULT' | |
# # XXX, invokes in the header view | |
# layout.operator("sequencer.view_ghost_border", text="Overlay Border") | |
if is_sequencer_view: | |
layout.prop(st, "show_seconds") | |
layout.prop(st, "show_frame_indicator") | |
layout.prop(st, "show_strip_offset") | |
layout.prop(st, "show_marker_lines") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_view_cache") | |
layout.prop_menu_enum(st, "waveform_display_type") | |
if is_preview: | |
if st.display_mode == 'IMAGE': | |
layout.prop(st, "show_safe_areas") | |
layout.prop(st, "show_metadata") | |
elif st.display_mode == 'WAVEFORM': | |
layout.prop(st, "show_separate_color") | |
layout.separator() | |
layout.operator("render.opengl", text="Sequence Render Image", icon='RENDER_STILL').sequencer = True | |
props = layout.operator("render.opengl", text="Sequence Render Animation", icon='RENDER_ANIMATION') | |
props.animation = True | |
props.sequencer = True | |
layout.separator() | |
layout.menu("INFO_MT_area") | |
class SEQUENCER_MT_select_handle(Menu): | |
bl_label = "Select Handle" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.select_handles", text="Both").side = 'BOTH' | |
layout.operator("sequencer.select_handles", text="Left").side = 'LEFT' | |
layout.operator("sequencer.select_handles", text="Right").side = 'RIGHT' | |
class SEQUENCER_MT_select_channel(Menu): | |
bl_label = "Select Channel" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.select_channel_strips", text="All") | |
layout.operator("sequencer.select_active_side", text="Left").side = 'LEFT' | |
layout.operator("sequencer.select_active_side", text="Right").side = 'RIGHT' | |
class SEQUENCER_MT_select_linked(Menu): | |
bl_label = "Select Linked" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.select_linked", text="All") | |
layout.operator("sequencer.select_less", text="Less") | |
layout.operator("sequencer.select_more", text="More") | |
class SEQUENCER_MT_select_playhead(Menu): | |
bl_label = "Select Playhead" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.select_under_playhead", text="All") | |
props = layout.operator("sequencer.select", text="Left") | |
props.left_right = 'LEFT' | |
props.linked_time = True | |
props = layout.operator("sequencer.select", text="Right") | |
props.left_right = 'RIGHT' | |
props.linked_time = True | |
class SEQUENCER_MT_select(Menu): | |
bl_label = "Select" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.select_all", text="All").action = 'SELECT' | |
layout.operator("sequencer.select_all", text="None").action = 'DESELECT' | |
layout.operator("sequencer.select_all", text="Invert").action = 'INVERT' | |
layout.separator() | |
layout.operator("sequencer.select_box", text="Box Select") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_select_playhead", text="Playhead") | |
layout.menu("SEQUENCER_MT_select_handle", text="Handle") | |
layout.menu("SEQUENCER_MT_select_channel", text="Channel") | |
layout.menu("SEQUENCER_MT_select_linked", text="Linked") | |
layout.separator() | |
layout.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped") | |
class SEQUENCER_MT_marker(Menu): | |
bl_label = "Marker" | |
def draw(self, context): | |
layout = self.layout | |
st = context.space_data | |
is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'} | |
from .space_time import marker_menu_generic | |
marker_menu_generic(layout, context) | |
if is_sequencer_view: | |
layout.prop(st, "use_marker_sync") | |
class SEQUENCER_MT_change(Menu): | |
bl_label = "Change" | |
def draw(self, context): | |
layout = self.layout | |
strip = act_strip(context) | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
layout.operator_menu_enum("sequencer.change_effect_input", "swap") | |
layout.operator_menu_enum("sequencer.change_effect_type", "type") | |
prop = layout.operator("sequencer.change_path", text="Path/Files") | |
if strip: | |
stype = strip.type | |
if stype == 'IMAGE': | |
prop.filter_image = True | |
elif stype == 'MOVIE': | |
prop.filter_movie = True | |
elif stype == 'SOUND': | |
prop.filter_sound = True | |
class SEQUENCER_MT_navigation(Menu): | |
bl_label = "Navigation" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("screen.animation_play") | |
layout.separator() | |
layout.operator("sequencer.view_frame", text="Go to Playhead") | |
layout.separator() | |
props = layout.operator("sequencer.strip_jump", text="Jump to Previous Strip") | |
props.next = False | |
props.center = False | |
props = layout.operator("sequencer.strip_jump", text="Jump to Next Strip") | |
props.next = True | |
props.center = False | |
layout.separator() | |
props = layout.operator("sequencer.strip_jump", text="Jump to Previous Strip (Center)") | |
props.next = False | |
props.center = True | |
props = layout.operator("sequencer.strip_jump", text="Jump to Next Strip (Center)") | |
props.next = True | |
props.center = True | |
class SEQUENCER_MT_add(Menu): | |
bl_label = "Add" | |
bl_translation_context = i18n_contexts.operator_default | |
def draw(self, context): | |
layout = self.layout | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
bpy_data_scenes_len = len(bpy.data.scenes) | |
if bpy_data_scenes_len > 10: | |
layout.operator_context = 'INVOKE_DEFAULT' | |
layout.operator("sequencer.scene_strip_add", text="Scene...", icon='SCENE_DATA') | |
elif bpy_data_scenes_len > 1: | |
layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene", icon='SCENE_DATA') | |
else: | |
layout.menu("SEQUENCER_MT_add_empty", text="Scene", icon='SCENE_DATA') | |
del bpy_data_scenes_len | |
bpy_data_movieclips_len = len(bpy.data.movieclips) | |
if bpy_data_movieclips_len > 10: | |
layout.operator_context = 'INVOKE_DEFAULT' | |
layout.operator("sequencer.movieclip_strip_add", text="Clip...", icon='TRACKER') | |
elif bpy_data_movieclips_len > 0: | |
layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip", icon='TRACKER') | |
else: | |
layout.menu("SEQUENCER_MT_add_empty", text="Clip", icon='TRACKER') | |
del bpy_data_movieclips_len | |
bpy_data_masks_len = len(bpy.data.masks) | |
if bpy_data_masks_len > 10: | |
layout.operator_context = 'INVOKE_DEFAULT' | |
layout.operator("sequencer.mask_strip_add", text="Mask...", icon='MOD_MASK') | |
elif bpy_data_masks_len > 0: | |
layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask", icon='MOD_MASK') | |
else: | |
layout.menu("SEQUENCER_MT_add_empty", text="Mask", icon='MOD_MASK') | |
del bpy_data_masks_len | |
layout.separator() | |
layout.operator("sequencer.movie_strip_add", text="Movie", icon='FILE_MOVIE') | |
layout.operator("sequencer.sound_strip_add", text="Sound", icon='FILE_SOUND') | |
layout.operator("sequencer.image_strip_add", text="Image/Sequence", icon='FILE_IMAGE') | |
layout.separator() | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
layout.operator("sequencer.effect_strip_add", text="Color", icon='COLOR').type = 'COLOR' | |
layout.operator("sequencer.effect_strip_add", text="Text", icon='FONT_DATA').type = 'TEXT' | |
layout.separator() | |
layout.operator("sequencer.effect_strip_add", text="Adjustment Layer", icon='COLOR').type = 'ADJUSTMENT' | |
layout.operator_context = 'INVOKE_DEFAULT' | |
layout.menu("SEQUENCER_MT_add_effect", icon='SHADERFX') | |
col = layout.column() | |
col.menu("SEQUENCER_MT_add_transitions", icon='ARROW_LEFTRIGHT') | |
col.enabled = selected_sequences_len(context) >= 2 | |
class SEQUENCER_MT_add_empty(Menu): | |
bl_label = "Empty" | |
def draw(self, _context): | |
layout = self.layout | |
layout.label(text="No Items Available") | |
class SEQUENCER_MT_add_transitions(Menu): | |
bl_label = "Transitions" | |
def draw(self, context): | |
layout = self.layout | |
col = layout.column() | |
col.operator("sequencer.crossfade_sounds", text="Sound Crossfade") | |
col.separator() | |
col.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS' | |
col.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS' | |
col.separator() | |
col.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE' | |
col.enabled = selected_sequences_len(context) >= 2 | |
class SEQUENCER_MT_add_effect(Menu): | |
bl_label = "Effect Strip" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
col = layout.column() | |
col.operator("sequencer.effect_strip_add", text="Add").type = 'ADD' | |
col.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT' | |
col.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY' | |
col.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP' | |
col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER' | |
col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER' | |
col.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX' | |
col.enabled = selected_sequences_len(context) >= 2 | |
layout.separator() | |
layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM' | |
layout.separator() | |
col = layout.column() | |
col.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM' | |
col.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED' | |
col.separator() | |
col.operator("sequencer.cut_hard_and_hold", text="Freeze Frames") | |
col.separator() | |
col.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW' | |
col.operator("sequencer.effect_strip_add", text="Gaussian Blur").type = 'GAUSSIAN_BLUR' | |
col.enabled = selected_sequences_len(context) != 0 | |
class SEQUENCER_MT_transform_gaps(Menu): | |
bl_label = "Gaps" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("sequencer.gap_remove", text = "Extract at Playhead").all=False | |
layout.operator("sequencer.gap_remove", text = "Extract All").all=True | |
layout.operator("sequencer.concatenate", text = "Extract after Selection") | |
layout.separator() | |
layout.operator("sequencer.gap_insert", text = "Insert Gap") | |
class SEQUENCER_MT_transform_move(Menu): | |
bl_label = "Move in Steps" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("sequencer.move", text = "Up").direction = "UP" | |
layout.operator("sequencer.move", text = "Down").direction = "DOWN" | |
layout.operator("sequencer.move", text = "Left").direction = "LEFT" | |
layout.operator("sequencer.move", text = "Right").direction = "RIGHT" | |
class SEQUENCER_MT_strip_transform(Menu): | |
bl_label = "Transform" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("transform.transform", text="Move").mode = 'TRANSLATION' | |
layout.operator("transform.transform", text="Move/Extend from Playhead").mode = 'TIME_EXTEND' | |
layout.operator("sequencer.slip", text="Slip Strip Contents") | |
layout.separator() | |
layout.operator("sequencer.snap") | |
layout.operator("sequencer.offset_clear") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_transform_move") | |
layout.separator() | |
layout.operator_menu_enum("sequencer.swap", "side") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_transform_gaps") | |
class SEQUENCER_MT_strip_input(Menu): | |
bl_label = "Inputs" | |
def draw(self, context): | |
layout = self.layout | |
strip = act_strip(context) | |
layout.operator("sequencer.reload", text="Reload Strips") | |
layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True | |
prop = layout.operator("sequencer.change_path", text="Change Path/Files") | |
layout.operator("sequencer.swap_data", text="Swap Data") | |
if strip: | |
stype = strip.type | |
if stype == 'IMAGE': | |
prop.filter_image = True | |
elif stype == 'MOVIE': | |
prop.filter_movie = True | |
elif stype == 'SOUND': | |
prop.filter_sound = True | |
class SEQUENCER_MT_strip_lock_mute(Menu): | |
bl_label = "Lock/Mute" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.lock") | |
layout.operator("sequencer.unlock") | |
layout.separator() | |
layout.operator("sequencer.mute").unselected = False | |
layout.operator("sequencer.unmute").unselected = False | |
layout.operator("sequencer.mute", text="Mute Unselected Strips").unselected = True | |
layout.operator("sequencer.unmute", text="Unmute Deselected Strips").unselected = True | |
class SEQUENCER_MT_strip_effect(Menu): | |
bl_label = "Effect Strip" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator_menu_enum("sequencer.change_effect_input", "swap") | |
layout.operator_menu_enum("sequencer.change_effect_type", "type") | |
layout.operator("sequencer.reassign_inputs") | |
layout.operator("sequencer.swap_inputs") | |
class SEQUENCER_MT_strip_movie(Menu): | |
bl_label = "Movie Strip" | |
def draw(self, _context): | |
layout = self.layout | |
layout.operator("sequencer.rendersize") | |
layout.operator("sequencer.images_separate") | |
layout.operator("sequencer.deinterlace_selected_movies") | |
class SEQUENCER_MT_strip_delete(Menu): | |
bl_label = "Delete" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("sequencer.delete_lift", text="Lift") | |
layout.operator("sequencer.ripple_delete", text="Extract") | |
class SEQUENCER_MT_split(Menu): | |
bl_label = "Split" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("sequencer.split", text="Cut").type = "SOFT" | |
#layout.operator("sequencer.split", text="Hard").type = "HARD" | |
layout.separator() | |
layout.operator("sequencer.split_mode", text="Split Mode...") | |
layout.separator() | |
props = layout.operator("sequencer.split_remove", text="Split Extract Left") | |
props.direction = "LEFT" | |
props.method = "EXTRACT" | |
props = layout.operator("sequencer.split_remove", text="Split Extract Right") | |
props.direction = "RIGHT" | |
props.method = "EXTRACT" | |
layout.separator() | |
props = layout.operator("sequencer.split_remove", text="Split Lift Left") | |
props.direction = "LEFT" | |
props.method = "LIFT" | |
props = layout.operator("sequencer.split_remove", text="Split Lift Right") | |
props.direction = "RIGHT" | |
props.method = "LIFT" | |
class SEQUENCER_MT_strip(Menu): | |
bl_label = "Strip" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_transform") | |
# layout.separator() | |
# layout.operator("sequencer.cut", text="Cut").type = 'SOFT' | |
# layout.operator("sequencer.cut", text="Hold Cut").type = 'HARD' | |
layout.separator() | |
layout.menu("SEQUENCER_MT_split") | |
layout.separator() | |
layout.operator("sequencer.copy", text="Copy") | |
layout.operator("sequencer.paste", text="Paste") | |
layout.menu("SEQUENCER_MT_strip_delete") | |
layout.operator("sequencer.duplicate_move") | |
layout.operator("sequencer.extend_to_fill") | |
#layout.operator("sequencer.delete", text="Delete...") | |
strip = act_strip(context) | |
if strip: | |
stype = strip.type | |
if stype != 'SOUND': | |
layout.separator() | |
layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") | |
layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") | |
if stype in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'COLOR', 'SPEED', 'MULTICAM', 'ADJUSTMENT', | |
'GAUSSIAN_BLUR', 'TEXT', | |
}: | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_effect") | |
elif stype in {'MOVIE'}: | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_movie") | |
elif stype in {'IMAGE'}: | |
layout.separator() | |
layout.operator("sequencer.rendersize") | |
layout.operator("sequencer.images_separate") | |
elif stype == 'META': | |
layout.separator() | |
layout.operator("sequencer.meta_make") | |
layout.operator("sequencer.meta_separate") | |
layout.operator("sequencer.meta_toggle", text="Toggle Meta") | |
if stype != 'META': | |
layout.separator() | |
layout.operator("sequencer.meta_make") | |
layout.operator("sequencer.meta_toggle", text="Toggle Meta") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_lock_mute") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_input") | |
class SEQUENCER_MT_context_menu(Menu): | |
bl_label = "Sequencer Context Menu" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator_context = 'INVOKE_REGION_WIN' | |
# layout.operator("sequencer.cut", text="Cut").type = 'SOFT' | |
layout.menu("SEQUENCER_MT_split") | |
layout.separator() | |
layout.operator("sequencer.copy", text="Copy") | |
layout.operator("sequencer.paste", text="Paste") | |
layout.menu("SEQUENCER_MT_strip_delete") | |
layout.operator("sequencer.duplicate_move") | |
#layout.operator("sequencer.delete", text="Delete...") | |
layout.separator() | |
layout.operator("sequencer.extend_to_fill") | |
layout.operator("sequencer.slip", text="Slip Strip Contents") | |
layout.operator("sequencer.snap") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_transform_gaps") | |
strip = act_strip(context) | |
if strip: | |
stype = strip.type | |
if stype != 'SOUND': | |
layout.separator() | |
layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") | |
layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") | |
if selected_sequences_len(context) >= 2: | |
layout.separator() | |
col = layout.column() | |
col.menu("SEQUENCER_MT_add_transitions", text="Add Transition") | |
elif selected_sequences_len(context) >= 2: | |
layout.separator() | |
layout.operator("sequencer.crossfade_sounds", text="Crossfade Sounds") | |
if stype in { | |
'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', | |
'TRANSFORM', 'COLOR', 'SPEED', 'MULTICAM', 'ADJUSTMENT', | |
'GAUSSIAN_BLUR', 'TEXT', | |
}: | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_effect") | |
elif stype in {'MOVIE'}: | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_movie") | |
elif stype in {'IMAGE'}: | |
layout.separator() | |
layout.operator("sequencer.rendersize") | |
layout.operator("sequencer.images_separate") | |
elif stype == 'META': | |
layout.separator() | |
layout.operator("sequencer.meta_make") | |
layout.operator("sequencer.meta_separate") | |
layout.operator("sequencer.meta_toggle", text="Toggle Meta") | |
if stype != 'META': | |
layout.separator() | |
layout.operator("sequencer.meta_make") | |
#layout.operator("sequencer.meta_toggle", text="Toggle Meta") | |
layout.separator() | |
layout.menu("SEQUENCER_MT_strip_lock_mute") | |
class SequencerButtonsPanel: | |
bl_space_type = 'SEQUENCE_EDITOR' | |
bl_region_type = 'UI' | |
@staticmethod | |
def has_sequencer(context): | |
return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}) | |
@classmethod | |
def poll(cls, context): | |
return cls.has_sequencer(context) and (act_strip(context) is not None) | |
class SequencerButtonsPanel_Output: | |
bl_space_type = 'SEQUENCE_EDITOR' | |
bl_region_type = 'UI' | |
@staticmethod | |
def has_preview(context): | |
st = context.space_data | |
return (st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}) or st.show_backdrop | |
@classmethod | |
def poll(cls, context): | |
return cls.has_preview(context) | |
class SEQUENCER_PT_info(SequencerButtonsPanel, Panel): | |
bl_label = "Info" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
row = layout.row(align=True) | |
row.prop(strip, "name", text=strip.type.title()) | |
row.prop(strip, "lock", toggle=True, icon_only=True) | |
class SEQUENCER_PT_adjust_offset(SequencerButtonsPanel, Panel): | |
bl_label = "Offset" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
strip = act_strip(context) | |
return strip.type != 'SOUND' | |
def draw_header(self, context): | |
strip = act_strip(context) | |
self.layout.prop(strip, "use_translation", text="") | |
def draw(self, context): | |
strip = act_strip(context) | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
col = layout.column(align=True) | |
col.prop(strip.transform, "offset_x", text="Position X") | |
col.prop(strip.transform, "offset_y", text="Position Y") | |
col.active = strip.use_translation | |
class SEQUENCER_PT_adjust_crop(SequencerButtonsPanel, Panel): | |
bl_label = "Crop" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
strip = act_strip(context) | |
return strip.type != 'SOUND' | |
def draw_header(self, context): | |
strip = act_strip(context) | |
self.layout.prop(strip, "use_crop", text="") | |
def draw(self, context): | |
strip = act_strip(context) | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
col = layout.column(align=True) | |
col.prop(strip.crop, "min_x") | |
col.prop(strip.crop, "max_x") | |
col.prop(strip.crop, "max_y") | |
col.prop(strip.crop, "min_y") | |
col.active = strip.use_crop | |
class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): | |
bl_label = "Effect Strip" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type in { | |
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', | |
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED', | |
'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT', 'COLORMIX' | |
} | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
if strip.input_count > 0: | |
col = layout.column() | |
col.enabled = False | |
col.prop(strip, "input_1") | |
if strip.input_count > 1: | |
col.prop(strip, "input_2") | |
if strip.type == 'COLOR': | |
layout.prop(strip, "color") | |
elif strip.type == 'WIPE': | |
col = layout.column() | |
col.prop(strip, "transition_type") | |
col.alignment = 'RIGHT' | |
col.row().prop(strip, "direction", expand=True) | |
col = layout.column() | |
col.prop(strip, "blur_width", slider=True) | |
if strip.transition_type in {'SINGLE', 'DOUBLE'}: | |
col.prop(strip, "angle") | |
elif strip.type == 'GLOW': | |
flow = layout.column_flow() | |
flow.prop(strip, "threshold", slider=True) | |
flow.prop(strip, "clamp", slider=True) | |
flow.prop(strip, "boost_factor") | |
flow.prop(strip, "blur_radius") | |
row = layout.row() | |
row.prop(strip, "quality", slider=True) | |
row.prop(strip, "use_only_boost") | |
elif strip.type == 'SPEED': | |
layout.prop(strip, "use_default_fade", text="Stretch to input strip length") | |
if not strip.use_default_fade: | |
layout.prop(strip, "use_as_speed") | |
if strip.use_as_speed: | |
layout.prop(strip, "speed_factor") | |
else: | |
layout.prop(strip, "speed_factor", text="Frame Number") | |
layout.prop(strip, "use_scale_to_length") | |
elif strip.type == 'TRANSFORM': | |
layout = self.layout | |
col = layout.column() | |
col.prop(strip, "interpolation") | |
col.prop(strip, "translation_unit") | |
layout = layout.column(align=True) | |
layout.prop(strip, "translate_start_x", text="Position X") | |
layout.prop(strip, "translate_start_y", text="Y") | |
layout.separator() | |
col = layout.column(align=True) | |
col.prop(strip, "use_uniform_scale") | |
if strip.use_uniform_scale: | |
col = layout.column(align=True) | |
col.prop(strip, "scale_start_x", text="Scale") | |
else: | |
layout.prop(strip, "scale_start_x", text="Scale X") | |
layout.prop(strip, "scale_start_y", text="Y") | |
layout.separator() | |
layout.prop(strip, "rotation_start", text="Rotation") | |
elif strip.type == 'MULTICAM': | |
col = layout.column(align=True) | |
strip_channel = strip.channel | |
col.prop(strip, "multicam_source", text="Source Channel") | |
# The multicam strip needs at least 2 strips to be useful | |
if strip_channel > 2: | |
BT_ROW = 4 | |
col.label(text=" Cut to") | |
row = col.row() | |
for i in range(1, strip_channel): | |
if (i % BT_ROW) == 1: | |
row = col.row(align=True) | |
# Workaround - .enabled has to have a separate UI block to work | |
if i == strip.multicam_source: | |
sub = row.row(align=True) | |
sub.enabled = False | |
sub.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i | |
else: | |
sub_1 = row.row(align=True) | |
sub_1.enabled = True | |
sub_1.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i | |
if strip.channel > BT_ROW and (strip_channel - 1) % BT_ROW: | |
for i in range(strip.channel, strip_channel + ((BT_ROW + 1 - strip_channel) % BT_ROW)): | |
row.label(text="") | |
else: | |
col.separator() | |
col.label(text="Two or more channels are needed below this strip", icon='INFO') | |
elif strip.type == 'TEXT': | |
col = layout.column() | |
col.prop(strip, "text") | |
col.template_ID(strip, "font", open="font.open", unlink="font.unlink") | |
col.prop(strip, "font_size") | |
row = col.row() | |
row.prop(strip, "color") | |
row = col.row() | |
row.prop(strip, "use_shadow") | |
rowsub = row.row() | |
rowsub.active = strip.use_shadow | |
rowsub.prop(strip, "shadow_color", text="") | |
col.prop(strip, "align_x") | |
col.prop(strip, "align_y", text="Y") | |
row = col.row(align=True) | |
row.prop(strip, "location", text="Location") | |
col.prop(strip, "wrap_width") | |
layout.operator("sequencer.export_subtitles", text="Export Subtitles", icon='EXPORT') | |
col = layout.column(align=True) | |
if strip.type == 'SPEED': | |
col.prop(strip, "multiply_speed") | |
elif strip.type in {'CROSS', 'GAMMA_CROSS', 'WIPE', 'ALPHA_OVER', 'ALPHA_UNDER', 'OVER_DROP'}: | |
col.prop(strip, "use_default_fade", text="Default fade") | |
if not strip.use_default_fade: | |
col.prop(strip, "effect_fader", text="Effect Fader") | |
elif strip.type == 'GAUSSIAN_BLUR': | |
layout = layout.column(align=True) | |
layout.prop(strip, "size_x", text="Size X") | |
layout.prop(strip, "size_y", text="Y") | |
elif strip.type == 'COLORMIX': | |
layout.prop(strip, "blend_effect", text="Blend Mode") | |
row = layout.row(align=True) | |
row.prop(strip, "factor", slider=True) | |
class SEQUENCER_PT_info_input(SequencerButtonsPanel, Panel): | |
bl_label = "Input" | |
bl_parent_id = "SEQUENCER_PT_info" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type in {'MOVIE', 'IMAGE', 'SOUND'} | |
''', 'SCENE', 'MOVIECLIP', 'META', | |
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', | |
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', | |
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', | |
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX' }''' | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
scene = context.scene | |
strip = act_strip(context) | |
seq_type = strip.type | |
# draw a filename if we have one | |
if seq_type == 'IMAGE': | |
layout.prop(strip, "directory", text="") | |
# Current element for the filename | |
elem = strip.strip_elem_from_frame(scene.frame_current) | |
if elem: | |
layout.prop(elem, "filename", text="") # strip.elements[0] could be a fallback | |
layout.prop(strip.colorspace_settings, "name", text="Color Space") | |
layout.prop(strip, "alpha_mode", text="Alpha") | |
sub = layout.column(align=True) | |
sub.operator("sequencer.change_path", text="Change Data/Files", icon='FILEBROWSER').filter_image = True | |
elif seq_type == 'MOVIE': | |
layout.prop(strip, "filepath", text="") | |
layout.prop(strip.colorspace_settings, "name", text="Color Space") | |
layout.prop(strip, "mpeg_preseek") | |
layout.prop(strip, "stream_index") | |
elif seq_type == 'SOUND': | |
sound = strip.sound | |
layout.template_ID(strip, "sound", open="sound.open") | |
if sound is not None: | |
layout.prop(sound, "filepath", text="") | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
layout.alignment = 'RIGHT' | |
sub = layout.column(align=True) | |
split = sub.split(factor=0.5, align=True) | |
split.alignment = 'RIGHT' | |
if sound.packed_file: | |
split.label(text="Unpack") | |
split.operator("sound.unpack", icon='PACKAGE', text="") | |
else: | |
split.label(text="Pack") | |
split.operator("sound.pack", icon='UGLYPACKAGE', text="") | |
layout.prop(sound, "use_memory_cache") | |
if scene.render.use_multiview and seq_type in {'IMAGE', 'MOVIE'}: | |
layout.prop(strip, "use_multiview") | |
col = layout.column() | |
col.active = strip.use_multiview | |
col.row().prop(strip, "views_format", expand=True) | |
box = col.box() | |
box.active = strip.views_format == 'STEREO_3D' | |
box.template_image_stereo_3d(strip.stereo_3d_format) | |
class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel): | |
bl_label = "Sound" | |
bl_parent_id = "" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return (strip.type == 'SOUND') | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
sound = strip.sound | |
layout.template_ID(strip, "sound", open="sound.open") | |
if sound is not None: | |
layout.prop(sound, "filepath", text="") | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
layout.alignment = 'RIGHT' | |
sub = layout.column(align=True) | |
split = sub.split(factor=0.5, align=True) | |
split.alignment = 'RIGHT' | |
if sound.packed_file: | |
split.label(text="Unpack") | |
split.operator("sound.unpack", icon='PACKAGE', text="") | |
else: | |
split.label(text="Pack") | |
split.operator("sound.pack", icon='UGLYPACKAGE', text="") | |
layout.prop(sound, "use_memory_cache") | |
class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel): | |
bl_label = "Scene" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return (strip.type == 'SCENE') | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
layout.template_ID(strip, "scene") | |
scene = strip.scene | |
layout.prop(strip, "use_sequence") | |
if scene: | |
layout.prop(scene, "audio_volume", text="Volume") | |
if not strip.use_sequence: | |
layout.alignment = 'RIGHT' | |
sub = layout.column(align=True) | |
split = sub.split(factor=0.5, align=True) | |
split.alignment = 'RIGHT' | |
split.label(text="Camera Override") | |
split.template_ID(strip, "scene_camera") | |
layout.prop(strip, "use_grease_pencil", text="Show Grease Pencil") | |
if not strip.use_sequence: | |
if scene: | |
# Warning, this is not a good convention to follow. | |
# Expose here because setting the alpha from the 'Render' menu is very inconvenient. | |
# layout.label(text="Preview") | |
layout.prop(scene.render, "film_transparent") | |
class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel): | |
bl_label = "Mask" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return (strip.type == 'MASK') | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
layout.template_ID(strip, "mask") | |
mask = strip.mask | |
if mask: | |
sta = mask.frame_start | |
end = mask.frame_end | |
layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False) | |
class SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel): | |
bl_label = "Timecodes" | |
bl_category = "Strip" | |
bl_parent_id = "SEQUENCER_PT_info" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = False | |
layout.use_property_decorate = False | |
scene = context.scene | |
frame_current = scene.frame_current | |
strip = act_strip(context) | |
length_list = ( | |
str(strip.frame_start), | |
str(strip.frame_final_end), | |
str(strip.frame_final_duration), | |
str(strip.frame_offset_start), | |
str(strip.frame_offset_end), | |
) | |
if not isinstance(strip, bpy.types.EffectSequence): | |
length_list = length_list + ( | |
str(strip.animation_offset_start), | |
str(strip.animation_offset_end), | |
) | |
max_length = max(len(x) for x in length_list) | |
max_factor = (1.9 - max_length) / 30 | |
sub = layout.row(align=True) | |
sub.enabled = not strip.lock | |
split = sub.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text='Channel') | |
split.prop(strip, "channel", text="") | |
sub = layout.column(align=True) | |
sub.enabled = not strip.lock | |
split = sub.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Start") | |
split.prop(strip, "frame_start", text=str(bpy.utils.smpte_from_frame(strip.frame_start))) | |
split = sub.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="End") | |
split.prop(strip, "frame_final_end", text=str(bpy.utils.smpte_from_frame(strip.frame_final_end))) | |
split = sub.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Duration") | |
split.prop(strip, "frame_final_duration", text=str(bpy.utils.smpte_from_frame(strip.frame_final_duration))) | |
if not isinstance(strip, bpy.types.EffectSequence): | |
layout.alignment = 'RIGHT' | |
sub = layout.column(align=True) | |
split = sub.split(factor=0.5 + max_factor, align=True) | |
split.alignment = 'RIGHT' | |
split.label(text="Soft Trim Start") | |
split.prop(strip, "frame_offset_start", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_start))) | |
split = sub.split(factor=0.5 + max_factor, align=True) | |
split.alignment = 'RIGHT' | |
split.label(text='End') | |
split.prop(strip, "frame_offset_end", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_end))) | |
layout.alignment = 'RIGHT' | |
sub = layout.column(align=True) | |
split = sub.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Hard Trim Start") | |
split.prop(strip, "animation_offset_start", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_start))) | |
split = sub.split(factor=0.5 + max_factor, align=True) | |
split.alignment = 'RIGHT' | |
split.label(text='End') | |
split.prop(strip, "animation_offset_end", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_end))) | |
playhead = frame_current - strip.frame_start | |
col = layout.column(align=True) | |
col = col.box() | |
col.active = ( | |
(frame_current >= strip.frame_start) and | |
(frame_current <= strip.frame_start + strip.frame_final_duration) | |
) | |
split = col.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Playhead") | |
split.label(text="%s: %s" % ((bpy.utils.smpte_from_frame(playhead)), (str(playhead)))) | |
''' Old data - anyone missing this data? | |
col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end), | |
translate=False) | |
col.label(text=iface_("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end), translate=False)''' | |
elem = False | |
if strip.type == 'IMAGE': | |
elem = strip.strip_elem_from_frame(frame_current) | |
elif strip.type == 'MOVIE': | |
elem = strip.elements[0] | |
if strip.type != 'SOUND': | |
split = col.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Resolution") | |
if elem and elem.orig_width > 0 and elem.orig_height > 0: | |
split.label(text="%dx%d" % (elem.orig_width, elem.orig_height), translate=False) | |
else: | |
split.label(text="None") | |
if strip.type == 'SCENE': | |
scene = strip.scene | |
if scene: | |
sta = scene.frame_start | |
end = scene.frame_end | |
split = col.split(factor=0.5 + max_factor) | |
split.alignment = 'RIGHT' | |
split.label(text="Original Frame Range") | |
split.alignment = 'LEFT' | |
split.label(text="%d-%d (%d)" % (sta, end, end - sta + 1), translate=False) | |
class SEQUENCER_PT_adjust(SequencerButtonsPanel, Panel): | |
bl_label = "Adjust" | |
bl_category = "Strip" | |
def draw(self, context): | |
pass | |
class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel): | |
bl_label = "Sound" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
strip = act_strip(context) | |
return strip.type == 'SOUND' | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
st = context.space_data | |
strip = act_strip(context) | |
sound = strip.sound | |
col = layout.column() | |
row = col.row(align=True) | |
sub = row.row(align=True) | |
sub.active = (not strip.mute) | |
sub.prop(strip, "volume", text="Volume") | |
sub.prop(strip, "mute", toggle=True, icon_only=True, icon='MUTE_IPO_ON') | |
col.prop(strip, "pitch") | |
col.prop(strip, "pan") | |
if sound is not None: | |
if st.waveform_display_type == 'DEFAULT_WAVEFORMS': | |
col.prop(strip, "show_waveform") | |
col.prop(sound, "use_mono") | |
class SEQUENCER_PT_adjust_comp(SequencerButtonsPanel, Panel): | |
bl_label = "Compositing" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
strip = act_strip(context) | |
return strip.type != 'SOUND' | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
layout.prop(strip, "blend_type", text="Blend") | |
row = layout.row(align=True) | |
sub = row.row(align=True) | |
sub.active = (not strip.mute) | |
sub.prop(strip, "blend_alpha", text="Opacity", slider=True) | |
sub.prop(strip, "mute", toggle=True, icon_only=True) | |
class SEQUENCER_PT_adjust_video(SequencerButtonsPanel, Panel): | |
bl_label = "Video" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type in { | |
'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK', | |
'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER', | |
'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', | |
'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', | |
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX' | |
} | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
col = layout.column() | |
col.prop(strip, "strobe") | |
if strip.type == 'MOVIECLIP': | |
col = layout.column() | |
col.label(text="Tracker") | |
col.prop(strip, "stabilize2d") | |
col = layout.column() | |
col.label(text="Distortion") | |
col.prop(strip, "undistort") | |
col.separator() | |
col.prop(strip, "use_reverse_frames", text="Backwards") | |
col.prop(strip, "use_deinterlace") | |
col.separator() | |
col.prop(strip, "use_flip_x", text="Flip X") | |
col.prop(strip, "use_flip_y", text="Flip Y") | |
class SEQUENCER_PT_adjust_color(SequencerButtonsPanel, Panel): | |
bl_label = "Color" | |
bl_parent_id = "SEQUENCER_PT_adjust" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "Strip" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type in { | |
'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK', | |
'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER', | |
'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', | |
'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', | |
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX' | |
} | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
col = layout.column() | |
col.prop(strip, "color_saturation", text="Saturation") | |
col.prop(strip, "color_multiply", text="Multiply") | |
col.prop(strip, "use_float", text="Convert to Float") | |
class SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel): | |
bl_label = "Cache Settings" | |
bl_category = "Proxy & Cache" | |
@classmethod | |
def poll(cls, context): | |
return cls.has_sequencer(context) and context.scene.sequence_editor | |
def draw(self, context): | |
layout = self.layout | |
ed = context.scene.sequence_editor | |
layout.prop(ed, "use_cache_raw") | |
layout.prop(ed, "use_cache_preprocessed") | |
layout.prop(ed, "use_cache_composite") | |
layout.prop(ed, "use_cache_final") | |
layout.separator() | |
layout.prop(ed, "recycle_max_cost") | |
class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel): | |
bl_label = "Proxy Settings" | |
bl_category = "Proxy & Cache" | |
@classmethod | |
def poll(cls, context): | |
return cls.has_sequencer(context) and context.scene.sequence_editor | |
def draw(self, context): | |
layout = self.layout | |
ed = context.scene.sequence_editor | |
flow = layout.column_flow() | |
flow.prop(ed, "proxy_storage", text="Storage") | |
if ed.proxy_storage == 'PROJECT': | |
flow.prop(ed, "proxy_dir", text="Directory") | |
col = layout.column() | |
col.operator("sequencer.enable_proxies") | |
col.operator("sequencer.rebuild_proxy") | |
class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel): | |
bl_label = "Strip Proxy & Timecode" | |
bl_category = "Proxy & Cache" | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context) and context.scene.sequence_editor: | |
return False | |
strip = act_strip(context) | |
if not strip: | |
return False | |
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'} | |
def draw_header(self, context): | |
strip = act_strip(context) | |
self.layout.prop(strip, "use_proxy", text="") | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
ed = context.scene.sequence_editor | |
strip = act_strip(context) | |
if strip.proxy: | |
proxy = strip.proxy | |
flow = layout.column_flow() | |
if ed.proxy_storage == 'PER_STRIP': | |
flow.prop(proxy, "use_proxy_custom_directory") | |
flow.prop(proxy, "use_proxy_custom_file") | |
if proxy.use_proxy_custom_directory and not proxy.use_proxy_custom_file: | |
flow.prop(proxy, "directory") | |
if proxy.use_proxy_custom_file: | |
flow.prop(proxy, "filepath") | |
layout = layout.box() | |
row = layout.row(align=True) | |
row.prop(strip.proxy, "build_25") | |
row.prop(strip.proxy, "build_75") | |
row = layout.row(align=True) | |
row.prop(strip.proxy, "build_50") | |
row.prop(strip.proxy, "build_100") | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
layout.prop(proxy, "use_overwrite") | |
col = layout.column() | |
col.prop(proxy, "quality", text="Build JPEG Quality") | |
if strip.type == 'MOVIE': | |
col = layout.column() | |
col.prop(proxy, "timecode", text="Timecode Index") | |
class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, Panel): | |
bl_label = "Strip Cache" | |
bl_category = "Proxy & Cache" | |
bl_options = {'DEFAULT_CLOSED'} | |
@classmethod | |
def poll(cls, context): | |
if not cls.has_sequencer(context): | |
return False | |
if act_strip(context) is not None: | |
return True | |
def draw_header(self, context): | |
strip = act_strip(context) | |
self.layout.prop(strip, "override_cache_settings", text="") | |
def draw(self, context): | |
layout = self.layout | |
strip = act_strip(context) | |
layout.active = strip.override_cache_settings | |
layout.prop(strip, "use_cache_raw") | |
layout.prop(strip, "use_cache_preprocessed") | |
layout.prop(strip, "use_cache_composite") | |
class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): | |
bl_label = "Scene Preview/Render" | |
bl_space_type = 'SEQUENCE_EDITOR' | |
bl_region_type = 'UI' | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "View" | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
render = context.scene.render | |
col = layout.column() | |
col.prop(render, "sequencer_gl_preview", text="Preview Shading") | |
if render.sequencer_gl_preview in ['SOLID', 'WIREFRAME']: | |
col.prop(render, "use_sequencer_override_scene_strip") | |
class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel): | |
bl_label = "View Settings" | |
bl_category = "View" | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
st = context.space_data | |
col = layout.column() | |
col.prop(st, "display_channel", text="Channel") | |
if st.display_mode == 'IMAGE': | |
col.prop(st, "show_overexposed") | |
elif st.display_mode == 'WAVEFORM': | |
col.prop(st, "show_separate_color") | |
col.prop(st, "proxy_render_size") | |
class SEQUENCER_PT_frame_overlay(SequencerButtonsPanel_Output, Panel): | |
bl_label = "Frame Overlay" | |
bl_category = "View" | |
bl_options = {'DEFAULT_CLOSED'} | |
def draw_header(self, context): | |
scene = context.scene | |
ed = scene.sequence_editor | |
self.layout.prop(ed, "show_overlay", text="") | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
st = context.space_data | |
scene = context.scene | |
ed = scene.sequence_editor | |
layout.active = ed.show_overlay | |
col = layout.column() | |
col.prop(ed, "overlay_frame", text="Frame Offset") | |
col.prop(st, "overlay_type") | |
col.prop(ed, "use_overlay_lock") | |
class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel): | |
bl_label = "Safe Areas" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "View" | |
@classmethod | |
def poll(cls, context): | |
st = context.space_data | |
is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'} | |
return is_preview and (st.display_mode == 'IMAGE') | |
def draw_header(self, context): | |
st = context.space_data | |
self.layout.prop(st, "show_safe_areas", text="") | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
st = context.space_data | |
safe_data = context.scene.safe_areas | |
layout.active = st.show_safe_areas | |
col = layout.column() | |
sub = col.column() | |
sub.prop(safe_data, "title", slider=True) | |
sub.prop(safe_data, "action", slider=True) | |
class SEQUENCER_PT_view_safe_areas_center_cut(SequencerButtonsPanel_Output, Panel): | |
bl_label = "Center-Cut Safe Areas" | |
bl_parent_id = "SEQUENCER_PT_view_safe_areas" | |
bl_options = {'DEFAULT_CLOSED'} | |
bl_category = "View" | |
def draw_header(self, context): | |
st = context.space_data | |
layout = self.layout | |
layout.active = st.show_safe_areas | |
layout.prop(st, "show_safe_center", text="") | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
safe_data = context.scene.safe_areas | |
st = context.space_data | |
layout.active = st.show_safe_areas and st.show_safe_center | |
col = layout.column() | |
col.prop(safe_data, "title_center", slider=True) | |
class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): | |
bl_label = "Modifiers" | |
bl_category = "Modifiers" | |
def draw(self, context): | |
layout = self.layout | |
layout.use_property_split = True | |
layout.use_property_decorate = False | |
strip = act_strip(context) | |
ed = context.scene.sequence_editor | |
layout.prop(strip, "use_linear_modifiers") | |
layout.operator_menu_enum("sequencer.strip_modifier_add", "type") | |
layout.operator("sequencer.strip_modifier_copy") | |
for mod in strip.modifiers: | |
box = layout.box() | |
row = box.row() | |
row.prop(mod, "show_expanded", text="", emboss=False) | |
row.prop(mod, "name", text="") | |
row.prop(mod, "mute", text="") | |
sub = row.row(align=True) | |
props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_UP') | |
props.name = mod.name | |
props.direction = 'UP' | |
props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_DOWN') | |
props.name = mod.name | |
props.direction = 'DOWN' | |
row.operator("sequencer.strip_modifier_remove", text="", icon='X', emboss=False).name = mod.name | |
if mod.show_expanded: | |
row = box.row() | |
row.prop(mod, "input_mask_type", expand=True) | |
if mod.input_mask_type == 'STRIP': | |
sequences_object = ed | |
if ed.meta_stack: | |
sequences_object = ed.meta_stack[-1] | |
box.prop_search(mod, "input_mask_strip", sequences_object, "sequences", text="Mask") | |
else: | |
box.prop(mod, "input_mask_id") | |
row = box.row() | |
row.prop(mod, "mask_time", expand=True) | |
if mod.type == 'COLOR_BALANCE': | |
box.prop(mod, "color_multiply") | |
draw_color_balance(box, mod.color_balance) | |
elif mod.type == 'CURVES': | |
box.template_curve_mapping(mod, "curve_mapping", type='COLOR', show_tone=True) | |
elif mod.type == 'HUE_CORRECT': | |
box.template_curve_mapping(mod, "curve_mapping", type='HUE') | |
elif mod.type == 'BRIGHT_CONTRAST': | |
col = box.column() | |
col.prop(mod, "bright") | |
col.prop(mod, "contrast") | |
elif mod.type == 'WHITE_BALANCE': | |
col = box.column() | |
col.prop(mod, "white_value") | |
elif mod.type == 'TONEMAP': | |
col = box.column() | |
col.prop(mod, "tonemap_type") | |
if mod.tonemap_type == 'RD_PHOTORECEPTOR': | |
col.prop(mod, "intensity") | |
col.prop(mod, "contrast") | |
col.prop(mod, "adaptation") | |
col.prop(mod, "correction") | |
elif mod.tonemap_type == 'RH_SIMPLE': | |
col.prop(mod, "key") | |
col.prop(mod, "offset") | |
col.prop(mod, "gamma") | |
#class SEQUENCER_PT_grease_pencil(AnnotationDataPanel, SequencerButtonsPanel_Output, Panel): | |
# bl_space_type = 'SEQUENCE_EDITOR' | |
# bl_region_type = 'UI' | |
# bl_category = "View" | |
# # NOTE: this is just a wrapper around the generic GP Panel | |
# # But, it should only show up when there are images in the preview region | |
#class SEQUENCER_PT_grease_pencil_tools(GreasePencilToolsPanel, SequencerButtonsPanel_Output, Panel): | |
# bl_space_type = 'SEQUENCE_EDITOR' | |
# bl_region_type = 'UI' | |
# bl_category = "View" | |
# # NOTE: this is just a wrapper around the generic GP tools panel | |
# # It contains access to some essential tools usually found only in | |
# # toolbar, which doesn't exist here... | |
class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): | |
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} | |
_context_path = "scene.sequence_editor.active_strip" | |
_property_type = (bpy.types.Sequence,) | |
bl_category = "Strip" | |
classes = ( | |
SEQUENCER_OT_select_strips_under_playhead, | |
SEQUENCER_OT_select_strips_in_channel, | |
SEQUENCER_OT_cut_hard_and_hold, | |
SEQUENCER_OT_audio_mute_toggle, | |
SEQUENCER_OT_range_selected, | |
SEQUENCER_OT_split_remove, | |
SEQUENCER_OT_delete_lift, | |
SEQUENCER_OT_ripple_delete, | |
SEQUENCER_OT_match_frame, | |
SEQUENCER_OT_split, | |
SEQUENCER_OT_extend_to_fill, | |
SEQUENCER_OT_move, | |
SEQUENCER_OT_concatenate, | |
SEQUENCER_OT_split_mode, | |
SEQUENCER_MT_change, | |
SEQUENCER_HT_header, | |
SEQUENCER_MT_editor_menus, | |
SEQUENCER_MT_range, | |
SEQUENCER_MT_view, | |
SEQUENCER_MT_view_cache, | |
SEQUENCER_MT_view_toggle, | |
SEQUENCER_MT_select_playhead, | |
SEQUENCER_MT_select_handle, | |
SEQUENCER_MT_select_channel, | |
SEQUENCER_MT_select_linked, | |
SEQUENCER_MT_select, | |
#SEQUENCER_MT_marker, | |
SEQUENCER_MT_navigation, | |
SEQUENCER_MT_add, | |
SEQUENCER_MT_add_effect, | |
SEQUENCER_MT_add_transitions, | |
SEQUENCER_MT_add_empty, | |
SEQUENCER_MT_strip_effect, | |
SEQUENCER_MT_strip_movie, | |
SEQUENCER_MT_strip_delete, | |
SEQUENCER_MT_split, | |
SEQUENCER_MT_strip, | |
SEQUENCER_MT_transform_gaps, | |
SEQUENCER_MT_transform_move, | |
SEQUENCER_MT_strip_transform, | |
SEQUENCER_MT_strip_input, | |
SEQUENCER_MT_strip_lock_mute, | |
SEQUENCER_MT_context_menu, | |
# SEQUENCER_PT_adjust, | |
# SEQUENCER_PT_adjust_comp, | |
# SEQUENCER_PT_adjust_offset, | |
# SEQUENCER_PT_adjust_crop, | |
# SEQUENCER_PT_adjust_video, | |
# SEQUENCER_PT_adjust_color, | |
# SEQUENCER_PT_adjust_sound, | |
# SEQUENCER_PT_info, | |
# SEQUENCER_PT_info_input, | |
# SEQUENCER_PT_info_timecodes, | |
# SEQUENCER_PT_effect, | |
# SEQUENCER_PT_scene, | |
# SEQUENCER_PT_mask, | |
# SEQUENCER_PT_cache_settings, | |
# SEQUENCER_PT_strip_cache, | |
# SEQUENCER_PT_proxy_settings, | |
# SEQUENCER_PT_strip_proxy, | |
# SEQUENCER_PT_custom_props, | |
# SEQUENCER_PT_modifiers, | |
# SEQUENCER_PT_preview, | |
# SEQUENCER_PT_view, | |
# SEQUENCER_PT_frame_overlay, | |
# SEQUENCER_PT_view_safe_areas, | |
# SEQUENCER_PT_view_safe_areas_center_cut, | |
# SEQUENCER_PT_grease_pencil, | |
# SEQUENCER_PT_grease_pencil_tools, | |
) | |
if __name__ == "__main__": # only for live edit. | |
from bpy.utils import register_class | |
for cls in classes: | |
register_class(cls) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment