[Bf-blender-cvs] [892a104d2cc] blender2.8: Fix T58904: Side tabs disappear when creating new View Layer

Dalai Felinto noreply at git.blender.org
Fri Dec 7 02:40:41 CET 2018


Commit: 892a104d2cc322cb042a687050dcce2403a971f3
Author: Dalai Felinto
Date:   Thu Dec 6 23:35:17 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB892a104d2cc322cb042a687050dcce2403a971f3

Fix T58904: Side tabs disappear when creating new View Layer

Using listener here, although I suspect we should be using message
subscriber only. That said, this mimics the behaviour of the buttons
main region.

As for the original bug report what was happening was that when
switching between viewlayers (or when creating one) we may not get the
same active object. So the context breadcrumbs are different.

And the bug itself was that we were missing a redraw on view layer
change.

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

M	source/blender/editors/space_buttons/space_buttons.c

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

diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 1f1f238daf6..6dc7d5a9cda 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -431,6 +431,20 @@ static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *ar)
 	ED_region_panels_draw(C, ar);
 }
 
+static void buttons_navigation_bar_region_listener(
+        wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn,
+        const Scene *UNUSED(scene))
+{
+	/* Context changes. */
+	switch (wmn->category) {
+		case NC_SCREEN:
+			if (ELEM(wmn->data, ND_LAYER)) {
+				ED_region_tag_redraw(ar);
+			}
+			break;
+	}
+}
+
 /* draw a certain button set only if properties area is currently
  * showing that button set, to reduce unnecessary drawing. */
 static void buttons_area_redraw(ScrArea *sa, short buttons)
@@ -732,6 +746,7 @@ void ED_spacetype_buttons(void)
 	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
 	art->init = buttons_navigation_bar_region_init;
 	art->draw = buttons_navigation_bar_region_draw;
+	art->listener = buttons_navigation_bar_region_listener;
 	BLI_addhead(&st->regiontypes, art);
 
 	BKE_spacetype_register(st);



More information about the Bf-blender-cvs mailing list