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/makesrna | |
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/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 1f68855622f..0ba8658568c 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2346,6 +2346,36 @@ static void rna_SequenceEditor_render_size_update(bContext *C, PointerRNA *ptr) rna_SequenceEditor_update_cache(CTX_data_main(C), CTX_data_scene(C), ptr); } +static bool rna_SequenceEditor_clamp_view_get(PointerRNA *ptr) +{ + SpaceSeq *sseq = ptr->data; + return (sseq->flag & SEQ_CLAMP_VIEW) != 0; +} + +static void rna_SequenceEditor_clamp_view_set(PointerRNA *ptr, bool value) +{ + SpaceSeq *sseq = ptr->data; + ScrArea *area; + ARegion *region; + + area = rna_area_from_space(ptr); /* can be NULL */ + if (area == NULL) { + return; + } + + region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + if (region) { + if (value) { + sseq->flag |= SEQ_CLAMP_VIEW; + region->v2d.align &= ~V2D_ALIGN_NO_NEG_Y; + } + else { + sseq->flag &= ~SEQ_CLAMP_VIEW; + region->v2d.align |= V2D_ALIGN_NO_NEG_Y; + } + } +} + static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -5709,6 +5739,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop, "Use Proxies", "Use optimized files for faster scrubbing when available"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); + prop = RNA_def_property(srna, "clamp_view", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_CLAMP_VIEW); + RNA_def_property_boolean_funcs( + prop, "rna_SequenceEditor_clamp_view_get", "rna_SequenceEditor_clamp_view_set"); + RNA_def_property_ui_text( + prop, "Limit View to Contents", "Limit timeline height to maximum used channel slot"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + /* grease pencil */ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "gpd"); |