diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-04-04 13:52:48 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-04-04 13:56:43 +0300 |
commit | 277fa2f441f4ab2c00e7f329ba34a3466956647c (patch) | |
tree | bde615d956239337f88575dc7ce79d26f0f6cf4f /source/blender/editors/space_sequencer/space_sequencer.c | |
parent | 5a0b4e97e67446ef3a180acb0ad03b4cbf91b356 (diff) |
VSE: Add channel headers
This patch adds channel region to VSE timeline area for drawing channel
headers. It is synchronizedwith timeline region. 3 basic features are
implemented - channel visibility, locking and name.
Channel data is stored in `SeqTimelineChannel` which can be top-level
owned by `Editing`, or it is owned by meta strip to support nesting.
Strip properties are completely independent and channel properties are
applied on top of particular strip property, thus overriding it.
Implementation is separate from channel regions in other editors. This
is mainly because style and topology is quite different in VSE. But
also code seems to be much more readable this way.
Currently channels use functions similar to VSE timeline to draw
background to provide illusion of transparency, but only for background
and sfra/efra regions.
Great portion of this patch is change from using strip visibility and
lock status to include channel state - this is facilitated by functions
`SEQ_transform_is_locked` and `SEQ_render_is_muted`
Originally this included changes in D14263, but patch was split for
easier review.
Reviewed By: fsiddi, Severin
Differential Revision: https://developer.blender.org/D13836
Diffstat (limited to 'source/blender/editors/space_sequencer/space_sequencer.c')
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index cd4ecd1a714..0a0669e02e4 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -131,6 +131,14 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce region->regiontype = RGN_TYPE_TOOLS; region->alignment = RGN_ALIGN_LEFT; region->flag = RGN_FLAG_HIDDEN; + region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; + + /* Channels. */ + region = MEM_callocN(sizeof(ARegion), "channels for sequencer"); + + BLI_addtail(&sseq->regionbase, region); + region->regiontype = RGN_TYPE_CHANNELS; + region->alignment = RGN_ALIGN_LEFT; /* Preview region. */ /* NOTE: if you change values here, also change them in sequencer_init_preview_region. */ @@ -182,6 +190,7 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES); region->v2d.keepzoom = 0; region->v2d.keeptot = 0; + region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; region->v2d.align = V2D_ALIGN_NO_NEG_Y; sseq->runtime.last_displayed_thumbnails = NULL; @@ -977,6 +986,24 @@ static void sequencer_id_remap(ScrArea *UNUSED(area), /* ************************************* */ +/* add handlers, stuff you only do once or on area/region changes */ +static void sequencer_channel_region_init(wmWindowManager *wm, ARegion *region) +{ + wmKeyMap *keymap; + + region->alignment = RGN_ALIGN_LEFT; + + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy); + + keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer Channels", SPACE_SEQ, 0); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); +} + +static void sequencer_channel_region_draw(const bContext *C, ARegion *region) +{ + draw_channels(C, region); +} + void ED_spacetype_sequencer(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer"); @@ -1048,6 +1075,16 @@ void ED_spacetype_sequencer(void) art->draw = sequencer_tools_region_draw; BLI_addhead(&st->regiontypes, art); + /* Channels. */ + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer channels"); + art->regionid = RGN_TYPE_CHANNELS; + art->prefsizex = UI_COMPACT_PANEL_WIDTH; + art->keymapflag = ED_KEYMAP_UI; + art->init = sequencer_channel_region_init; + art->draw = sequencer_channel_region_draw; + art->listener = sequencer_main_region_listener; + BLI_addhead(&st->regiontypes, art); + /* Tool header. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tool header region"); art->regionid = RGN_TYPE_TOOL_HEADER; |