diff options
author | Falk David <filedescriptor> | 2021-09-29 15:29:32 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-09-29 15:34:01 +0300 |
commit | 5cebcb415e76aaff74bc03c66414aa93b5c90e70 (patch) | |
tree | 3f5ab94862ce9a0f5e89e974ae4851135ae495b7 /release/scripts | |
parent | ffb9577ac9a4c79483941389a052284b64930c8e (diff) |
VSE: Add color tags to strips
This patch adds color tags to VSE strips, an overlay option to toggle the colors
on and off, a section in the theme settings to define the 9 possible colors and
two ways of changing the color tag through the UI. You can change the color
through the right-click context menu, or in the strip side panel next to the
strip name.
Color tags are defined in user preferences and they can be disabled in overlay
settings.
Reviewed By: campbellbarton, ISS
Differential Revision: https://developer.blender.org/D12405
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 58 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 20 |
2 files changed, 77 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 3622154a178..7b102604587 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -241,6 +241,7 @@ class SEQUENCER_PT_sequencer_overlay(Panel): layout.prop(overlay_settings, "show_strip_name", text="Name") layout.prop(overlay_settings, "show_strip_source", text="Source") layout.prop(overlay_settings, "show_strip_duration", text="Duration") + layout.prop(overlay_settings, "show_strip_tag_color", text="Color Tags") layout.separator() @@ -869,6 +870,9 @@ class SEQUENCER_MT_strip(Menu): layout.operator("sequencer.meta_toggle", text="Toggle Meta") layout.separator() + layout.menu("SEQUENCER_MT_color_tag_picker") + + layout.separator() layout.menu("SEQUENCER_MT_strip_lock_mute") layout.separator() @@ -965,6 +969,9 @@ class SEQUENCER_MT_context_menu(Menu): layout.operator("sequencer.meta_toggle", text="Toggle Meta") layout.separator() + layout.menu("SEQUENCER_MT_color_tag_picker") + + layout.separator() layout.menu("SEQUENCER_MT_strip_lock_mute") @@ -996,6 +1003,41 @@ class SequencerButtonsPanel_Output: return cls.has_preview(context) +class SEQUENCER_PT_color_tag_picker(Panel): + bl_label = "Color Tag" + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' + bl_category = "Strip" + bl_options = {'HIDE_HEADER', 'INSTANCED'} + + @classmethod + def poll(cls, context): + return context.active_sequence_strip is not None + + def draw(self, context): + layout = self.layout + + row = layout.row(align=True) + row.operator("sequencer.strip_color_tag_set", icon="X").color = 'NONE' + for i in range(1, 10): + icon = 'SEQUENCE_COLOR_%02d' % i + row.operator("sequencer.strip_color_tag_set", icon=icon).color = 'COLOR_%02d' % i + + +class SEQUENCER_MT_color_tag_picker(Menu): + bl_label = "Set Color Tag" + + @classmethod + def poll(cls, context): + return context.active_sequence_strip is not None + + def draw(self, context): + layout = self.layout + + row = layout.row(align=True) + row.operator_enum("sequencer.strip_color_tag_set", "color", icon_only=True) + + class SEQUENCER_PT_strip(SequencerButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -1039,9 +1081,20 @@ class SEQUENCER_PT_strip(SequencerButtonsPanel, Panel): else: icon_header = 'SEQ_SEQUENCER' - row = layout.row() + row = layout.row(align=True) + row.use_property_decorate = False row.label(text="", icon=icon_header) + row.separator() row.prop(strip, "name", text="") + + sub = row.row(align=True) + if strip.color_tag == 'NONE': + sub.popover(panel="SEQUENCER_PT_color_tag_picker", text="", icon='COLOR') + else: + icon = 'SEQUENCE_' + strip.color_tag + sub.popover(panel="SEQUENCER_PT_color_tag_picker", text="", icon=icon) + + row.separator() row.prop(strip, "mute", toggle=True, icon_only=True, emboss=False) @@ -2327,8 +2380,11 @@ classes = ( SEQUENCER_MT_strip_transform, SEQUENCER_MT_strip_input, SEQUENCER_MT_strip_lock_mute, + SEQUENCER_MT_color_tag_picker, SEQUENCER_MT_context_menu, + SEQUENCER_PT_color_tag_picker, + SEQUENCER_PT_active_tool, SEQUENCER_PT_strip, diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 6efac235359..7a8b6d42cad 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1073,6 +1073,25 @@ class USERPREF_PT_theme_collection_colors(ThemePanel, CenterAlignMixIn, Panel): flow.prop(ui, "color", text=iface_("Color %d") % i, translate=False) +class USERPREF_PT_theme_strip_colors(ThemePanel, CenterAlignMixIn, Panel): + bl_label = "Strip Colors" + bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, _context): + layout = self.layout + + layout.label(icon='SEQ_STRIP_DUPLICATE') + + def draw_centered(self, context, layout): + theme = context.preferences.themes[0] + + layout.use_property_split = True + + flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) + for i, ui in enumerate(theme.strip_color, 1): + flow.prop(ui, "color", text=iface_("Color %d") % i, translate=False) + + # Base class for dynamically defined theme-space panels. # This is not registered. class PreferenceThemeSpacePanel: @@ -2348,6 +2367,7 @@ classes = ( USERPREF_PT_theme_text_style, USERPREF_PT_theme_bone_color_sets, USERPREF_PT_theme_collection_colors, + USERPREF_PT_theme_strip_colors, USERPREF_PT_file_paths_data, USERPREF_PT_file_paths_render, |