Fix errors in vse ui commit
[blender.git] / release / scripts / startup / bl_ui / space_sequencer.py
index 539ee7a6af48712e79e058ff8c5719a3e3cb3a75..f2deb127a088d54e986abd6bc24b3ff9dff19784 100644 (file)
 import bpy
 from bpy.types import Header, Menu, Panel
 from rna_prop_ui import PropertyPanel
-from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel
+from bl_ui.properties_grease_pencil_common import (
+        GreasePencilDataPanel,
+        GreasePencilPaletteColorPanel,
+        GreasePencilToolsPanel,
+        )
 from bpy.app.translations import pgettext_iface as iface_
 
 
@@ -32,26 +36,35 @@ def act_strip(context):
 
 
 def draw_color_balance(layout, color_balance):
-    col = layout.column()
+    box = layout.box()
+    split = box.split(percentage=0.35)
+    col = split.column(align=True)
     col.label(text="Lift:")
-    col.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
-    row = col.row()
-    row.prop(color_balance, "lift", text="")
-    row.prop(color_balance, "invert_lift", text="Inverse")
-
-    col = layout.column()
+    col.separator()
+    col.separator()
+    col.prop(color_balance, "")
+    col.prop(color_balance, "invert_lift", text="Invert", icon="ARROW_LEFTRIGHT")
+    split.template_color_picker(color_balance, "lift", value_slider=True,  cubic=True)
+
+    box = layout.box()
+    split = box.split(percentage=0.35)
+    col = split.column(align=True)
     col.label(text="Gamma:")
-    col.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
-    row = col.row()
-    row.prop(color_balance, "gamma", text="")
-    row.prop(color_balance, "invert_gamma", text="Inverse")
-
-    col = layout.column()
+    col.separator()
+    col.separator()
+    col.prop(color_balance, "")
+    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)
+
+    box = layout.box()
+    split = box.split(percentage=0.35)
+    col = split.column(align=True)
     col.label(text="Gain:")
-    col.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
-    row = col.row()
-    row.prop(color_balance, "gain", text="")
-    row.prop(color_balance, "invert_gain", text="Inverse")
+    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)
 
 
 class SEQUENCER_HT_header(Header):
@@ -431,15 +444,9 @@ class SEQUENCER_MT_strip(Menu):
                 layout.operator("sequencer.crossfade_sounds")
 
         layout.separator()
-
         layout.operator("sequencer.meta_make")
         layout.operator("sequencer.meta_separate")
 
-        #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
-        #      uiItemS(layout);
-        #      uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
-        #}
-
         layout.separator()
         layout.operator("sequencer.reload", text="Reload Strips")
         layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True
@@ -493,6 +500,7 @@ class SequencerButtonsPanel_Output:
 
 class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
     bl_label = "Edit Strip"
+    bl_category = "Strip"
 
     def draw(self, context):
         layout = self.layout
@@ -501,16 +509,16 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
         frame_current = scene.frame_current
         strip = act_strip(context)
 
-        split = layout.split(percentage=0.3)
+        split = layout.split(percentage=0.25)
         split.label(text="Name:")
         split.prop(strip, "name", text="")
 
-        split = layout.split(percentage=0.3)
+        split = layout.split(percentage=0.25)
         split.label(text="Type:")
         split.prop(strip, "type", text="")
 
         if strip.type != 'SOUND':
-            split = layout.split(percentage=0.3)
+            split = layout.split(percentage=0.25)
             split.label(text="Blend:")
             split.prop(strip, "blend_type", text="")
 
@@ -519,16 +527,22 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
             sub.active = (not strip.mute)
             sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
             row.prop(strip, "mute", toggle=True, icon_only=True)
-            row.prop(strip, "lock", toggle=True, icon_only=True)
+
         else:
-            row = layout.row(align=True)
-            row.prop(strip, "mute", toggle=True, icon_only=True)
-            row.prop(strip, "lock", toggle=True, icon_only=True)
+            row = layout.row()
+            row.prop(strip, "mute", toggle=True, icon_only=True, icon='MUTE_IPO_OFF')
 
-        col = layout.column()
-        sub = col.column()
+
+        col = layout.column(align=True)
+        row = col.row(align=True)
+
+        row_sub = row.row(align=True)
+        row_sub.enabled = not strip.lock
+        row_sub.prop(strip, "channel")
+        row.prop(strip, "lock", toggle=True, icon_only=True)
+
+        sub = col.column(align=True)
         sub.enabled = not strip.lock
-        sub.prop(strip, "channel")
         sub.prop(strip, "frame_start")
         sub.prop(strip, "frame_final_duration")
 
