Timeline: draw cache in overlay so that it stays in sync with actually cached data #105986
|
@ -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<Object *>(ob), const_cast<Scene *>(scene), 0);
|
||||
|
||||
uint pos_id = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue