diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-06-28 10:43:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-06-28 10:43:14 +0300 |
commit | 37d5d10849978107b4b513e358b14b48525e238e (patch) | |
tree | e3b2f0b56ac8990b45cbd568fe55526e6ff91bfb /source | |
parent | 9ec8887599b1c14dac47cca1a073fa50b333d5ee (diff) |
Fix T66200: Changing workspaces / modes doesn't update tools
Changing the workspace or mode from one window may need to change the
active tool in another window since two different workspaces
may share an object.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 1ea39dcd6e0..0ba640fd6cc 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -729,9 +729,8 @@ static bToolRef *toolsystem_reinit_ensure_toolref(bContext *C, return tref; } -void WM_toolsystem_update_from_context_view3d(bContext *C) +static void wm_toolsystem_update_from_context_view3d_impl(bContext *C, WorkSpace *workspace) { - WorkSpace *workspace = CTX_wm_workspace(C); ViewLayer *view_layer = CTX_data_view_layer(C); int space_type = SPACE_VIEW3D; const bToolKey tkey = { @@ -741,6 +740,37 @@ void WM_toolsystem_update_from_context_view3d(bContext *C) toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL); } +void WM_toolsystem_update_from_context_view3d(bContext *C) +{ + WorkSpace *workspace = CTX_wm_workspace(C); + wm_toolsystem_update_from_context_view3d_impl(C, workspace); + + /* Multi window support. */ + Main *bmain = CTX_data_main(C); + wmWindowManager *wm = bmain->wm.first; + if (!BLI_listbase_is_single(&wm->windows)) { + wmWindow *win_prev = CTX_wm_window(C); + ScrArea *area_prev = CTX_wm_area(C); + ARegion *ar_prev = CTX_wm_region(C); + + for (wmWindow *win = wm->windows.first; win; win = win->next) { + if (win != win_prev) { + WorkSpace *workspace_iter = WM_window_get_active_workspace(win); + if (workspace_iter != workspace) { + + CTX_wm_window_set(C, win); + + wm_toolsystem_update_from_context_view3d_impl(C, workspace_iter); + + CTX_wm_window_set(C, win_prev); + CTX_wm_area_set(C, area_prev); + CTX_wm_region_set(C, ar_prev); + } + } + } + } +} + void WM_toolsystem_update_from_context(bContext *C, WorkSpace *workspace, ViewLayer *view_layer, |