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.
This commit is contained in:
Dalai Felinto 2018-12-06 23:35:17 -02:00
parent 497a9ef7a3
commit 892a104d2c
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by commit 2fefbfd2d0, Revert "Fix T58904: Side tabs disappear when creating new View Layer"
Referenced by issue #58904, Side tabs disappear when creating new View Layer
1 changed files with 15 additions and 0 deletions

View File

@ -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);