@@ -553,12 +567,11 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
 
         if elem and elem.orig_width > 0 and elem.orig_height > 0:
             col.label(text=iface_("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False)
-        else:
-            col.label(text="Original Dimension: None")
 
 
 class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
     bl_label = "Effect Strip"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -652,17 +665,39 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
             col.prop(strip, "rotation_start", text="Rotation")
 
         elif strip.type == 'MULTICAM':
-            layout.prop(strip, "multicam_source")
-
-            row = layout.row(align=True)
-            sub = row.row(align=True)
-            sub.scale_x = 2.0
-
-            sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
+            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("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="%d" % i).camera = i
+                    else:
+                        sub_1 = row.row(align=True)
+                        sub_1.enabled = True
+                        sub_1.operator("sequencer.cut_multicam", text="%d" % i).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("")
+            else:
+                col.separator()
+                col.label(text="Two or more channels are needed below this strip", icon="INFO")
 
-            row.label("Cut To")
-            for i in range(1, strip.channel):
-                row.operator("sequencer.cut_multicam", text="%d" % i).camera = i
 
         elif strip.type == 'TEXT':
             col = layout.column()
@@ -697,6 +732,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
 
 class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
     bl_label = "Strip Input"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -735,45 +771,53 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
                 split.label(text="File:")
                 split.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
 
-            layout.prop(strip.colorspace_settings, "name")
-            layout.prop(strip, "alpha_mode")
+            split = layout.split(percentage=0.4)
+            split.label(text="Color Space:")
+            split.prop(strip.colorspace_settings, "name", text="")
+
+            split = layout.split(percentage=0.4)
+            split.label(text="Alpha:")
+            split.prop(strip, "alpha_mode", text="")
 
-            layout.operator("sequencer.change_path").filter_image = True
+            layout.operator("sequencer.change_path", icon="FILESEL").filter_image = True
 
         elif seq_type == 'MOVIE':
             split = layout.split(percentage=0.2)
             split.label(text="Path:")
             split.prop(strip, "filepath", text="")
 
-            layout.prop(strip.colorspace_settings, "name")
+            split = layout.split(percentage=0.4)
+            split.label(text="Color Space:")
+            split.prop(strip.colorspace_settings, "name", text="")
 
             layout.prop(strip, "mpeg_preseek")
             layout.prop(strip, "stream_index")
 
         layout.prop(strip, "use_translation", text="Image Offset")
         if strip.use_translation:
-            col = layout.column(align=True)
-            col.prop(strip.transform, "offset_x", text="X")
-            col.prop(strip.transform, "offset_y", text="Y")
+            row = layout.row(align=True)
+            row.prop(strip.transform, "offset_x", text="X")
+            row.prop(strip.transform, "offset_y", text="Y")
 
         layout.prop(strip, "use_crop", text="Image Crop")
         if strip.use_crop:
             col = layout.column(align=True)
             col.prop(strip.crop, "max_y")
-            col.prop(strip.crop, "min_x")
+            row = col.row(align=True)
+            row.prop(strip.crop, "min_x")
+            row.prop(strip.crop, "max_x")
             col.prop(strip.crop, "min_y")
-            col.prop(strip.crop, "max_x")
 
         if not isinstance(strip, bpy.types.EffectSequence):
-            col = layout.column(align=True)
-            col.label(text="Trim Duration (hard):")
-            col.prop(strip, "animation_offset_start", text="Start")
-            col.prop(strip, "animation_offset_end", text="End")
+            layout.label(text="Trim Duration (hard):")
+            row = layout.row(align=True)
+            row.prop(strip, "animation_offset_start", text="Start")
+            row.prop(strip, "animation_offset_end", text="End")
 
-        col = layout.column(align=True)
-        col.label(text="Trim Duration (soft):")
-        col.prop(strip, "frame_offset_start", text="Start")
-        col.prop(strip, "frame_offset_end", text="End")
+        layout.label(text="Trim Duration (soft):")
+        row = layout.row(align=True)
+        row.prop(strip, "frame_offset_start", text="Start")
+        row.prop(strip, "frame_offset_end", text="End")
 
         if scene.render.use_multiview and seq_type in {'IMAGE', 'MOVIE'}:
             layout.prop(strip, "use_multiview")
@@ -791,6 +835,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
 
 class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
     bl_label = "Sound"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -827,23 +872,27 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
         if st.waveform_draw_type == 'DEFAULT_WAVEFORMS':
             layout.prop(strip, "show_waveform")
 
-        layout.prop(strip, "volume")
-        layout.prop(strip, "pitch")
-        layout.prop(strip, "pan")
+        col = layout.column(align=True)
+        col.prop(strip, "volume")
+        col.prop(strip, "pitch")
+        col.prop(strip, "pan")
 
         col = layout.column(align=True)
         col.label(text="Trim Duration (hard):")
-        col.prop(strip, "animation_offset_start", text="Start")
-        col.prop(strip, "animation_offset_end", text="End")
+        row = layout.row(align=True)
+        row.prop(strip, "animation_offset_start", text="Start")
+        row.prop(strip, "animation_offset_end", text="End")
 
         col = layout.column(align=True)
         col.label(text="Trim Duration (soft):")
-        col.prop(strip, "frame_offset_start", text="Start")
-        col.prop(strip, "frame_offset_end", text="End")
+        row = layout.row(align=True)
+        row.prop(strip, "frame_offset_start", text="Start")
+        row.prop(strip, "frame_offset_end", text="End")
 
 
 class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
     bl_label = "Scene"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -890,6 +939,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
 
 class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
     bl_label = "Mask"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -919,6 +969,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
 
 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
     bl_label = "Filter"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -953,26 +1004,25 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
             col.label(text="Distortion:")
             col.prop(strip, "undistort")
 
-        split = layout.split(percentage=0.65)
-
+        split = layout.split(percentage=0.6)
         col = split.column()
-        col.prop(strip, "use_reverse_frames", text="Backwards")
+        col.prop(strip, "use_reverse_frames", text="Reverse")
         col.prop(strip, "use_deinterlace")
 
         col = split.column()
-        col.label(text="Flip:")
-        col.prop(strip, "use_flip_x", text="X")
-        col.prop(strip, "use_flip_y", text="Y")
+        col.prop(strip, "use_flip_x", text="X Flip")
+        col.prop(strip, "use_flip_y", text="Y Flip")
 
-        col = layout.column()
-        col.label(text="Colors:")
+        layout.label("Color:")
+        col = layout.column(align=True)
         col.prop(strip, "color_saturation", text="Saturation")
         col.prop(strip, "color_multiply", text="Multiply")
-        col.prop(strip, "use_float")
+        layout.prop(strip, "use_float", text="Convert to Float")
 
 
 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
-    bl_label = "Proxy / Timecode"
+    bl_label = "Proxy/Timecode"
+    bl_category = "Strip"
 
     @classmethod
     def poll(cls, context):
@@ -1001,9 +1051,9 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
             proxy = strip.proxy
 
             flow = layout.column_flow()
-            flow.prop(sequencer, "proxy_storage")
+            flow.prop(sequencer, "proxy_storage", text='Storage')
             if sequencer.proxy_storage == 'PROJECT':
-                flow.prop(sequencer, "proxy_dir")
+                flow.prop(sequencer, "proxy_dir", text='Directory')
             else:
                 flow.prop(proxy, "use_proxy_custom_directory")
                 flow.prop(proxy, "use_proxy_custom_file")
@@ -1022,8 +1072,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
             layout.prop(proxy, "use_overwrite")
 
             col = layout.column()
-            col.label(text="Build JPEG quality")
-            col.prop(proxy, "quality")
+            col.prop(proxy, "quality", text="Build JPEG quality")
 
             if strip.type == 'MOVIE':
                 col = layout.column()
@@ -1105,6 +1154,7 @@ class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):
 
 class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
     bl_label = "Modifiers"
+    bl_category = "Modifiers"
 
     def draw(self, context):
         layout = self.layout
@@ -1186,6 +1236,14 @@ class SEQUENCER_PT_grease_pencil(GreasePencilDataPanel, SequencerButtonsPanel_Ou
     # But, it should only show up when there are images in the preview region
 
 
+class SEQUENCER_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, SequencerButtonsPanel_Output, Panel):
+    bl_space_type = 'SEQUENCE_EDITOR'
+    bl_region_type = 'UI'
+
+    # 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'
@@ -1199,7 +1257,40 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     _context_path = "scene.sequence_editor.active_strip"
     _property_type = (bpy.types.Sequence,)
-
+    bl_category = "Strip"
+
+
+classes = (
+    SEQUENCER_HT_header,
+    SEQUENCER_MT_editor_menus,
+    SEQUENCER_MT_view,
+    SEQUENCER_MT_view_toggle,
+    SEQUENCER_MT_select,
+    SEQUENCER_MT_marker,
+    SEQUENCER_MT_change,
+    SEQUENCER_MT_frame,
+    SEQUENCER_MT_add,
+    SEQUENCER_MT_add_effect,
+    SEQUENCER_MT_strip,
+    SEQUENCER_PT_edit,
+    SEQUENCER_PT_effect,
+    SEQUENCER_PT_input,
+    SEQUENCER_PT_sound,
+    SEQUENCER_PT_scene,
+    SEQUENCER_PT_mask,
+    SEQUENCER_PT_filter,
+    SEQUENCER_PT_proxy,
+    SEQUENCER_PT_preview,
+    SEQUENCER_PT_view,
+    SEQUENCER_PT_view_safe_areas,
+    SEQUENCER_PT_modifiers,
+    SEQUENCER_PT_grease_pencil,
+    SEQUENCER_PT_grease_pencil_palettecolor,
+    SEQUENCER_PT_grease_pencil_tools,
+    SEQUENCER_PT_custom_props,
+)
 
 if __name__ == "__main__":  # only for live edit.
-    bpy.utils.register_module(__name__)
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)