Sequencer: overlay display type options
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 12 Aug 2012 13:24:29 +0000 (13:24 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 12 Aug 2012 13:24:29 +0000 (13:24 +0000)
Before this overlay would happen only for defined rectangle area,
now it's possible to show current / reference frames only, which
makes it possible to do more real slit view involving even displaying
frames on different monitors.

Still some work need to be done to clean interface up and support
displaying color information for reference shot.

release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_space.c

index 7b0715f..4581420 100644 (file)
@@ -75,6 +75,9 @@ class SEQUENCER_HT_header(Header):
                     row.prop(ed, "overlay_frame", text="")
                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
 
+                    row = layout.row()
+                    row.prop(st, "overlay_type", text="")
+
                 row = layout.row(align=True)
                 props = row.operator("render.opengl", text="", icon='RENDER_STILL')
                 props.sequencer = True
index 297aeb4..2a6538e 100644 (file)
@@ -798,7 +798,7 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val)
        else special_seq_update = NULL;
 }
 
-void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
+void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, int draw_overlay)
 {
        struct Main *bmain = CTX_data_main(C);
        struct ImBuf *ibuf = NULL;
@@ -836,7 +836,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
                viewrecty /= proxy_size / 100.0f;
        }
 
-       if (frame_ofs == 0) {
+       if (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
                UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
                glClearColor(col[0], col[1], col[2], 0.0);
                glClear(GL_COLOR_BUFFER_BIT);
@@ -913,17 +913,25 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
        glBegin(GL_QUADS);
 
-       if (frame_ofs) {
-               rctf tot_clip;
-               tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
-               tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
-               tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
-               tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
-
-               glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
-               glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
-               glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
-               glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
+       if (draw_overlay) {
+               if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
+                       rctf tot_clip;
+                       tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
+                       tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
+                       tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
+                       tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
+
+                       glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
+                       glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
+                       glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
+                       glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
+               }
+               else if (sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
+                       glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
+                       glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
+                       glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
+                       glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
+               }
        }
        else {
                glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
index 14d2ccd..16cf929 100644 (file)
@@ -51,7 +51,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
 
 /* sequencer_draw.c */
 void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext* C, struct Scene *scene, struct  ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset);
+void draw_image_seq(const struct bContext* C, struct Scene *scene, struct  ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, int draw_overlay);
 
 void seq_reset_imageofs(struct SpaceSeq *sseq);
 
index 34ca26a..f7362aa 100644 (file)
@@ -487,13 +487,15 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
        ScrArea *sa = CTX_wm_area(C);
        SpaceSeq *sseq = sa->spacedata.first;
        Scene *scene = CTX_data_scene(C);
+       int show_split = scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF;
        
        /* XXX temp fix for wrong setting in sseq->mainb */
        if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
 
-       draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0);
+       if (!show_split || sseq->overlay_type != SEQ_DRAW_OVERLAY_REFERENCE)
+               draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, FALSE);
 
-       if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+       if (show_split && sseq->overlay_type != SEQ_DRAW_OVERLAY_CURRENT) {
                int over_cfra;
 
                if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
@@ -501,8 +503,8 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
                else
                        over_cfra = scene->r.cfra + scene->ed->over_ofs;
 
-               if (over_cfra != scene->r.cfra)
-                       draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra);
+               if (over_cfra != scene->r.cfra || sseq->overlay_type != SEQ_DRAW_OVERLAY_RECT)
+                       draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, TRUE);
        }
 
 }
index 2ac85a0..b828247 100644 (file)
@@ -470,7 +470,7 @@ typedef struct SpaceSeq {
        int flag;
        float zoom DNA_DEPRECATED;  /* deprecated, handled by View2D now */
        int view; /* see SEQ_VIEW_* below */
-       int pad;
+       int overlay_type;
 
        struct bGPdata *gpd;        /* grease-pencil data */
 } SpaceSeq;
@@ -523,6 +523,13 @@ typedef struct MaskSpaceInfo
        char pad3[6];
 } MaskSpaceInfo;
 
+/* sseq->mainb */
+typedef enum eSpaceSeq_OverlayType {
+       SEQ_DRAW_OVERLAY_RECT = 0,
+       SEQ_DRAW_OVERLAY_REFERENCE = 1,
+       SEQ_DRAW_OVERLAY_CURRENT = 2
+} eSpaceSeq_OverlayType;
+
 /* File Selector ========================================== */
 
 /* Config and Input for File Selector */
index e325619..456df18 100644 (file)
@@ -2126,7 +2126,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
                {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
                {0, NULL, 0, NULL, NULL}
        };
-       
+
+       static EnumPropertyItem overlay_type_items[] = {
+               {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
+               {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
+               {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
        RNA_def_struct_sdna(srna, "SpaceSeq");
        RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
@@ -2204,6 +2211,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "GreasePencil");
        RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+       prop = RNA_def_property(srna, "overlay_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "overlay_type");
+       RNA_def_property_enum_items(prop, overlay_type_items);
+       RNA_def_property_ui_text(prop, "Overlay Type", "Overlay draw type");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
 }
 
 static void rna_def_space_text(BlenderRNA *brna)