[Bf-blender-cvs] [7cb65e45814] master: Cleanup: Refactor VSE overlay settings

Richard Antalik noreply at git.blender.org
Mon Sep 20 16:30:58 CEST 2021


Commit: 7cb65e45814db6559ffa48c26b3d000e0f78c4bb
Author: Richard Antalik
Date:   Mon Sep 20 16:21:40 2021 +0200
Branches: master
https://developer.blender.org/rB7cb65e45814db6559ffa48c26b3d000e0f78c4bb

Cleanup: Refactor VSE overlay settings

Move overlay flags into SequencerPreviewOverlay and
SequencerTimelineOverlay structs.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12569

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

M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 258797c18da..88cf8db686c 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -205,13 +205,14 @@ class SEQUENCER_PT_preview_overlay(Panel):
     def draw(self, context):
         ed = context.scene.sequence_editor
         st = context.space_data
+        overlay_settings = st.preview_overlay
         layout = self.layout
 
         layout.active = st.show_strip_overlay
         layout.prop(ed, "show_overlay", text="Frame Overlay")
-        layout.prop(st, "show_safe_areas", text="Safe Areas")
-        layout.prop(st, "show_metadata", text="Metadata")
-        layout.prop(st, "show_annotation", text="Annotations")
+        layout.prop(overlay_settings, "show_safe_areas", text="Safe Areas")
+        layout.prop(overlay_settings, "show_metadata", text="Metadata")
+        layout.prop(overlay_settings, "show_annotation", text="Annotations")
 
 
 class SEQUENCER_PT_sequencer_overlay(Panel):
@@ -227,23 +228,24 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
 
     def draw(self, context):
         st = context.space_data
+        overlay_settings = st.timeline_overlay
         layout = self.layout
 
         layout.active = st.show_strip_overlay
 
-        layout.prop(st, "show_strip_name", text="Name")
-        layout.prop(st, "show_strip_source", text="Source")
-        layout.prop(st, "show_strip_duration", text="Duration")
+        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.separator()
 
-        layout.prop(st, "show_strip_offset", text="Offsets")
-        layout.prop(st, "show_fcurves", text="F-Curves")
-        layout.prop(st, "show_grid", text="Grid")
+        layout.prop(overlay_settings, "show_strip_offset", text="Offsets")
+        layout.prop(overlay_settings, "show_fcurves", text="F-Curves")
+        layout.prop(overlay_settings, "show_grid", text="Grid")
 
         layout.separator()
 
-        layout.prop_menu_enum(st, "waveform_display_type")
+        layout.prop_menu_enum(overlay_settings, "waveform_display_type")
 
 
 class SEQUENCER_MT_view_cache(Menu):
@@ -1652,6 +1654,7 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel):
         layout.use_property_split = False
 
         st = context.space_data
+        overlay_settings = st.timeline_overlay
         strip = context.active_sequence_strip
         sound = strip.sound
 
@@ -1663,7 +1666,7 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel):
             split = col.split(factor=0.4)
             split.label(text="")
             split.prop(sound, "use_mono")
-            if st.waveform_display_type == 'DEFAULT_WAVEFORMS':
+            if overlay_settings.waveform_display_type == 'DEFAULT_WAVEFORMS':
                 split = col.split(factor=0.4)
                 split.label(text="")
                 split.prop(strip, "show_waveform")
@@ -2090,17 +2093,16 @@ class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):
         return is_preview and (st.display_mode == 'IMAGE')
 
     def draw_header(self, context):
-        st = context.space_data
-
-        self.layout.prop(st, "show_safe_areas", text="")
+        overlay_settings = context.space_data.preview_overlay
+        self.layout.prop(overlay_settings, "show_safe_areas", text="")
 
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
-        st = context.space_data
+        overlay_settings = context.space_data.preview_overlay
         safe_data = context.scene.safe_areas
 
-        layout.active = st.show_safe_areas
+        layout.active = overlay_settings.show_safe_areas
 
         col = layout.column()
 
@@ -2116,19 +2118,18 @@ class SEQUENCER_PT_view_safe_areas_center_cut(SequencerButtonsPanel_Output, Pane
     bl_category = "View"
 
     def draw_header(self, context):
-        st = context.space_data
-
         layout = self.layout
-        layout.active = st.show_safe_areas
-        layout.prop(st, "show_safe_center", text="")
+        overlay_settings = context.space_data.preview_overlay
+        layout.active = overlay_settings.show_safe_areas
+        layout.prop(overlay_settings, "show_safe_center", text="")
 
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
         safe_data = context.scene.safe_areas
-        st = context.space_data
+        overlay_settings = context.space_data.preview_overlay
 
-        layout.active = st.show_safe_areas and st.show_safe_center
+        layout.active = overlay_settings.show_safe_areas and overlay_settings.show_safe_center
 
         col = layout.column()
         col.prop(safe_data, "title_center", slider=True)
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index d71cb559911..63d6b9121d2 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 22
+#define BLENDER_FILE_SUBVERSION 23
 
 /* 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_260.c b/source/blender/blenloader/intern/versioning_260.c
index b71dd5a27bb..55252210a78 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -1800,7 +1800,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
             }
             case SPACE_SEQ: {
               SpaceSeq *sseq = (SpaceSeq *)sl;
-              sseq->flag |= SEQ_SHOW_GPENCIL;
+              sseq->flag |= SEQ_PREVIEW_SHOW_GPENCIL;
               break;
             }
             case SPACE_IMAGE: {
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index bf0463432db..f667361d166 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4966,7 +4966,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
         for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
           if (sl->spacetype == SPACE_SEQ) {
             SpaceSeq *sseq = (SpaceSeq *)sl;
-            sseq->flag |= SEQ_SHOW_FCURVES;
+            sseq->flag |= SEQ_TIMELINE_SHOW_FCURVES;
           }
         }
       }
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index f023813555f..bafba486c88 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1529,8 +1529,8 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
         LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
           if (sl->spacetype == SPACE_SEQ) {
             SpaceSeq *sseq = (SpaceSeq *)sl;
-            sseq->flag |= (SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME | SEQ_SHOW_STRIP_SOURCE |
-                           SEQ_SHOW_STRIP_DURATION);
+            sseq->flag |= (SEQ_SHOW_OVERLAY | SEQ_TIMELINE_SHOW_STRIP_NAME |
+                           SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_DURATION);
           }
         }
       }
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 538634f4c9e..30e7c9bde4c 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1076,7 +1076,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
           if (sl->spacetype == SPACE_SEQ) {
             SpaceSeq *sseq = (SpaceSeq *)sl;
-            sseq->flag |= SEQ_SHOW_GRID;
+            sseq->flag |= SEQ_TIMELINE_SHOW_GRID;
           }
         }
       }
@@ -1250,18 +1250,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, 23)) {
     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
       LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
         LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
@@ -1274,5 +1263,43 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    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;
+            int seq_show_safe_margins = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_MARGINS);
+            int seq_show_gpencil = (sseq->flag & SEQ_PREVIEW_SHOW_GPENCIL);
+            int seq_show_fcurves = (sseq->flag & SEQ_TIMELINE_SHOW_FCURVES);
+            int seq_show_safe_center = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_CENTER);
+            int seq_show_metadata = (sseq->flag & SEQ_PREVIEW_SHOW_METADATA);
+            int seq_show_strip_name = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME);
+            int seq_show_strip_source = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE);
+            int seq_show_strip_duration = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION);
+            int seq_show_grid =

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list