Page MenuHome

Fix T81532: UI: Animation Editors - slider covers button to reveal the sidebar
AbandonedPublic

Authored by Philipp Oeser (lichtwerk) on Oct 8 2020, 11:35 AM.

Details

Summary

Happened in Timeline, Dope sheet, NLA Editor.

This was caused by rBbbb2e0614fc3 where drawing the sliders went into
the overlay [thus drawing on top]. Could not find a reason for this, now
move slider drawing back to main regin drawing for Timeline, Dope sheet,
NLA Editor (other Editors affected by above commit [Graph Editor,
Sequencer] dont have the same problem, because the way the slider is
drawn for these Editors -- which never covers said button there, but
maybe should also be corrected?).

Diff Detail

Repository
rB Blender
Branch
T81532 (branched from master)
Build Status
Buildable 10630
Build 10630: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Oct 8 2020, 11:35 AM

With this the playhead draws on top of the scroll bar.

Another option would be drawing azones as overlays too, which isn't difficult:

diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 53554e3f34c..4baadb2fc48 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -68,6 +68,7 @@ void ED_region_do_listen(struct wmWindow *win,
                          const Scene *scene);
 void ED_region_do_layout(struct bContext *C, struct ARegion *region);
 void ED_region_do_draw(struct bContext *C, struct ARegion *region);
+void ED_region_do_draw_overlay(struct bContext *C, struct ARegion *region);
 void ED_region_exit(struct bContext *C, struct ARegion *region);
 void ED_region_remove(struct bContext *C, struct ScrArea *area, struct ARegion *region);
 void ED_region_pixelspace(struct ARegion *region);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 6fa9d203bba..3fa7f978bd0 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -553,8 +553,6 @@ void ED_region_do_draw(bContext *C, ARegion *region)
 
   ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_PIXEL);
 
-  region_draw_azones(area, region);
-
   /* for debugging unneeded area redraws and partial redraw */
   if (G.debug_value == 888) {
     GPU_blend(GPU_BLEND_ALPHA);
@@ -635,6 +633,30 @@ void ED_region_do_draw(bContext *C, ARegion *region)
   }
 }
 
+void ED_region_do_draw_overlay(bContext *C, ARegion *region)
+{
+  ScrArea *area = CTX_wm_area(C);
+  const rcti old_drawrect = region->drawrct;
+
+  /* Called code (e.g. azone drawing) may access drawrct. */
+  region->drawrct = region->winrct;
+
+  wmViewport(&region->drawrct);
+  wmOrtho2_region_pixelspace(region);
+
+  UI_SetTheme(area->spacetype, region->regiontype);
+
+  if (region->type->draw_overlay) {
+    region->type->draw_overlay(C, region);
+  }
+
+  ED_region_pixelspace(region);
+
+  region_draw_azones(area, region);
+
+  region->drawrct = old_drawrect;
+}
+
 /* **********************************
  * maybe silly, but let's try for now
  * to keep these tags protected
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index a805e00e0a2..31354dfe1de 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -135,13 +135,11 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
 /** \name Post Draw Region on display handlers
  * \{ */
 
-static void wm_region_draw_overlay(bContext *C, ScrArea *area, ARegion *region)
+static void wm_region_draw_overlay(bContext *C, ARegion *region)
 {
   wmWindow *win = CTX_wm_window(C);
 
-  wmViewport(&region->winrct);
-  UI_SetTheme(area->spacetype, region->regiontype);
-  region->type->draw_overlay(C, region);
+  ED_region_do_draw_overlay(C, region);
   wmWindowViewport(win);
 }
 
@@ -805,16 +803,10 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
     LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
       if (region->visible) {
         const bool do_paint_cursor = (wm->paintcursors.first && region == screen->active_region);
-        const bool do_draw_overlay = (region->type && region->type->draw_overlay);
-        if (!(do_paint_cursor || do_draw_overlay)) {
-          continue;
-        }
 
         CTX_wm_area_set(C, area);
         CTX_wm_region_set(C, region);
-        if (do_draw_overlay) {
-          wm_region_draw_overlay(C, area, region);
-        }
+        wm_region_draw_overlay(C, region);
         if (do_paint_cursor) {
           wm_paintcursor_draw(C, area, region);
         }

Unfortunately, this means we always redraw the azones, regardless of redraw-tags. That's not a big overhead, but it is one that would be good to avoid.

I still think a proper system to manage all these overlays into separate, ordered layers with own tagging and framebuffers is a better way to go about drawing these. That way we can avoid any unnecessary redraws, see T73198.
Unfortunately this would increase GPU memory usage quite a bit I'm afraid.

Julian Eisel (Severin) requested changes to this revision.Oct 12 2020, 4:32 PM
This revision now requires changes to proceed.Oct 12 2020, 4:32 PM

Thx checking! Dont think there is much I can do with this attempt then (if I find something else, I will post a new Diff)