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-07-03 16:34:26 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-04 19:40:33 +0300
commit4e2228525fc9bbcff58e315c5e3bbc193cd63a0b (patch)
tree20138d75e3185172eabe84a31ee49b6ec990fcfc /source/blender/editors/screen
parent2bef8ca1b8e0e51f1e09216d2a42f7fc0b7d723a (diff)
Workspaces: add main and child windows.
* Main windows show a topbar and statusbar, and select a workspace and scene. They are created with Window > New Main Window. * Child windows do not show a topbar or statusbar. These follow the workspace and scene of their parent main window. Created with Window > New Window or View > Duplicate Area into New Window. * The purpose of this change is to support multi monitor setups where you just want to put more editors on the other monitors. Without multiple topbars and statusbars, working within a single workspace and scene. Creating multiple main windows is intended to be a concious choice to do different tasks in different workspaces and scenes. * Note these changes do not currently affect how the operating system treats the windows. * When changing the workspace, the layout in all child windows changes. This makes sense if we consider child windows to be just a way to extend the main window across more monitors. In some case it may be useful to keep the same layout though, we can add an option for this depending on user feedback.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/screen_edit.c49
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/screen/workspace_edit.c4
3 files changed, 45 insertions, 10 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 6bc8a6c10cf..50609815168 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -477,8 +477,8 @@ void ED_screens_initialize(Main *bmain, wmWindowManager *wm)
wmWindow *win;
for (win = wm->windows.first; win; win = win->next) {
- if (WM_window_get_active_workspace(win) == NULL) {
- WM_window_set_active_workspace(win, bmain->workspaces.first);
+ if (BKE_workspace_active_get(win->workspace_hook) == NULL) {
+ BKE_workspace_active_set(win->workspace_hook, bmain->workspaces.first);
}
if (BLI_listbase_is_empty(&win->global_areas.areabase)) {
@@ -792,11 +792,19 @@ static void screen_global_statusbar_area_create(wmWindow *win)
void ED_screen_global_areas_create(wmWindow *win)
{
+ /* Don't create global areas for child windows. */
+ if (win->parent) {
+ return;
+ }
+
+ /* Don't create global area for temporary windows. */
bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
- if (screen->temp == 0) {
- screen_global_topbar_area_create(win);
- screen_global_statusbar_area_create(win);
+ if (screen->temp) {
+ return;
}
+
+ screen_global_topbar_area_create(win);
+ screen_global_statusbar_area_create(win);
}
@@ -936,13 +944,40 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre
}
}
-void ED_screen_update_after_scene_change(const bScreen *screen, Scene *scene_new, ViewLayer *view_layer)
+static ViewLayer *scene_change_get_new_view_layer(const WorkSpace *workspace, const Scene *scene_new)
+{
+ ViewLayer *layer_new = BKE_workspace_view_layer_exists(workspace, scene_new);
+ return layer_new ? layer_new : BKE_view_layer_default_view(scene_new);
+}
+
+void ED_screen_scene_change(bContext *C, wmWindow *win, Scene *scene)
{
+ const bScreen *screen = WM_window_get_active_screen(win);
+ WorkSpace *workspace = CTX_wm_workspace(C);
+ ViewLayer *view_layer = scene_change_get_new_view_layer(workspace, scene);
+
+#if 0
+ /* mode syncing */
+ Object *obact_new = OBACT(view_layer);
+ UNUSED_VARS(obact_new);
+ eObjectMode object_mode_old = workspace->object_mode;
+ ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace);
+ Object *obact_old = OBACT(layer_old);
+ UNUSED_VARS(obact_old, object_mode_old);
+#endif
+
+ BKE_workspace_view_layer_set(workspace, view_layer, scene);
+
+ win->scene = scene;
+ if (CTX_wm_window(C) == win) {
+ CTX_data_scene_set(C, scene);
+ }
+
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- screen_set_3dview_camera(scene_new, view_layer, sa, v3d);
+ screen_set_3dview_camera(scene, view_layer, sa, v3d);
}
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index a0e8357b8f3..ab0fbfacf93 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1130,7 +1130,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
newwin->scene = scene;
- WM_window_set_active_workspace(newwin, workspace);
+ BKE_workspace_active_set(newwin->workspace_hook, workspace);
/* allocs new screen and adds to newly created window, using window size */
layout_new = ED_workspace_layout_add(bmain, workspace, newwin, BKE_workspace_layout_name_get(layout_old));
newsc = BKE_workspace_layout_screen_get(layout_new);
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 9d329355500..9ba9b70a6e8 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -191,8 +191,8 @@ bool ED_workspace_change(
BLI_assert(BKE_workspace_layout_screen_get(layout_new) == screen_new);
if (screen_new) {
- WM_window_set_active_layout(win, workspace_new, layout_new);
- WM_window_set_active_workspace(win, workspace_new);
+ BKE_workspace_hook_layout_for_workspace_set(win->workspace_hook, workspace_new, layout_new);
+ BKE_workspace_active_set(win->workspace_hook, workspace_new);
/* update screen *after* changing workspace - which also causes the
* actual screen change and updates context (including CTX_wm_workspace) */