Markers: Make marker lines in sequencer and graph editor optional
authorJacques Lucke <mail@jlucke.com>
Mon, 18 Feb 2019 09:42:06 +0000 (10:42 +0100)
committerJacques Lucke <mail@jlucke.com>
Mon, 18 Feb 2019 09:42:06 +0000 (10:42 +0100)
- Makes it possible to show a vertical line for every marker in the graph editor.
- Makes the marker line visiblity optional in the sequencer and graph editor.

Request from @hjalti.

Reviewers: brecht

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

release/scripts/startup/bl_ui/space_graph.py
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/blenkernel/BKE_blender_version.h
source/blender/blenloader/intern/versioning_280.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_space.c

index 67fe7b22b05af8c711a9228263cadddc6fc752b8..e7db1d613f2ad15c816aa7c554b4d2dc6fd92467 100644 (file)
@@ -120,6 +120,7 @@ class GRAPH_MT_view(Menu):
         layout.prop(st, "show_cursor")
         layout.prop(st, "show_sliders")
         layout.prop(st, "show_group_colors")
+        layout.prop(st, "show_marker_lines")
         layout.prop(st, "use_auto_merge_keyframes")
 
         layout.separator()
index 9f748a923a59af0ce718c968e9680ccd806149c7..5c692e1e2106cdfcb074687b77bad07c802f8bdf 100644 (file)
@@ -212,6 +212,7 @@ class SEQUENCER_MT_view(Menu):
             layout.prop(st, "show_seconds")
             layout.prop(st, "show_frame_indicator")
             layout.prop(st, "show_strip_offset")
+            layout.prop(st, "show_marker_lines")
 
             layout.prop_menu_enum(st, "waveform_display_type")
 
index 454d121c8cad090f079166b56e3b86acdbb306a1..84d05c6b23c3819186e997153f037c691826c8da 100644 (file)
@@ -24,7 +24,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      44
+#define BLENDER_SUBVERSION      45
 /* Several breakages with 280, e.g. collections vs layers */
 #define BLENDER_MINVERSION      280
 #define BLENDER_MINSUBVERSION   0
index 154abbab04a4f5db268cbf8810509d950b91a7d1..cfba6f803c9d4974d5f1469ff826d7feb86f558e 100644 (file)
@@ -2804,8 +2804,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                }
        }
 
+       if (!MAIN_VERSION_ATLEAST(bmain, 280, 45)) {
+               for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+                       for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+                               for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+                                       if (sl->spacetype == SPACE_SEQ) {
+                                               SpaceSeq *sseq = (SpaceSeq *)sl;
+                                               sseq->flag |= SEQ_SHOW_MARKER_LINES;
+                                       }
+                               }
+                       }
+               }
+       }
+
        {
                /* Versioning code until next subversion bump goes here. */
-
        }
 }
index a0a84d722898abc3e2ce2a0e60c98b83ee480421..9892660c59cf324ccf4c8880cbca6aeaf1998258 100644 (file)
@@ -322,7 +322,11 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
 
        /* markers */
        UI_view2d_view_orthoSpecial(ar, v2d, 1);
-       ED_markers_draw(C, DRAW_MARKERS_MARGIN);
+       int marker_draw_flag = DRAW_MARKERS_MARGIN;
+       if (sipo->flag & SIPO_MARKER_LINES) {
+               marker_draw_flag |= DRAW_MARKERS_LINES;
+       }
+       ED_markers_draw(C, marker_draw_flag);
 
        /* preview range */
        UI_view2d_view_ortho(v2d);
index 5f0195effbeb48cb5df0a843d0a0dbab03c4611d..089a30bcf5eab3e6534966560481e1c3bdc413ab 100644 (file)
@@ -1724,7 +1724,11 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 
        /* markers */
        UI_view2d_view_orthoSpecial(ar, v2d, 1);
-       ED_markers_draw(C, DRAW_MARKERS_LINES | DRAW_MARKERS_MARGIN);
+       int marker_draw_flag = DRAW_MARKERS_MARGIN;
+       if (sseq->flag & SEQ_SHOW_MARKER_LINES) {
+               marker_draw_flag |= DRAW_MARKERS_LINES;
+       }
+       ED_markers_draw(C, marker_draw_flag);
 
        /* preview range */
        UI_view2d_view_ortho(v2d);
index fbd18543991bc71d0b7a538355d8a259f4f55523..e1a917b4e38d36da0d84b3b107685880a94a0696 100644 (file)
@@ -116,7 +116,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene)
        sseq->chanshown = 0;
        sseq->view = SEQ_VIEW_SEQUENCE;
        sseq->mainb = SEQ_DRAW_IMG_IMBUF;
-       sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA;
+       sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKER_LINES;
 
        /* header */
        ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
index 588171cb524cc569d95cdad12f123f12d7356684..e3d4337634e59588c775c857351ddc3ee874c6a2 100644 (file)
@@ -440,6 +440,8 @@ typedef enum eGraphEdit_Flag {
        /* normalize curves on display */
        SIPO_NORMALIZE            = (1 << 14),
        SIPO_NORMALIZE_FREEZE     = (1 << 15),
+       /* show vertical line for every marker */
+       SIPO_MARKER_LINES         = (1 << 16),
 } eGraphEdit_Flag;
 
 /* SpaceGraph.mode (Graph Editor Mode) */
@@ -581,6 +583,7 @@ typedef enum eSpaceSeq_Flag {
        SEQ_NO_WAVEFORMS            = (1 << 8), /* draw no waveforms */
        SEQ_SHOW_SAFE_CENTER        = (1 << 9),
        SEQ_SHOW_METADATA           = (1 << 10),
+       SEQ_SHOW_MARKER_LINES       = (1 << 11),
 } eSpaceSeq_Flag;
 
 /* SpaceSeq.view */
index c1fb3950f900c07e0f15cf2dccd1183a42ca3e84..fce0a187cab464acd4b7668f5528b38ca8687345 100644 (file)
@@ -3739,6 +3739,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
 
+       prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_MARKER_LINES);
+       RNA_def_property_ui_text(prop, "Show Marker Lines",
+                                "Show a vertical line for every marker");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
        prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL);
        RNA_def_property_ui_text(prop, "Show Annotation",
@@ -4135,6 +4141,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
                                 "Display groups and channels with colors matching their corresponding groups");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
 
+       prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_MARKER_LINES);
+       RNA_def_property_ui_text(prop, "Show Marker Lines",
+                                "Show a vertical line for every marker");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
        /* editing */
        prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);