Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/workspace_edit.c')
-rw-r--r--source/blender/editors/screen/workspace_edit.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 246d2fed1a1..77fc20a98a5 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -172,24 +172,29 @@ bool ED_workspace_change(
screen_new = screen_change_prepare(screen_old, screen_new, bmain, C, win);
BLI_assert(BKE_workspace_layout_screen_get(layout_new) == screen_new);
- if (screen_new) {
- BKE_workspace_hook_layout_for_workspace_set(win->workspace_hook, workspace_new, layout_new);
- BKE_workspace_active_set(win->workspace_hook, workspace_new);
+ if (screen_new == NULL) {
+ return false;
+ }
- /* update screen *after* changing workspace - which also causes the
- * actual screen change and updates context (including CTX_wm_workspace) */
- screen_change_update(C, win, screen_new);
- workspace_change_update(workspace_new, workspace_old, C, wm);
+ BKE_workspace_hook_layout_for_workspace_set(win->workspace_hook, workspace_new, layout_new);
+ BKE_workspace_active_set(win->workspace_hook, workspace_new);
- BLI_assert(CTX_wm_workspace(C) == workspace_new);
+ /* update screen *after* changing workspace - which also causes the
+ * actual screen change and updates context (including CTX_wm_workspace) */
+ screen_change_update(C, win, screen_new);
+ workspace_change_update(workspace_new, workspace_old, C, wm);
- WM_toolsystem_unlink_all(C, workspace_old);
- WM_toolsystem_reinit_all(C, win);
+ BLI_assert(CTX_wm_workspace(C) == workspace_new);
- return true;
+ WM_toolsystem_unlink_all(C, workspace_old);
+ WM_toolsystem_reinit_all(C, win);
+
+ /* Automatic mode switching. */
+ if (workspace_new->object_mode != workspace_old->object_mode) {
+ ED_object_mode_generic_enter(C, workspace_new->object_mode);
}
- return false;
+ return true;
}
/**