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/workspace.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/workspace.c')
-rw-r--r--source/blender/blenkernel/intern/workspace.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index f0f57e8e56c..783baebd525 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -157,7 +157,6 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
void BKE_workspace_free(WorkSpace *workspace)
{
BKE_workspace_relations_free(&workspace->hook_layout_relations);
- BLI_freelistN(&workspace->scene_layer_relations);
BLI_freelistN(&workspace->owner_ids);
BLI_freelistN(&workspace->layouts);
@@ -267,48 +266,9 @@ void BKE_workspace_relations_free(
}
}
-void BKE_workspace_scene_relations_free_invalid(
- WorkSpace *workspace)
-{
- for (WorkSpaceSceneRelation *relation = workspace->scene_layer_relations.first, *relation_next; relation; relation = relation_next) {
- relation_next = relation->next;
-
- if (relation->scene == NULL) {
- BLI_freelinkN(&workspace->scene_layer_relations, relation);
- }
- else if (!BLI_findstring(&relation->scene->view_layers, relation->view_layer, offsetof(ViewLayer, name))) {
- BLI_freelinkN(&workspace->scene_layer_relations, relation);
- }
- }
-}
-
/* -------------------------------------------------------------------- */
/* General Utils */
-void BKE_workspace_view_layer_rename(
- const Main *bmain,
- const Scene *scene,
- const char *old_name,
- const char *new_name)
-{
- for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
- for (WorkSpaceSceneRelation *relation = workspace->scene_layer_relations.first; relation; relation = relation->next) {
- if (relation->scene == scene && STREQ(relation->view_layer, old_name)) {
- STRNCPY(relation->view_layer, new_name);
- }
- }
- }
-}
-
-void BKE_workspace_view_layer_remove(
- const Main *bmain,
- const ViewLayer *UNUSED(view_layer))
-{
- for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
- BKE_workspace_scene_relations_free_invalid(workspace);
- }
-}
-
WorkSpaceLayout *BKE_workspace_layout_find(
const WorkSpace *workspace, const bScreen *screen)
{
@@ -429,46 +389,6 @@ void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook, WorkSpace *wor
BKE_workspace_hook_layout_for_workspace_set(hook, workspace, layout);
}
-Base *BKE_workspace_active_base_get(const WorkSpace *workspace, const Scene *scene)
-{
- ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
- return view_layer->basact;
-}
-
-ViewLayer *BKE_workspace_view_layer_exists(const WorkSpace *workspace, const Scene *scene)
-{
- WorkSpaceSceneRelation *relation = BLI_findptr(&workspace->scene_layer_relations, scene, offsetof(WorkSpaceSceneRelation, scene));
- return (relation) ? BLI_findstring(&scene->view_layers, relation->view_layer, offsetof(ViewLayer, name)) : NULL;
-}
-
-ViewLayer *BKE_workspace_view_layer_get(const WorkSpace *workspace, const Scene *scene)
-{
- ViewLayer *layer = BKE_workspace_view_layer_exists(workspace, scene);
-
- if (layer == NULL) {
- BKE_workspace_view_layer_set((WorkSpace *)workspace, scene->view_layers.first, (Scene *)scene);
- layer = scene->view_layers.first;
- }
-
- return layer;
-}
-
-void BKE_workspace_view_layer_set(WorkSpace *workspace, ViewLayer *layer, Scene *scene)
-{
- WorkSpaceSceneRelation *relation = BLI_findptr(&workspace->scene_layer_relations, scene, offsetof(WorkSpaceSceneRelation, scene));
- if (relation == NULL) {
- relation = MEM_callocN(sizeof(*relation), __func__);
- }
- else {
- BLI_remlink(&workspace->scene_layer_relations, relation);
- }
-
- /* (Re)insert at the head of the list, for faster lookups. */
- relation->scene = scene;
- STRNCPY(relation->view_layer, layer->name);
- BLI_addhead(&workspace->scene_layer_relations, relation);
-}
-
ListBase *BKE_workspace_layouts_get(WorkSpace *workspace)
{
return &workspace->layouts;
@@ -504,27 +424,6 @@ void BKE_workspace_hook_layout_for_workspace_set(
workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout);
}
-/* Update / evaluate */
-
-void BKE_workspace_update_tagged(Main *bmain,
- WorkSpace *workspace,
- Scene *scene)
-{
- ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
- struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene,
- view_layer,
- true);
- /* TODO(sergey): For now all dependency graphs which are evaluated from
- * workspace are considered active. This will work all fine with "locked"
- * view layer and time across windows. This is to be granted separately,
- * and for until then we have to accept ambiguities when object is shared
- * across visible view layers and has overrides on it.
- */
- DEG_make_active(depsgraph);
- BKE_scene_graph_update_tagged(depsgraph, bmain);
-}
-
-
bool BKE_workspace_owner_id_check(
const WorkSpace *workspace, const char *owner_id)
{