Sequencer drawing cleanup (Part 1)

Separated preview drawing into own ARegion, this should make using View2D possible
The Sequencer now has three view types: Sequencer, Preview and split Sequencer/Preview.

Changing the preview can be done either by the combobox in the header or toggling through those types with CTRL+TAB.

Notes:
* Icon for split Sequencer/Preview view missing still. 
* Naming items in the comboboxes can be improved (just Preview instead of Image Preview?)

Next steps:
* bringing back View2D handling (zoom/pan) for image preview
* experimenting with splitting the Preview ARegion for In/Out editing
This commit is contained in:
Andrea Weikert 2009-12-14 21:42:25 +00:00
parent fd70334242
commit 18cc2b76c2
10 changed files with 356 additions and 69 deletions

@ -44,20 +44,37 @@ class SEQUENCER_HT_header(bpy.types.Header):
row.separator()
if st.display_mode == 'SEQUENCER':
if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
sub.menu("SEQUENCER_MT_select")
sub.menu("SEQUENCER_MT_marker")
sub.menu("SEQUENCER_MT_add")
sub.menu("SEQUENCER_MT_strip")
layout.prop(st, "display_mode", text="")
layout.prop(st, "view_type", text="")
if st.display_mode == 'SEQUENCER':
if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
layout.prop(st, "display_mode", text="")
if (st.view_type == 'SEQUENCER'):
layout.separator()
layout.operator("sequencer.refresh_all")
elif (st.view_type == 'SEQUENCER_PREVIEW'):
layout.separator()
layout.operator("sequencer.refresh_all")
layout.prop(st, "display_channel", text="Channel")
else:
layout.prop(st, "display_channel", text="Channel")
class SEQUENCER_MT_view_toggle(bpy.types.Menu):
bl_label = "View Type"
def draw(self, context):
layout = self.layout
layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
layout.operator("sequencer.view_toggle").type = 'PREVIEW'
layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
class SEQUENCER_MT_view(bpy.types.Menu):
bl_label = "View"
@ -98,7 +115,10 @@ class SEQUENCER_MT_view(bpy.types.Menu):
"""
layout.separator()
layout.operator("sequencer.view_all")
if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
layout.operator("sequencer.view_all", text='View all Sequences')
if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
layout.operator("sequencer.view_all_preview", text='Fit preview in window')
layout.operator("sequencer.view_selected")
layout.prop(st, "draw_frames")
@ -262,17 +282,23 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
class SequencerButtonsPanel(bpy.types.Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
def has_sequencer(self, context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
return (context.space_data.display_mode == 'SEQUENCER') and (act_strip(context) is not None)
return self.has_sequencer(context) and (act_strip(context) is not None)
class SequencerButtonsPanel_Output(bpy.types.Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
def has_preview(self, context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
return context.space_data.display_mode != 'SEQUENCER'
return self.has_preview(context)
class SEQUENCER_PT_edit(SequencerButtonsPanel):
@ -331,7 +357,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
bl_label = "Effect Strip"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -429,7 +455,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
bl_label = "Strip Input"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -485,7 +511,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel):
bl_label = "Sound"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -519,7 +545,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel):
bl_label = "Scene"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -540,7 +566,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
bl_label = "Filter"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -590,7 +616,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel):
bl_label = "Proxy"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
if not self.has_sequencer(context):
return False
strip = act_strip(context)
@ -630,6 +656,7 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
bpy.types.register(SEQUENCER_HT_header) # header/menu classes
bpy.types.register(SEQUENCER_MT_view)
bpy.types.register(SEQUENCER_MT_view_toggle)
bpy.types.register(SEQUENCER_MT_select)
bpy.types.register(SEQUENCER_MT_marker)
bpy.types.register(SEQUENCER_MT_add)

@ -6003,6 +6003,12 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->regiontype= RGN_TYPE_UI;
ar->alignment= RGN_ALIGN_TOP;
break;
case SPACE_SEQ:
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_addtail(lb, ar);
ar->regiontype= RGN_TYPE_UI;
ar->alignment= RGN_ALIGN_TOP;
break;
case SPACE_VIEW3D:
/* toolbar */
ar= MEM_callocN(sizeof(ARegion), "toolbar for view3d");
@ -10169,6 +10175,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
{ /* fix for new view type in sequencer */
bScreen *screen;
ScrArea *sa;
SpaceLink *sl;
for(screen= main->screen.first; screen; screen= screen->id.next) {
for(sa= screen->areabase.first; sa; sa= sa->next) {
for(sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_SEQ) {
SpaceSeq *sseq = (SpaceSeq *)sl;
if (sseq->view == 0) sseq->view = SEQ_VIEW_SEQUENCE;
if (sseq->mainb == 0) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
}
}
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

@ -28,4 +28,7 @@
#define SEQ_ZOOM_FAC(szoom) (szoom > 0)? (szoom) : (szoom == 0)? (1.0) : (-1.0/szoom)
/* in space_sequencer.c, for rna update function */
void ED_sequencer_update_view(bContext *C, int view);
#endif /* ED_SEQUENCER_H */

@ -83,6 +83,7 @@
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_util.h"
#include "ED_sequencer.h"
#include "UI_interface.h"
#include "UI_resources.h"
@ -2268,45 +2269,12 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *op)
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
View2D *v2d= UI_view2d_fromcontext(C);
if (sseq->mainb==SEQ_DRAW_SEQUENCE) {
v2d->cur= v2d->tot;
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
} else {
/* Like zooming on an image view */
float zoomX, zoomY;
int width, height, imgwidth, imgheight;
width = ar->winx;
height = ar->winy;
seq_reset_imageofs(sseq);
imgwidth= (scene->r.size*scene->r.xsch)/100;
imgheight= (scene->r.size*scene->r.ysch)/100;
/* Apply aspect, dosnt need to be that accurate */
imgwidth= (int)(imgwidth * ((float)scene->r.xasp / (float)scene->r.yasp));
if (((imgwidth >= width) || (imgheight >= height)) &&
((width > 0) && (height > 0))) {
/* Find the zoom value that will fit the image in the image space */
zoomX = ((float)width) / ((float)imgwidth);
zoomY = ((float)height) / ((float)imgheight);
sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
}
else {
sseq->zoom= 1.0f;
}
}
v2d->cur= v2d->tot;
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@ -2327,8 +2295,102 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER;
}
/* view_all operator */
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
View2D *v2d= UI_view2d_fromcontext(C);
/* Like zooming on an image view */
float zoomX, zoomY;
int width, height, imgwidth, imgheight;
width = ar->winx;
height = ar->winy;
seq_reset_imageofs(sseq);
imgwidth= (scene->r.size*scene->r.xsch)/100;
imgheight= (scene->r.size*scene->r.ysch)/100;
/* Apply aspect, dosnt need to be that accurate */
imgwidth= (int)(imgwidth * ((float)scene->r.xasp / (float)scene->r.yasp));
if (((imgwidth >= width) || (imgheight >= height)) &&
((width > 0) && (height > 0))) {
/* Find the zoom value that will fit the image in the image space */
zoomX = ((float)width) / ((float)imgwidth);
zoomY = ((float)height) / ((float)imgheight);
sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
}
else {
sseq->zoom= 1.0f;
}
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
{
/* identifiers */
ot->name= "View All";
ot->idname= "SEQUENCER_OT_view_all_preview";
ot->description="Zoom preview to fit in the area.";
/* api callbacks */
ot->exec= sequencer_view_all_preview_exec;
ot->poll= ED_operator_sequencer_active;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
static EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
{0, NULL, 0, NULL, NULL}};
/* view_all operator */
static int sequencer_view_toggle_exec(bContext *C, wmOperator *op)
{
SpaceSeq *sseq= CTX_wm_space_data(C);
sseq->view++;
if (sseq->view > SEQ_VIEW_SEQUENCE_PREVIEW) sseq->view = SEQ_VIEW_SEQUENCE;
ED_sequencer_update_view(C, sseq->view);
return OPERATOR_FINISHED;
}
void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "View Toggle";
ot->idname= "SEQUENCER_OT_view_toggle";
ot->description="Toggle between sequencer views (sequence, preview, both).";
/* api callbacks */
ot->exec= sequencer_view_toggle_exec;
ot->poll= ED_operator_sequencer_active;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/* view_selected operator */
static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);

@ -95,9 +95,13 @@ void SEQUENCER_OT_swap_right(struct wmOperatorType *ot);
void SEQUENCER_OT_swap_left(struct wmOperatorType *ot);
void SEQUENCER_OT_rendersize(struct wmOperatorType *ot);
void SEQUENCER_OT_view_toggle(struct wmOperatorType *ot);
void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
/* preview specific operators */
void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot);
void SEQUENCER_OT_select(struct wmOperatorType *ot);

@ -85,7 +85,9 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_view_all);
WM_operatortype_append(SEQUENCER_OT_view_selected);
WM_operatortype_append(SEQUENCER_OT_view_all_preview);
WM_operatortype_append(SEQUENCER_OT_view_toggle);
/* sequencer_select.c */
WM_operatortype_append(SEQUENCER_OT_select_all_toggle);
WM_operatortype_append(SEQUENCER_OT_select_inverse);
@ -110,9 +112,14 @@ void sequencer_operatortypes(void)
void sequencer_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
wmKeyMap *keymap= WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0);
wmKeyMapItem *kmi;
/* operators common to sequence and preview view */
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
/* operators for sequence */
keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
@ -214,5 +221,8 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "SEQUENCER_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
transform_keymap_for_space(keyconf, keymap, SPACE_SEQ);
keymap= WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all_preview", HOMEKEY, KM_PRESS, 0, 0);
}

@ -90,6 +90,69 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
return arnew;
}
ARegion *sequencer_find_region(ScrArea *sa, short type)
{
ARegion *ar=NULL;
for(ar= sa->regionbase.first; ar; ar= ar->next)
if(ar->regiontype==type)
return ar;
return ar;
}
void ED_sequencer_update_view(bContext *C, int view)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar_main= sequencer_find_region(sa, RGN_TYPE_WINDOW);
ARegion *ar_preview= sequencer_find_region(sa, RGN_TYPE_PREVIEW);
switch (view) {
case SEQ_VIEW_SEQUENCE:
if (ar_main->flag & RGN_FLAG_HIDDEN) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
}
if (!(ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag |= RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers(C, &ar_preview->handlers);
}
ar_main->alignment= RGN_ALIGN_NONE;
ar_preview->alignment= RGN_ALIGN_NONE;
break;
case SEQ_VIEW_PREVIEW:
if (!(ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag |= RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers(C, &ar_main->handlers);
}
if (ar_preview->flag & RGN_FLAG_HIDDEN) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
}
ar_main->alignment= RGN_ALIGN_NONE;
ar_preview->alignment= RGN_ALIGN_NONE;
break;
case SEQ_VIEW_SEQUENCE_PREVIEW:
if (ar_main->flag & RGN_FLAG_HIDDEN) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
}
if (ar_preview->flag & RGN_FLAG_HIDDEN) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
}
ar_main->alignment= RGN_ALIGN_NONE;
ar_preview->alignment= RGN_ALIGN_TOP;
break;
}
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
ED_area_tag_redraw(sa);
}
/* ******************** default callbacks for sequencer space ***************** */
@ -103,8 +166,8 @@ static SpaceLink *sequencer_new(const bContext *C)
sseq->spacetype= SPACE_SEQ;
sseq->zoom= 4;
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for sequencer");
@ -120,6 +183,13 @@ static SpaceLink *sequencer_new(const bContext *C)
ar->alignment= RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
/* preview area */
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_PREVIEW;
ar->alignment= RGN_ALIGN_TOP;
ar->flag |= RGN_FLAG_HIDDEN;
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for sequencer");
@ -150,7 +220,7 @@ static SpaceLink *sequencer_new(const bContext *C)
ar->v2d.keepzoom= 0;
ar->v2d.keeptot= 0;
ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
return (SpaceLink *)sseq;
}
@ -181,7 +251,7 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl)
}
/* *********************** sequencer (main) region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
{
@ -189,6 +259,9 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* own keymap */
keymap= WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@ -197,18 +270,9 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
Scene *scene= CTX_data_scene(C);
if (sseq->mainb != SEQ_DRAW_SEQUENCE) {
/* image-viewer types */
draw_image_seq(scene, ar, sseq);
}
else {
/* NLE - strip editing timeline interface */
draw_timeline_seq(C, ar);
}
/* NLE - strip editing timeline interface */
draw_timeline_seq(C, ar);
}
@ -248,6 +312,60 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
}
/* *********************** preview region ************************ */
static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* own keymap */
keymap= WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
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);
/* XXX temp fix for wrong setting in sseq->mainb */
if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
draw_image_seq(scene, ar, sseq);
}
static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
case NC_SCENE:
switch(wmn->data) {
case ND_FRAME:
case ND_MARKERS:
case ND_SEQUENCER:
case ND_SEQUENCER_SELECT:
ED_region_tag_redraw(ar);
break;
}
break;
case NC_SPACE:
if(wmn->data == ND_SPACE_SEQUENCER)
ED_region_tag_redraw(ar);
break;
case NC_ID:
switch(wmn->data) {
case NA_RENAME:
ED_region_tag_redraw(ar);
break;
}
break;
}
}
/* *********************** buttons region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
@ -312,6 +430,16 @@ void ED_spacetype_sequencer(void)
art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
BLI_addhead(&st->regiontypes, art);
/* preview */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_PREVIEW;
art->minsizey = 240; // XXX
art->init= sequencer_preview_area_init;
art->draw= sequencer_preview_area_draw;
art->listener= sequencer_preview_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
BLI_addhead(&st->regiontypes, art);
/* regions: listview/buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");

@ -219,6 +219,7 @@ typedef struct ARegion {
#define RGN_TYPE_UI 4
#define RGN_TYPE_TOOLS 5
#define RGN_TYPE_TOOL_PROPS 6
#define RGN_TYPE_PREVIEW 7
/* region alignment */
#define RGN_ALIGN_NONE 0

@ -146,7 +146,9 @@ typedef struct SpaceSeq {
short zebra;
int flag;
float zoom;
int view; /* see SEQ_VIEW_* below */
int pad;
struct bGPdata *gpd; /* grease-pencil data */
} SpaceSeq;
@ -857,6 +859,12 @@ enum {
#define SEQ_DRAW_GPENCIL 16
#define SEQ_NO_DRAW_CFRANUM 32
/* sseq->view */
#define SEQ_VIEW_SEQUENCE 1
#define SEQ_VIEW_PREVIEW 2
#define SEQ_VIEW_SEQUENCE_PREVIEW 3
/* space types, moved from DNA_screen_types.h */
enum {
SPACE_EMPTY,

@ -106,6 +106,7 @@ EnumPropertyItem autosnap_items[] = {
#include "ED_image.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_sequencer.h"
#include "IMB_imbuf_types.h"
@ -482,6 +483,13 @@ static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
return (sipo->ghostCurves.first != NULL);
}
static void rna_Sequencer_display_mode_update(bContext *C, PointerRNA *ptr)
{
int view = RNA_int_get(ptr, "view_type");
ED_sequencer_update_view(C, view);
}
#else
static void rna_def_space(BlenderRNA *brna)
@ -1068,8 +1076,13 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem display_mode_items[] = {
{SEQ_DRAW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
{SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
@ -1080,6 +1093,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "SpaceSeq");
RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data.");
/* view type, fairly important */
prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "view");
RNA_def_property_enum_items(prop, view_type_items);
RNA_def_property_ui_text(prop, "View Type", "The type of the Sequencere view (sequencer, preview or both).");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_Sequencer_display_mode_update");
/* display type, fairly important */
prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mainb");