[Bf-blender-cvs] [7dee0bbf066] blender2.8: Fix missing redraws when changing active view-layer or its name

Julian Eisel noreply at git.blender.org
Wed Dec 27 17:10:22 CET 2017


Commit: 7dee0bbf066108dca64e9df5cb3da24f40ef0989
Author: Julian Eisel
Date:   Wed Dec 27 17:08:00 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB7dee0bbf066108dca64e9df5cb3da24f40ef0989

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

Also removed unnecessary `struct` keywords.

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

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

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

diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 878feb81e8a..179780bf517 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -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
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 4f042364c63..b13152883c3 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -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;



More information about the Bf-blender-cvs mailing list