Fix (unreported): VSE offset drawing not working

Caused by error in refactor commit 4d668e6825ac3. Offsets are drawn
outside of strip boundary, but strip content range in drawing context
is clamped by handles, so nothing was drawn.

Also this feature was not working, when using solo feature. This was
caused by another refactor e39cc7831387d452. `special_seq_update` global
variable was declared in both files after splitting them, but set only
in one of them. Use `ED_sequencer_special_preview_get()` instead of
accessing variable directly.
This commit is contained in:
Richard Antalik 2023-11-22 05:41:42 +01:00
parent bb80716244
commit 16e2698632
2 changed files with 21 additions and 16 deletions

@ -135,8 +135,9 @@ ImBuf *sequencer_ibuf_get(Main *bmain,
GPU_framebuffer_restore();
}
if (special_seq_update) {
ibuf = SEQ_render_give_ibuf_direct(&context, timeline_frame + frame_ofs, special_seq_update);
if (ED_sequencer_special_preview_get()) {
ibuf = SEQ_render_give_ibuf_direct(
&context, timeline_frame + frame_ofs, ED_sequencer_special_preview_get());
}
else {
ibuf = SEQ_render_give_ibuf(&context, timeline_frame + frame_ofs, sseq->chanshown);

@ -77,11 +77,10 @@
#define SEQ_SCROLLER_TEXT_OFFSET 8
#define MUTE_ALPHA 120
static Sequence *special_seq_update = nullptr;
struct StripDrawContext {
Sequence *seq;
float content_start, content_end, bottom, top; /* Strip boundary in timeline space. */
/* Strip boundary in timeline space. Content start/end is clamped by left/right handle. */
float content_start, content_end, bottom, top;
float left_handle, right_handle; /* Position in frames. */
float strip_content_top; /* Position in timeline space without content and text overlay. */
float handle_width; /* Width of strip handle in frames. */
@ -1098,7 +1097,7 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, StripDrawConte
return;
}
if ((timeline_ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS) == 0 &&
(strip_ctx->seq != special_seq_update))
(strip_ctx->seq != ED_sequencer_special_preview_get()))
{
return;
}
@ -1118,10 +1117,13 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, StripDrawConte
col[3] = SEQ_render_is_muted(channels, seq) ? MUTE_ALPHA : 200;
UI_GetColorPtrShade3ubv(col, blend_col, 10);
if (strip_ctx->left_handle > strip_ctx->content_start) {
const int strip_start = SEQ_time_start_frame_get(seq);
const int strip_end = SEQ_time_content_end_frame_get(scene, seq);
if (strip_ctx->left_handle > strip_start) {
immUniformColor4ubv(col);
immRectf(pos,
strip_ctx->content_start,
strip_start,
strip_ctx->bottom - timeline_ctx->pixely,
strip_ctx->content_start,
strip_ctx->bottom - SEQ_STRIP_OFSBOTTOM);
@ -1129,25 +1131,25 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, StripDrawConte
/* Outline. */
immUniformColor3ubv(blend_col);
imm_draw_box_wire_2d(pos,
strip_ctx->content_start,
strip_start,
strip_ctx->bottom - timeline_ctx->pixely,
strip_ctx->content_start,
strip_ctx->bottom - SEQ_STRIP_OFSBOTTOM);
}
if (strip_ctx->right_handle < strip_ctx->content_end) {
if (strip_ctx->right_handle < strip_end) {
immUniformColor4ubv(col);
immRectf(pos,
strip_ctx->content_end,
strip_ctx->right_handle,
strip_ctx->top + timeline_ctx->pixely,
strip_ctx->content_end,
strip_end,
strip_ctx->top + SEQ_STRIP_OFSBOTTOM);
/* Outline. */
immUniformColor3ubv(blend_col);
imm_draw_box_wire_2d(pos,
strip_ctx->content_end,
strip_ctx->right_handle,
strip_ctx->top + timeline_ctx->pixely,
strip_ctx->content_end,
strip_end,
strip_ctx->top + SEQ_STRIP_OFSBOTTOM);
}
GPU_blend(GPU_BLEND_NONE);
@ -1545,7 +1547,9 @@ static void draw_effect_inputs_highlight(TimelineDrawContext *timeline_ctx,
static void draw_seq_solo_highlight(StripDrawContext *strip_ctx)
{
if (special_seq_update == nullptr || special_seq_update != strip_ctx->seq) {
if (ED_sequencer_special_preview_get() == nullptr ||
ED_sequencer_special_preview_get() != strip_ctx->seq)
{
return;
}