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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-21 16:27:29 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-30 17:10:03 +0300
commit9f78f471d7aeacd357349f0eb4b8f8bbc01db756 (patch)
treee6dd30928d9566ad86cf19658f691e3c78fe887c /source/blender/editors/screen/workspace_edit.c
parentdf8a7ec3a81394fef4a21a6f1c1e4a43d5d44fba (diff)
Workspaces: switch object mode when switching workspaces.
In the workspace properties a mode can now be configured that is automatically enabled when switching to the workspace. This is a test to validate how well it works. The weak point is that if you don't have an appropriate object already select it will not switch modes. See T56475.
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;
}
/**