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/blenkernel/intern/layer.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/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 22188d25df5..80329a1d328 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -42,7 +42,6 @@
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_node.h"
-#include "BKE_workspace.h"
#include "BKE_object.h"
#include "DNA_group_types.h"
@@ -130,17 +129,22 @@ ViewLayer *BKE_view_layer_default_render(const Scene *scene)
return scene->view_layers.first;
}
-/**
- * Returns the ViewLayer to be used for drawing, outliner, and other context related areas.
- */
-ViewLayer *BKE_view_layer_from_workspace_get(const struct Scene *scene, const struct WorkSpace *workspace)
+/* Returns view layer with matching name, or NULL if not found. */
+ViewLayer *BKE_view_layer_find(const Scene *scene, const char *layer_name)
{
- return BKE_workspace_view_layer_get(workspace, scene);
+ for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
+ if (STREQ(view_layer->name, layer_name)) {
+ return view_layer;
+ }
+ }
+
+ return NULL;
}
/**
- * This is a placeholder to know which areas of the code need to be addressed for the Workspace changes.
- * Never use this, you should either use BKE_view_layer_from_workspace_get or get ViewLayer explicitly.
+ * This is a placeholder to know which areas of the code need to be addressed
+ * for the Workspace changes. Never use this, you should typically get the
+ * active layer from the context or window.
*/
ViewLayer *BKE_view_layer_context_active_PLACEHOLDER(const Scene *scene)
{
@@ -418,9 +422,15 @@ void BKE_view_layer_rename(Main *bmain, Scene *scene, ViewLayer *view_layer, con
}
}
- /* fix all the animation data and workspace which may link to this */
+ /* fix all the animation data and windows which may link to this */
BKE_animdata_fix_paths_rename_all(NULL, "view_layers", oldname, view_layer->name);
- BKE_workspace_view_layer_rename(bmain, scene, oldname, view_layer->name);
+
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ if (win->scene == scene && STREQ(win->view_layer_name, oldname)) {
+ STRNCPY(win->view_layer_name, view_layer->name);
+ }
+ }
/* Dependency graph uses view layer name based lookups. */
DEG_id_tag_update(&scene->id, 0);