Commit: ca90d66c17096db88810a0453e44ff1fbe4195e0
Author: Julian Eisel
Date:   Tue Mar 7 20:34:06 2017 +0100
Branches: temp-workspace-multi-window
https://developer.blender.org/rBca90d66c17096db88810a0453e44ff1fbe4195e0

Make screen-layouts of duplicated windows much less broken :)

There are probably still some issues/glitches after duplicating a window
here and there, but most of it should work fine by now.

===================================================================

M       source/blender/blenkernel/intern/context.c
M       source/blender/blenkernel/intern/image.c
M       source/blender/blenkernel/intern/scene.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/depsgraph/intern/depsgraph_tag.cc
M       source/blender/editors/include/ED_screen.h
M       source/blender/editors/workspace/workspace_edit.c
M       source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index d1ac491e4e..e48d379775 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -838,7 +838,7 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
                C->data.scene = C->wm.window->scene;
        }
        C->wm.workspace = (win) ? BKE_workspace_active_get(win->workspace_hook) 
: NULL;
-       C->wm.screen = (win) ? BKE_workspace_active_screen_get(C->wm.workspace) 
: NULL;
+       C->wm.screen = (win) ? 
BKE_workspace_hook_active_screen_get(win->workspace_hook) : NULL;
        C->wm.area = NULL;
        C->wm.region = NULL;
 }
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 4ba48260d3..4050e2d150 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2542,8 +2542,7 @@ void BKE_image_walk_all_users(const Main *mainp, void 
*customdata,
        /* image window, compo node users */
        for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
                for (win = wm->windows.first; win; win = win->next) {
-                       WorkSpace *workspace = 
BKE_workspace_active_get(win->workspace_hook);
-                       const bScreen *screen = 
BKE_workspace_active_screen_get(workspace);
+                       const bScreen *screen = 
BKE_workspace_hook_active_screen_get(win->workspace_hook);
 
                        for (ScrArea *sa = screen->areabase.first; sa; sa = 
sa->next) {
                                if (sa->spacetype == SPACE_VIEW3D) {
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 7709ca9137..da5720237c 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1404,8 +1404,7 @@ static bool check_rendered_viewport_visible(Main *bmain)
        wmWindowManager *wm = bmain->wm.first;
        wmWindow *window;
        for (window = wm->windows.first; window != NULL; window = window->next) 
{
-               const WorkSpace *workspace = 
BKE_workspace_active_get(window->workspace_hook);
-               const bScreen *screen = 
BKE_workspace_active_screen_get(workspace);
+               const bScreen *screen = 
BKE_workspace_hook_active_screen_get(window->workspace_hook);
 
                for (ScrArea *area = screen->areabase.first; area != NULL; area 
= area->next) {
                        View3D *v3d = area->spacedata.first;
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index fe0d454da9..2c13d66724 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1086,7 +1086,6 @@ static void current_screen_compat(Main *mainvar, bScreen 
**r_screen, Scene **r_s
 {
        wmWindowManager *wm;
        wmWindow *window = NULL;
-       WorkSpace *workspace;
 
        /* find a global current screen in the first open window, to have
         * a reasonable default for reading in older versions */
@@ -1111,8 +1110,7 @@ static void current_screen_compat(Main *mainvar, bScreen 
**r_screen, Scene **r_s
                }
        }
 
-       workspace = BKE_workspace_active_get(window->workspace_hook);
-       *r_screen = (window) ? BKE_workspace_active_screen_get(workspace) : 
NULL;
+       *r_screen = (window) ? 
BKE_workspace_hook_active_screen_get(window->workspace_hook) : NULL;
        *r_scene = (window) ? window->scene : NULL;
 }
 
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc 
b/source/blender/depsgraph/intern/depsgraph_tag.cc
index efef03f9eb..53f245b2b0 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -302,8 +302,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
                     win = (wmWindow *)win->next)
                {
                        if (win->scene->id.tag & LIB_TAG_DOIT) {
-                               const WorkSpace *workspace = 
BKE_workspace_active_get(win->workspace_hook);
-                               bScreen *screen = 
BKE_workspace_active_screen_get(workspace);
+                               bScreen *screen = 
BKE_workspace_hook_active_screen_get(win->workspace_hook);
 
                                graph->layers |= 
BKE_screen_visible_layers(screen, win->scene);
                                win->scene->id.tag &= ~LIB_TAG_DOIT;
diff --git a/source/blender/editors/include/ED_screen.h 
b/source/blender/editors/include/ED_screen.h
index a81f271f05..bd6dcf8715 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -138,7 +138,7 @@ struct WorkSpaceLayout 
*ED_workspace_layout_duplicate(struct WorkSpace *workspac
 bool ED_workspace_delete(struct Main *bmain, struct bContext *C,
                          struct wmWindowManager *wm, struct wmWindow *win,
                          struct WorkSpace *ws);
-void ED_workspace_scene_data_sync(struct WorkSpace *workspace, Scene *scene);
+void ED_workspace_scene_data_sync(struct WorkSpaceHook *hook, Scene *scene);
 bool ED_workspace_layout_delete(struct bContext *C, struct WorkSpace 
*workspace, struct WorkSpaceLayout *layout_old) ATTR_NONNULL();
 bool ED_workspace_layout_cycle(struct bContext *C, struct WorkSpace 
*workspace, const short direction) ATTR_NONNULL();
 
diff --git a/source/blender/editors/workspace/workspace_edit.c 
b/source/blender/editors/workspace/workspace_edit.c
index 1955300c9e..b7487c156f 100644
--- a/source/blender/editors/workspace/workspace_edit.c
+++ b/source/blender/editors/workspace/workspace_edit.c
@@ -122,8 +122,7 @@ bool ED_workspace_change(bContext *C, wmWindowManager *wm, 
wmWindow *win, WorkSp
 {
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
-       WorkSpace *workspace_old = WM_window_get_active_workspace(win);
-       bScreen *screen_old = BKE_workspace_active_screen_get(workspace_old);
+       bScreen *screen_old = 
BKE_workspace_hook_active_screen_get(win->workspace_hook);
        bScreen *screen_new;
 
        BKE_workspace_change_prepare(bmain, win->workspace_hook, workspace_new);
@@ -131,6 +130,8 @@ bool ED_workspace_change(bContext *C, wmWindowManager *wm, 
wmWindow *win, WorkSp
        screen_new = screen_change_prepare(screen_old, screen_new, bmain, C, 
win);
 
        if (screen_new) {
+               WorkSpace *workspace_old = WM_window_get_active_workspace(win);
+
                BKE_workspace_active_set(win->workspace_hook, workspace_new);
 
                /* update screen *after* changing workspace - which also causes 
the actual screen change */
@@ -201,11 +202,11 @@ bool ED_workspace_delete(Main *bmain, bContext *C, 
wmWindowManager *wm, wmWindow
 
 /**
  * Some editor data may need to be synced with scene data (3D View camera and 
layers).
- * This function ensures data is synced for editors in active layout of \a 
workspace.
+ * This function ensures data is synced for editors in active layout of \a 
hook.
  */
-void ED_workspace_scene_data_sync(WorkSpace *workspace, Scene *scene)
+void ED_workspace_scene_data_sync(WorkSpaceHook *hook, Scene *scene)
 {
-       bScreen *screen = BKE_workspace_active_screen_get(workspace);
+       bScreen *screen = BKE_workspace_hook_active_screen_get(hook);
        BKE_screen_view3d_scene_sync(screen, scene);
 }
 
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 855f0b98d0..ee1aebdd15 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1754,7 +1754,7 @@ void WM_windows_scene_data_sync(const ListBase *win_lb, 
Scene *scene)
 {
        for (wmWindow *win = win_lb->first; win; win = win->next) {
                if (WM_window_get_active_scene(win) == scene) {
-                       
ED_workspace_scene_data_sync(WM_window_get_active_workspace(win), scene);
+                       ED_workspace_scene_data_sync(win->workspace_hook, 
scene);
                }
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to