Commit: 0908fc11900d285e4c18ec1ed6a2f10a3301552d Author: Campbell Barton Date: Fri Apr 27 08:24:20 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB0908fc11900d285e4c18ec1ed6a2f10a3301552d
Tool System: publish/subscribe to tool changes =================================================================== M source/blender/editors/space_topbar/space_topbar.c M source/blender/windowmanager/intern/wm_toolsystem.c =================================================================== diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index a8555e9e269..f2824b3bf70 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -50,8 +50,11 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "RNA_access.h" + #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" /* ******************** default callbacks for topbar space ***************** */ @@ -194,6 +197,22 @@ static void topbar_header_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARe } } +static void topbar_header_region_message_subscribe( + const struct bContext *UNUSED(C), + struct WorkSpace *workspace, struct Scene *UNUSED(scene), + struct bScreen *UNUSED(screen), struct ScrArea *UNUSED(sa), struct 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_prop( + mbus, &workspace->id, workspace, + WorkSpace, tool_keymap, &msg_sub_value_region_tag_redraw); +} + static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; @@ -258,6 +277,7 @@ void ED_spacetype_topbar(void) art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; art->listener = topbar_header_listener; + art->message_subscribe = topbar_header_region_message_subscribe; art->init = topbar_header_region_init; art->draw = topbar_header_region_draw; diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 98e29a6f496..22643c63368 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -38,8 +38,11 @@ #include "BKE_library.h" #include "BKE_main.h" +#include "RNA_access.h" + #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" void WM_toolsystem_unlink(bContext *C, WorkSpace *workspace) { @@ -93,6 +96,12 @@ void WM_toolsystem_set(bContext *C, const bToolDef *tool) } WM_toolsystem_link(C, workspace); + + { + struct wmMsgBus *mbus = CTX_wm_message_bus(C); + WM_msg_publish_rna_prop( + mbus, &workspace->id, workspace, WorkSpace, tool_keymap); + } } void WM_toolsystem_init(bContext *C) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs