Fix: VSE thumbnails broken due to recent retiming draw changes

Retiming draw order changes in d0cf4a4a8b accidentally broke VSE
thumbnails. The order of drawing became "for each strip: draw thumbnail,
draw retiming continuity".

But the "draw retiming" bit was changing the projection matrix, which
placed all the later thumbnails at nonsensical locations.

Fixup it so that:
- First all thumbnails are drawn, then all retiming continuities.
- Retiming continuity drawing sets up matrix just once, instead of
  doing all that work for each strip.
- And it also restores the previous projection matrix after it is done.
- Also, can_draw_retiming now says "false" when no retiming keys are
  present. Previously, code was going into possibly expensive drawing
  setup for any strip, even when the is nothing to draw.

Pull Request: https://projects.blender.org/blender/blender/pulls/124780
This commit is contained in:
Aras Pranckevicius
2024-07-16 14:02:15 +02:00
committed by Aras Pranckevicius
parent ba4b15c712
commit ce9becae4c
2 changed files with 22 additions and 4 deletions

View File

@@ -244,6 +244,10 @@ static bool can_draw_retiming(const TimelineDrawContext *timeline_ctx,
return false;
}
if (!SEQ_retiming_is_active(strip_ctx.seq)) {
return false;
}
return true;
}
@@ -305,8 +309,6 @@ void sequencer_retiming_draw_continuity(const TimelineDrawContext *timeline_ctx,
return;
}
wmOrtho2_region_pixelspace(timeline_ctx->region);
const Sequence *seq = strip_ctx.seq;
const View2D *v2d = timeline_ctx->v2d;
const Scene *scene = timeline_ctx->scene;

View File

@@ -34,6 +34,8 @@
#include "ED_space_api.hh"
#include "ED_time_scrub_ui.hh"
#include "GPU_matrix.hh"
#include "RNA_prototypes.hh"
#include "SEQ_channels.hh"
@@ -1466,6 +1468,20 @@ static void draw_strips_foreground(TimelineDrawContext *timeline_ctx,
GPU_blend(GPU_BLEND_ALPHA);
}
static void draw_retiming_continuity_ranges(TimelineDrawContext *timeline_ctx,
const Vector<StripDrawContext> &strips)
{
GPU_matrix_push_projection();
wmOrtho2_region_pixelspace(timeline_ctx->region);
for (const StripDrawContext &strip_ctx : strips) {
sequencer_retiming_draw_continuity(timeline_ctx, strip_ctx);
}
timeline_ctx->quads->draw();
GPU_matrix_pop_projection();
}
static void draw_seq_strips(TimelineDrawContext *timeline_ctx,
StripsDrawBatch &strips_batch,
const Vector<StripDrawContext> &strips)
@@ -1500,9 +1516,9 @@ static void draw_seq_strips(TimelineDrawContext *timeline_ctx,
timeline_ctx->pixelx,
timeline_ctx->pixely,
round_radius);
sequencer_retiming_draw_continuity(timeline_ctx, strip_ctx);
}
timeline_ctx->quads->draw();
/* Draw retiming continuity ranges. */
draw_retiming_continuity_ranges(timeline_ctx, strips);
/* Draw parts of strips above thumbnails. */
GPU_blend(GPU_BLEND_ALPHA);