diff --git a/source/blender/editors/space_action/action_draw.cc b/source/blender/editors/space_action/action_draw.cc index 4cedce2505c..8b5d49549ae 100644 --- a/source/blender/editors/space_action/action_draw.cc +++ b/source/blender/editors/space_action/action_draw.cc @@ -480,7 +480,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region /** \name Timeline - Caches * \{ */ -static bool timeline_cache_is_hidden_by_setting(SpaceAction *saction, PTCacheID *pid) +static bool timeline_cache_is_hidden_by_setting(const SpaceAction *saction, const PTCacheID *pid) { switch (pid->type) { case PTCACHE_TYPE_SOFTBODY: @@ -674,14 +674,14 @@ static void timeline_cache_draw_single(PTCacheID *pid, float y_offset, float hei GPU_matrix_pop(); } -void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) +void timeline_draw_cache(const SpaceAction *saction, const Object *ob, const Scene *scene) { if ((saction->cache_display & TIME_CACHE_DISPLAY) == 0 || ob == nullptr) { return; } ListBase pidlist; - BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); + BKE_ptcache_ids_from_object(&pidlist, const_cast(ob), const_cast(scene), 0); uint pos_id = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); diff --git a/source/blender/editors/space_action/action_intern.hh b/source/blender/editors/space_action/action_intern.hh index 8fb9ee59ceb..07221729c0d 100644 --- a/source/blender/editors/space_action/action_intern.hh +++ b/source/blender/editors/space_action/action_intern.hh @@ -35,7 +35,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region); */ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region); -void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene); +void timeline_draw_cache(const SpaceAction *saction, const Object *ob, const Scene *scene); /* ***************************************** */ /* action_select.c */ diff --git a/source/blender/editors/space_action/space_action.cc b/source/blender/editors/space_action/space_action.cc index c54c8c9d4b8..042d76648f1 100644 --- a/source/blender/editors/space_action/space_action.cc +++ b/source/blender/editors/space_action/space_action.cc @@ -44,6 +44,8 @@ #include "BLO_read_write.h" +#include "GPU_matrix.h" + #include "action_intern.hh" /* own include */ /* -------------------------------------------------------------------- */ @@ -212,11 +214,6 @@ static void action_main_region_draw(const bContext *C, ARegion *region) ED_markers_draw(C, marker_flag); } - /* caches */ - if (saction->mode == SACTCONT_TIMELINE) { - timeline_draw_cache(saction, obact, scene); - } - /* preview range */ UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d, 0); @@ -240,8 +237,17 @@ static void action_main_region_draw_overlay(const bContext *C, ARegion *region) /* draw entirely, view changes should be handled here */ const SpaceAction *saction = CTX_wm_space_action(C); const Scene *scene = CTX_data_scene(C); + const Object *obact = CTX_data_active_object(C); View2D *v2d = ®ion->v2d; + /* caches */ + if (saction->mode == SACTCONT_TIMELINE) { + GPU_matrix_push_projection(); + UI_view2d_view_orthoSpecial(region, v2d, 1); + timeline_draw_cache(saction, obact, scene); + GPU_matrix_pop_projection(); + } + /* scrubbing region */ ED_time_scrub_draw_current_frame(region, scene, saction->flag & SACTION_DRAWTIME);