[Bf-blender-cvs] [5cebcb415e7] master: VSE: Add color tags to strips

Falk David noreply at git.blender.org
Wed Sep 29 14:36:21 CEST 2021


Commit: 5cebcb415e76aaff74bc03c66414aa93b5c90e70
Author: Falk David
Date:   Wed Sep 29 14:29:32 2021 +0200
Branches: master
https://developer.blender.org/rB5cebcb415e76aaff74bc03c66414aa93b5c90e70

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

===================================================================

M	release/datafiles/userdef/userdef_default_theme.c
M	release/scripts/startup/bl_ui/space_sequencer.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_sequencer/sequencer_intern.h
M	source/blender/editors/space_sequencer/sequencer_ops.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/makesdna/DNA_sequence_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_enum_items.h
M	source/blender/makesrna/intern/rna_sequencer.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/sequencer/intern/sequencer.c

===================================================================

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 05c5a625215..6753dc8563e 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -1175,6 +1175,35 @@ const bTheme U_theme_default = {
       .color = RGBA(0x7a5441ff),
     },
   },
+  .strip_color = {
+    {
+      .color = RGBA(0xe2605bff),
+    },
+    {
+      .color = RGBA(0xf1a355ff),
+    },
+    {
+      .color = RGBA(0xf1dc55ff),
+    },
+    {
+      .color = RGBA(0x7bcc7bff),
+    },
+    {
+      .color = RGBA(0x5db6eaff),
+    },
+    {
+      .color = RGBA(0x8d59daff),
+    },
+    {
+      .color = RGBA(0xc673b8ff),
+    },
+    {
+      .color = RGBA(0x7a5441ff),
+    },
+    {
+      .color = RGBA(0x5f5f5fff),
+    },
+  },
 };
 
 /* clang-format on */
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()
 
@@ -868,6 +869,9 @@ class SEQUENCER_MT_strip(Menu):
                 layout.operator("sequencer.meta_make")
                 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")
 
@@ -964,6 +968,9 @@ class SEQUENCER_MT_context_menu(Menu):
                 layout.operator("sequencer.meta_make")
                 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,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index fc98abf619d..b04bbdfb187 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 30
+#define BLENDER_FILE_SUBVERSION 31
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 1c4a0690886..8b8b7218c0e 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -449,6 +449,12 @@ static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const Lis
 #undef SEQ_SPEED_COMPRESS_IPO_Y
 }
 
+static bool do_versions_sequencer_color_tags(Sequence *seq, void *UNUSED(user_data))
+{
+  seq->color_tag = SEQUENCE_COLOR_NONE;
+  return true;
+}
+
 static bNodeLink *find_connected_link(bNodeTree *ntree, bNodeSocket *in_socket)
 {
   LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
@@ -1614,18 +1620,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
     }
   }
 
-  /**
-   * Versioning code until next subversion bump goes here.
-   *
-   * \note Be sure to check when bumping the version:
-   * - "versioning_userdef.c", #blo_do_versions_userdef
-   * - "versioning_userdef.c", #do_versions_theme
-   *
-   * \note Keep this message at the bottom of the function.
-   */
-  {
-    /* Keep this block, even when empty. */
-
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 31)) {
     /* Swap header with the tool header so the regular header is always on the edge. */
     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
       LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
@@ -1650,5 +1645,37 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    /* Set strip color tags to SEQUENCE_COLOR_NONE. */
+    LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+      if (scene->ed != NULL) {
+        SEQ_for_each_callback(&scene->ed->seqbase, do_versions_sequencer_color_tags, NULL);
+      }
+    }
+
+    /* Show vse color tags by default. */
+    LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+      LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+        LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+          if (sl->spacetype == SPACE_SEQ) {
+            SpaceSeq *sseq = (SpaceSeq *)sl;
+            sseq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Versioning code until next subversion bump goes here.
+   *
+   * \note Be sure to check when bumping the version:
+   * - "versioning_userdef.c", #blo_do_versions_userdef
+   * - "versioning_userdef.c", #do_versions_theme
+   *
+   * \note Keep this message at the bottom of the function.
+   */
+  {
+    /* Keep this block, even when empty. */
   }
 }
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 152ef79a38f..c383c1cc4e5 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -160,7 +160,8 @@ static void blo_update_defaults_screen(bScreen *screen,
       seq->flag |= SEQ_SHOW_MARKERS | SEQ_ZOOM_TO_FIT | SEQ_USE_PROXIES | SEQ_SHOW_OVERLAY;
       seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
       seq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_NAME |
-                                    SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID;
+                                    SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID |
+                                    SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
       seq->preview_overla

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list