diff options
-rw-r--r-- | source/blender/editors/include/ED_sequencer.h | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 13 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 62 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 37 |
4 files changed, 80 insertions, 33 deletions
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index 11eff2d583b..ae76f0b6eaf 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -42,6 +42,7 @@ bool ED_space_sequencer_maskedit_poll(struct bContext *C); bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq); bool ED_space_sequencer_check_show_strip(struct SpaceSeq *sseq); +bool ED_space_sequencer_has_visible_animation_on_strip(const struct Scene *scene); void ED_operatormacros_sequencer(void); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6b8d4e73f12..b41b54fee1f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4446,9 +4446,16 @@ static void screen_animation_region_tag_redraw(ScrArea *area, /* No need to do a full redraw as the current frame indicator is only updated. * We do need to redraw when this area is in full screen as no other areas * will be tagged for redrawing. */ - if ((region->regiontype == RGN_TYPE_WINDOW) && - (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) && !area->full) { - return; + if (region->regiontype == RGN_TYPE_WINDOW && !area->full) { + if (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) { + return; + } + + if (area->spacetype == SPACE_SEQ) { + if (!ED_space_sequencer_has_visible_animation_on_strip(scene)) { + return; + } + } } ED_region_tag_redraw(region); } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7f500597906..5f831cbf535 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2365,6 +2365,31 @@ static void draw_cache_view(const bContext *C) } /* Draw sequencer timeline. */ +static void draw_overlap_frame_indicator(const struct Scene *scene, const View2D *v2d) +{ + int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? + scene->ed->over_cfra : + scene->r.cfra + scene->ed->over_ofs; + + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); + float viewport_size[4]; + GPU_viewport_size_get_f(viewport_size); + immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); + /* Shader may have color set from past usage - reset it. */ + immUniform1i("colors_len", 0); + immUniform1f("dash_width", 20.0f * U.pixelsize); + immUniform1f("dash_factor", 0.5f); + immUniformThemeColor(TH_CFRAME); + + immBegin(GPU_PRIM_LINES, 2); + immVertex2f(pos, overlap_frame, v2d->cur.ymin); + immVertex2f(pos, overlap_frame, v2d->cur.ymax); + immEnd(); + + immUnbindProgram(); +} + void draw_timeline_seq(const bContext *C, ARegion *region) { Scene *scene = CTX_data_scene(C); @@ -2424,31 +2449,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) cfra_flag |= DRAWCFRA_UNIT_SECONDS; } - /* Draw overlap frame frame indicator. */ - if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { - int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? - scene->ed->over_cfra : - scene->r.cfra + scene->ed->over_ofs; - - uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); - float viewport_size[4]; - GPU_viewport_size_get_f(viewport_size); - immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - /* Shader may have color set from past usage - reset it. */ - immUniform1i("colors_len", 0); - immUniform1f("dash_width", 20.0f * U.pixelsize); - immUniform1f("dash_factor", 0.5f); - immUniformThemeColor(TH_CFRAME); - - immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, overlap_frame, v2d->cur.ymin); - immVertex2f(pos, overlap_frame, v2d->cur.ymax); - immEnd(); - - immUnbindProgram(); - } - UI_view2d_view_orthoSpecial(region, v2d, 1); int marker_draw_flag = DRAW_MARKERS_MARGIN; if (sseq->flag & SEQ_SHOW_MARKERS) { @@ -2456,11 +2456,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) } UI_view2d_view_ortho(v2d); - - if (ed) { - draw_cache_view(C); - } - ANIM_draw_previewrange(C, v2d, 1); /* Draw registered callbacks. */ @@ -2486,6 +2481,13 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region) const SpaceSeq *sseq = CTX_wm_space_seq(C); View2D *v2d = ®ion->v2d; + if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { + UI_view2d_view_ortho(v2d); + draw_cache_view(C); + draw_overlap_frame_indicator(scene, v2d); + UI_view2d_view_restore(C); + } + ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); UI_view2d_scrollers_draw(v2d, NULL); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 11451091680..1c9b3676b19 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -34,6 +34,7 @@ #include "BLT_translation.h" +#include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_sound_types.h" @@ -138,6 +139,42 @@ bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq) ELEM(sseq->mainb, SEQ_DRAW_SEQUENCE, SEQ_DRAW_IMG_IMBUF)); } +static bool sequencer_fcurves_targets_color_strip(const FCurve *fcurve) +{ + if (!BLI_str_startswith(fcurve->rna_path, "sequence_editor.sequences_all[\"")) { + return false; + } + + if (!BLI_str_endswith(fcurve->rna_path, "\"].color")) { + return false; + } + + return true; +} + +/* + * Check if there is animation attached to a strip, that is shown on the strip in the UI. + * + * - Colors of color strips are displayed on the strip itself. + */ +bool ED_space_sequencer_has_visible_animation_on_strip(const struct Scene *scene) +{ + if (!scene->adt) { + return false; + } + if (!scene->adt->action) { + return false; + } + + LISTBASE_FOREACH (FCurve *, fcurve, &scene->adt->action->curves) { + if (sequencer_fcurves_targets_color_strip(fcurve)) { + return true; + } + } + + return false; +} + /** \} */ /* -------------------------------------------------------------------- */ |