From c43443d530bff67693dc2db4efdca6307703ce61 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 4 Jul 2018 13:00:46 +0200 Subject: Workspaces: store view layer per main window, instead of per workspace. It was a bit odd that the scene was stored per window but not the view layer. The reasoning was that you would use different view layers for different tasks. This is still possible, but it's more predictable to switch them both explicitly, and with child window support manually syncing the view layers between multiple windows is no longer needed as often. --- source/blender/editors/scene/scene_edit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/scene') diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c index 0ebbd770c9f..62933178266 100644 --- a/source/blender/editors/scene/scene_edit.c +++ b/source/blender/editors/scene/scene_edit.c @@ -23,9 +23,11 @@ */ #include +#include #include "BLI_compiler_attrs.h" #include "BLI_listbase.h" +#include "BLI_string.h" #include "BKE_context.h" #include "BKE_global.h" @@ -175,12 +177,17 @@ bool ED_scene_view_layer_delete( BLI_remlink(&scene->view_layers, layer); BLI_assert(BLI_listbase_is_empty(&scene->view_layers) == false); - ED_workspace_view_layer_unset(bmain, scene, layer, scene->view_layers.first); + /* Remove from windows. */ + wmWindowManager *wm = bmain->wm.first; + for (wmWindow *win = wm->windows.first; win; win = win->next) { + if (win->scene == scene && STREQ(win->view_layer_name, layer->name)) { + ViewLayer *first_layer = BKE_view_layer_default_view(scene); + STRNCPY(win->view_layer_name, first_layer->name); + } + } BKE_view_layer_free(layer); - BKE_workspace_view_layer_remove(bmain, layer); - DEG_id_tag_update(&scene->id, 0); DEG_relations_tag_update(bmain); WM_main_add_notifier(NC_SCENE | ND_LAYER | NA_REMOVED, scene); -- cgit v1.2.3