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-04 14:00:46 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-04 19:40:33 +0300
commitc43443d530bff67693dc2db4efdca6307703ce61 (patch)
tree40305a5fe154a25387c3fd3afcbfc560346bf383 /source/blender/editors/space_outliner/outliner_select.c
parent4e2228525fc9bbcff58e315c5e3bbc193cd63a0b (diff)
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.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 8a5df196c7b..bc514914b81 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -173,24 +173,25 @@ void outliner_object_mode_toggle(
/* Outliner Element Selection/Activation on Click */
static eOLDrawState active_viewlayer(
- bContext *C, Scene *UNUSED(scene), ViewLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
+ bContext *C, Scene *UNUSED(scene), ViewLayer *UNUSED(sl), TreeElement *te, const eOLSetState set)
{
- Scene *sce;
-
/* paranoia check */
if (te->idcode != ID_SCE)
return OL_DRAWSEL_NONE;
- sce = (Scene *)tselem->id;
- WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = te->directdata;
if (set != OL_SETSEL_NONE) {
- BKE_workspace_view_layer_set(workspace, view_layer, sce);
- WM_event_add_notifier(C, NC_SCREEN | ND_LAYER, NULL);
+ wmWindow *win = CTX_wm_window(C);
+ Scene *scene = WM_window_get_active_scene(win);
+
+ if (BLI_findindex(&scene->view_layers, view_layer) != -1) {
+ WM_window_set_active_view_layer(win, view_layer);
+ WM_event_add_notifier(C, NC_SCREEN | ND_LAYER, NULL);
+ }
}
else {
- return BKE_workspace_view_layer_get(workspace, sce) == view_layer;
+ return CTX_data_view_layer(C) == view_layer;
}
return OL_DRAWSEL_NONE;
}
@@ -895,7 +896,7 @@ eOLDrawState tree_element_type_active(
case TSE_CONSTRAINT:
return tree_element_active_constraint(C, scene, view_layer, te, tselem, set);
case TSE_R_LAYER:
- return active_viewlayer(C, scene, view_layer, te, tselem, set);
+ return active_viewlayer(C, scene, view_layer, te, set);
case TSE_POSEGRP:
return tree_element_active_posegroup(C, scene, view_layer, te, tselem, set);
case TSE_SEQUENCE: