Sequencer: overlay display type options

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.
This commit is contained in:
Sergey Sharybin 2012-08-12 13:24:29 +00:00
parent ed564d7cb7
commit 51fafdee0c
6 changed files with 52 additions and 19 deletions

View 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

View 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);
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);
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);

View 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);

View 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);
}
}

View 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 */

View 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)