Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_channels_draw.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c20
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c11
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c96
4 files changed, 111 insertions, 20 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_channels_draw.c b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
index 99a305fcf66..c1e854fd350 100644
--- a/source/blender/editors/space_sequencer/sequencer_channels_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
@@ -93,10 +93,10 @@ static void displayed_channel_range_get(SeqChannelDrawContext *context, int chan
channel_range[1] = ceil(context->timeline_region_v2d->cur.ymax);
rctf strip_boundbox;
- BLI_rctf_init(&strip_boundbox, 0.0f, 0.0f, 1.0f, channel_range[1]);
+ BLI_rctf_init(&strip_boundbox, 0.0f, 0.0f, 1.0f, 7);
SEQ_timeline_expand_boundbox(context->seqbase, &strip_boundbox);
CLAMP(channel_range[0], strip_boundbox.ymin, strip_boundbox.ymax);
- CLAMP(channel_range[1], strip_boundbox.ymin, MAXSEQ);
+ CLAMP(channel_range[1], strip_boundbox.ymin, strip_boundbox.ymax);
}
static float draw_channel_widget_hide(SeqChannelDrawContext *context,
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index e557ccf6235..16cf56d290c 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1772,23 +1772,10 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
- return OPERATOR_FINISHED;
-}
-
-static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
-{
- ARegion *region = CTX_wm_region(C);
-
- if (region->regiontype == RGN_TYPE_WINDOW) {
- /* Bounding box of 30 pixels is used for markers shortcuts,
- * prevent conflict with markers shortcuts here.
- */
- if (event->mval[1] <= 30) {
- return OPERATOR_PASS_THROUGH;
- }
- }
+ SpaceSeq *sseq = CTX_wm_space_seq(C);
+ sseq->flag |= SPACE_SEQ_CLAMP_SMOOTH;
- return sequencer_delete_exec(C, op);
+ return OPERATOR_FINISHED;
}
void SEQUENCER_OT_delete(wmOperatorType *ot)
@@ -1800,7 +1787,6 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
ot->description = "Erase selected strips from the sequencer";
/* Api callbacks. */
- ot->invoke = sequencer_delete_invoke;
ot->exec = sequencer_delete_exec;
ot->poll = sequencer_edit_poll;
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 4d245b9ddaa..445daf6072c 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -30,6 +30,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"
@@ -84,6 +85,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 = &region->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;
}
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 09846742fbc..35384067513 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -18,6 +18,7 @@
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
+#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -29,8 +30,10 @@
#include "GPU_state.h"
+#include "ED_markers.h"
#include "ED_screen.h"
#include "ED_space_api.h"
+#include "ED_time_scrub_ui.h"
#include "ED_transform.h"
#include "ED_view3d.h"
#include "ED_view3d_offscreen.h" /* Only for sequencer view3d drawing callback. */
@@ -41,6 +44,8 @@
#include "RNA_access.h"
+#include "SEQ_sequencer.h"
+#include "SEQ_time.h"
#include "SEQ_transform.h"
#include "SEQ_utils.h"
@@ -173,7 +178,7 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce
region->v2d.tot.xmin = 0.0f;
region->v2d.tot.ymin = 0.0f;
region->v2d.tot.xmax = scene->r.efra;
- region->v2d.tot.ymax = 8.0f;
+ region->v2d.tot.ymax = 8.5f;
region->v2d.cur = region->v2d.tot;
@@ -639,6 +644,93 @@ static void sequencer_main_region_draw_overlay(const bContext *C, ARegion *regio
draw_timeline_seq_display(C, region);
}
+struct View2DScrollers {
+ int vert_min, vert_max; /* vertical scrollbar */
+ int hor_min, hor_max; /* horizontal scrollbar */
+
+ /* These values are written into, even if we don't use them. */
+ rcti _hor, _vert;
+};
+
+static void sequencer_main_clamp_view(const bContext *C, ARegion *region)
+{
+ View2D *v2d = &region->v2d;
+ Editing *ed = SEQ_editing_get(CTX_data_scene(C));
+
+ /* Transformation uses edge panning to move view. Also if smooth view is running, don't apply
+ * clamping to prevent overriding this functionality. */
+ if (G.moving || v2d->smooth_timer != NULL) {
+ return;
+ }
+
+ /* Initialize default view with 7 channels, that are visible even if empty. */
+ rctf strip_boundbox;
+ BLI_rctf_init(&strip_boundbox, 0.0f, 0.0f, 1.0f, 7.0f);
+ SEQ_timeline_expand_boundbox(ed->seqbasep, &strip_boundbox);
+
+ /* Clamp Y max. Scrubbing area height must be added, so strips aren't occluded. */
+ 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>. */
+ strip_boundbox.ymax += 1.0f + scrub_bar_height;
+
+ /* Clamp Y min. Scroller and marker area height must be added, so strips aren't occluded. */
+ struct View2DScrollers scrollers;
+ UI_view2d_scrollers_calc(v2d, NULL, &scrollers);
+ float scroll_bar_height = scrollers._hor.ymax * pixel_view_size_y;
+
+ ListBase *markers = ED_context_get_markers(C);
+ if (markers != NULL && !BLI_listbase_is_empty(markers)) {
+ float markers_size = UI_MARKER_MARGIN_Y * pixel_view_size_y;
+ strip_boundbox.ymin -= markers_size;
+ }
+ else {
+ strip_boundbox.ymin -= scroll_bar_height;
+ }
+
+ rctf view_clamped = v2d->cur;
+ bool do_clamp = false;
+
+ const float range_y = BLI_rctf_size_y(&view_clamped);
+ if (view_clamped.ymax > strip_boundbox.ymax) {
+ view_clamped.ymax = strip_boundbox.ymax;
+ view_clamped.ymin = max_ff(strip_boundbox.ymin, strip_boundbox.ymax - range_y);
+ do_clamp = true;
+ }
+ if (view_clamped.ymin < strip_boundbox.ymin) {
+ view_clamped.ymin = strip_boundbox.ymin;
+ view_clamped.ymax = min_ff(strip_boundbox.ymax, strip_boundbox.ymin + range_y);
+ do_clamp = true;
+ }
+
+ SpaceSeq *sseq = CTX_wm_space_seq(C);
+ if (do_clamp) {
+ if ((sseq->flag & SPACE_SEQ_CLAMP_SMOOTH) != 0) {
+ UI_view2d_smooth_view(C, region, &view_clamped, U.smooth_viewtx);
+ }
+ else {
+ v2d->cur = view_clamped;
+ }
+ }
+
+ /* Clear flag for smooth view even if no limiting occured. It is set by operators that change
+ * strip position. */
+ sseq->flag &= ~SPACE_SEQ_CLAMP_SMOOTH;
+}
+
+static void sequencer_main_region_layout(const bContext *C, ARegion *region)
+{
+ sequencer_main_clamp_view(C, region);
+}
+
+static void sequencer_main_region_view2d_changed(const bContext *C, ARegion *region)
+{
+ sequencer_main_clamp_view(C, region);
+}
+
static void sequencer_main_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
@@ -1031,6 +1123,8 @@ void ED_spacetype_sequencer(void)
art->init = sequencer_main_region_init;
art->draw = sequencer_main_region_draw;
art->draw_overlay = sequencer_main_region_draw_overlay;
+ art->layout = sequencer_main_region_layout;
+ art->on_view2d_changed = sequencer_main_region_view2d_changed;
art->listener = sequencer_main_region_listener;
art->message_subscribe = sequencer_main_region_message_subscribe;
/* NOTE: inclusion of #ED_KEYMAP_GIZMO is currently for scripts and isn't used by default. */