From 2ccf4b15cc03c7b11d76baa930fb8e3f5863030a Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 22 Jul 2021 23:09:20 +0200 Subject: Fix T87041: Driver Editor not updated in realtime Caused by {rBbbb2e0614fc3} Since above commit only the playhead is updated as an overlay in animation playback (was moved out of drawing of the main region for perfomance reasons). The driver value "debug" visualization is very useful to have during playback though but was left in main region drawing as part of `draw_fcurve` (thus does not update in realtime anymore). Moving `graph_draw_driver_debug` into the overlay is not feasible because it requires animation filtering which has significant overhead which needs to be avoided in the overlay which is redrawn on every UI interaction. Now tag the whole main region for updates in the Driver Editor during playback instead (which will make the Drivers Editor as slow during playback as before rBbbb2e0614fc3 -- but with realtime updates of the debug visualization). Maniphest Tasks: T87041 Differential Revision: https://developer.blender.org/D12003 --- source/blender/editors/screen/screen_ops.c | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 765877d6a8e..b49c81d47a9 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4333,10 +4333,8 @@ static bool match_region_with_redraws(const ScrArea *area, return false; } -static void screen_animation_region_tag_redraw(ScrArea *area, - ARegion *region, - const Scene *scene, - eScreen_Redraws_Flag redraws) +static void screen_animation_region_tag_redraw( + bContext *C, ScrArea *area, ARegion *region, const Scene *scene, eScreen_Redraws_Flag redraws) { /* Do follow time here if editor type supports it */ if ((redraws & TIME_FOLLOW) && @@ -4359,9 +4357,29 @@ 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_NLA, SPACE_ACTION)) { + return; + } + + /* Drivers Editor needs a full redraw on playback for graph_draw_driver_debug(). + * This will make it slower than regular graph editor during playback, but drawing this in + * graph_main_region_draw_overlay() is not feasible because it requires animation filtering + * which has significant overhead which needs to be avoided in the overlay which is redrawn on + * every UI interaction. */ + if (area->spacetype == SPACE_GRAPH) { + const SpaceGraph *sipo = area->spacedata.first; + if (sipo->mode != SIPO_MODE_DRIVERS) { + return; + } + bAnimContext ac; + if (ANIM_animdata_get_context(C, &ac) == false) { + return; + } + if (ac.datatype != ANIMCONT_DRIVERS) { + return; + } + } } ED_region_tag_redraw(region); } @@ -4549,7 +4567,7 @@ static int screen_animation_step_invoke(bContext *C, wmOperator *UNUSED(op), con } if (redraw) { - screen_animation_region_tag_redraw(area, region, scene, sad->redraws); + screen_animation_region_tag_redraw(C, area, region, scene, sad->redraws); } } } -- cgit v1.2.3