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.
This commit is contained in:
parent
9ec8887599
commit
37d5d10849
Notes:
blender-bot
2023-02-14 11:01:33 +01:00
Referenced by issue #66200, Changing workspaces which switches modes with multiple windows doesn't properly update
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue