Fix missing redraws when changing active view-layer or its name

Also removed unnecessary `struct` keywords.
This commit is contained in:
Julian Eisel 2017-12-27 17:08:00 +01:00
parent 110373de6a
commit 7dee0bbf06
2 changed files with 28 additions and 3 deletions

View File

@ -226,11 +226,12 @@ static void buttons_header_region_draw(const bContext *C, ARegion *ar)
}
static void buttons_header_region_message_subscribe(
const struct bContext *UNUSED(C),
struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen), struct ScrArea *UNUSED(sa), struct ARegion *ar,
const bContext *UNUSED(C),
WorkSpace *UNUSED(workspace), Scene *UNUSED(scene),
bScreen *UNUSED(screen), ScrArea *sa, ARegion *ar,
struct wmMsgBus *mbus)
{
SpaceButs *sbuts = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
@ -240,6 +241,10 @@ static void buttons_header_region_message_subscribe(
/* Don't check for SpaceButs.mainb here, we may toggle between view-layers
* where one has no active object, so that available contexts changes. */
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_WORLD)) {
WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw);
}
}
/* draw a certain button set only if properties area is currently

View File

@ -50,6 +50,9 @@
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
#include "RNA_access.h"
#include "UI_resources.h"
#include "UI_interface.h"
@ -284,6 +287,22 @@ static void info_header_listener(
}
static void info_header_region_message_subscribe(
const bContext *UNUSED(C),
WorkSpace *UNUSED(workspace), Scene *UNUSED(scene),
bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
.notify = ED_region_do_msg_notify_tag_redraw,
};
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw);
}
static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
{
struct RecentFile *recent;
@ -347,6 +366,7 @@ void ED_spacetype_info(void)
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
art->listener = info_header_listener;
art->message_subscribe = info_header_region_message_subscribe;
art->init = info_header_region_init;
art->draw = info_header_region_draw;