Welcome to mirror list, hosted at ThFree Co, Russian Federation.

menu_contextual.py « ui « power_sequencer - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 416284482b9e0399ad8d88263cae279325e059b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors

# This file is part of Power Sequencer.

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"
        )