diff options
author | Nathan Lovato <nathan@gdquest.com> | 2019-09-05 18:22:37 +0300 |
---|---|---|
committer | Nathan Lovato <nathan@gdquest.com> | 2019-09-05 18:22:52 +0300 |
commit | 61d48c0a4be0ab8f71e6e1d35f0aa99c77fcfd33 (patch) | |
tree | f64d0ea88789184f45112b489598990d549788f2 /power_sequencer/ui/menu_contextual.py | |
parent | da5a1175e30c347fbce05e49e2f5f895be30bd5b (diff) |
Add the VSE addon Power Sequencer
Diffstat (limited to 'power_sequencer/ui/menu_contextual.py')
-rw-r--r-- | power_sequencer/ui/menu_contextual.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/power_sequencer/ui/menu_contextual.py b/power_sequencer/ui/menu_contextual.py new file mode 100644 index 00000000..6ba0640a --- /dev/null +++ b/power_sequencer/ui/menu_contextual.py @@ -0,0 +1,83 @@ +# +# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors +# +# This file is part of Power Sequencer. +# +# Power Sequencer 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 3 of the +# License, or (at your option) any later version. +# +# Power Sequencer 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 Power Sequencer. If +# not, see <https://www.gnu.org/licenses/>. +# +import bpy +from ..operators.utils.global_settings import SequenceTypes + + +class POWER_SEQUENCER_MT_contextual(bpy.types.Menu): + bl_label = "Power Sequencer" + # bl_idname = "SEQUENCER_MT_power_sequencer_menu" + + def draw(self, context): + layout = self.layout + + if not bpy.data.is_saved: + layout.label("Please save your project") + layout.operator("wm.save_as_mainfile", icon="SAVE_AS", text="Save as") + return + + if not context.sequences: + layout.operator( + "power_sequencer.import_local_footage", icon="SEQUENCE", text="Import local footage" + ) + return + + selection = context.selected_sequences + active_strip = context.scene.sequence_editor.active_strip + types = set([s.type for s in selection]) + + if active_strip.type == "GAMMA_CROSS": + layout.operator( + "power_sequencer.crossfade_edit", icon="ACTION_TWEAK", text="Edit crossfade" + ) + + for t in types: + if t in SequenceTypes.VIDEO: + layout.operator("power_sequencer.fade_add", icon="IMAGE_ALPHA", text="Fade strips") + break + + if len(selection) == 1: + for s in [active_strip, selection[0]]: + if s.type in SequenceTypes.VIDEO or s.type in SequenceTypes.IMAGE: + layout.separator() + layout.operator( + "power_sequencer.crossfade_add", icon="IMAGE_ALPHA", text="Auto crossfade" + ) + break + + # TODO: Doesn't work from the menu, I guess there's an issue with the invoke method? + # layout.separator() + # layout.operator('power_sequencer.grab_closest_handle_or_cut', icon='SNAP_SURFACE', text='Grab cut or handle') + + if len(selection) > 1: + layout.separator() + + layout.operator( + "power_sequencer.ripple_delete", icon="AUTOMERGE_ON", text="Ripple delete" + ) + layout.operator( + "power_sequencer.snap_selection", icon="SNAP_ON", text="Snap selection" + ) + + layout.separator() + + layout.operator( + "power_sequencer.import_local_footage", icon="SEQUENCE", text="Import local footage" + ) + layout.operator( + "power_sequencer.render_video", icon="RENDER_ANIMATION", text="Render video for the web" + ) |