diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-04-28 17:07:57 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-04-28 17:14:51 +0300 |
commit | 17769489d920f86310464297e8906f34d5ec61b9 (patch) | |
tree | 7880dd7b626d9254a46894eaf11b06ae311a8cee /source/blender/editors/space_sequencer/sequencer_view.c | |
parent | b1b153b88c14b516183f7dd43b2c0111c0e7b041 (diff) |
VSE: Add option to limit timeline view height
When height is limited, it is defined by space occupied by strips,
but at least channels 1 to 7 will be always visible. This allows it to
easily overview timeline content by zooming out to maximum extent in Y
axis and panning in X axis.
More channels can be "created" on demand by moving strip to higher
channel. When strip is removed and highest channel becomes empty, view
will stay as is until it is moved down. Then new highest point is
remembered and it is not possible to pan upwards until strip is moved to
higher channel.
Limiting takes into account height of scrubbing and markers area as
well as scrollers. This means that when zoomed out to maximum extent,
no strips are obstructed by fixed UI element.
Fixes T57976
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D14263
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_view.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_view.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index c407dad623d..d271ad1ec66 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -32,6 +32,7 @@ #include "ED_anim_api.h" #include "ED_screen.h" #include "ED_util_imbuf.h" +#include "ED_time_scrub_ui.h" /* Own include. */ #include "sequencer_intern.h" @@ -86,6 +87,16 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *op) box.xmax = ms->disp_range[1] + 1; } SEQ_timeline_expand_boundbox(SEQ_active_seqbase_get(ed), &box); + + View2D *v2d = ®ion->v2d; + rcti scrub_rect; + ED_time_scrub_region_rect_get(region, &scrub_rect); + const float pixel_view_size_y = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); + const float scrub_bar_height = BLI_rcti_size_y(&scrub_rect) * pixel_view_size_y; + + /* Channel n has range of <n, n+1>. */ + box.ymax += 1.0f + scrub_bar_height; + UI_view2d_smooth_view(C, region, &box, smooth_viewtx); return OPERATOR_FINISHED; } |