[Bf-blender-cvs] [1062649b5e6] master: Fix T87041: Driver Editor not updated in realtime

Philipp Oeser noreply at git.blender.org
Mon Aug 2 17:18:08 CEST 2021


Commit: 1062649b5e686a128c27552f40a912d1ab28e55d
Author: Philipp Oeser
Date:   Thu Jul 22 23:09:20 2021 +0200
Branches: master
https://developer.blender.org/rB1062649b5e686a128c27552f40a912d1ab28e55d

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

===================================================================

M	source/blender/editors/screen/screen_ops.c

===================================================================

diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 9534be3509b..f172e22ea56 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4488,10 +4488,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) &&
@@ -4515,10 +4513,29 @@ static void screen_animation_region_tag_redraw(ScrArea *area,
    * 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 && !area->full) {
-    if (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) {
+    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;
+      }
+    }
+
     if (area->spacetype == SPACE_SEQ) {
       const SpaceSeq *sseq = area->spacedata.first;
       if (!ED_space_sequencer_has_playback_animation(sseq, scene)) {
@@ -4712,7 +4729,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);
         }
       }
     }



More information about the Bf-blender-cvs mailing list