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:
authorCampbell Barton <ideasman42@gmail.com>2018-03-02 16:19:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-03-02 16:23:02 +0300
commitf9f559a05fc16e66031210e62bd7bc51d26208a3 (patch)
treeca121db88fc0c7898ca1fa46ca2c5907a0a465c0 /source/blender/editors/scene
parent35bd1bb957b3c7491875d58d0092eab39c3b4e0e (diff)
WorkSpace: Simplify exiting mode after changes
It was too tricky to know ahead of time if an object would still be visible in the new window/workspace/scene/layer combination, especially since other windows may share some of these data-blocks. So store the context, make the change, then check if the object is still visible, freeing mode data of it's not.
Diffstat (limited to 'source/blender/editors/scene')
-rw-r--r--source/blender/editors/scene/scene_edit.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index 462820c93c0..ba7ad1505c3 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -130,18 +130,11 @@ void ED_scene_change_update(
Object *obact_new = OBACT(layer_new);
/* mode syncing */
+ EvaluationContext eval_ctx_old;
+ CTX_data_eval_ctx(C, &eval_ctx_old);
eObjectMode object_mode_old = workspace->object_mode;
ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace);
Object *obact_old = OBACT(layer_old);
- if (obact_old && (obact_new != obact_old)) {
- bool obact_old_is_active =
- ED_workspace_object_mode_in_other_window(bmain->wm.first, win, obact_old, NULL);
- if (obact_old && (obact_old_is_active == false)) {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- ED_object_mode_generic_exit(&eval_ctx, workspace, scene_old, obact_old);
- }
- }
win->scene = scene_new;
CTX_data_scene_set(C, scene_new);
@@ -150,17 +143,14 @@ void ED_scene_change_update(
DEG_graph_relations_update(depsgraph, bmain, scene_new, layer_new);
DEG_on_visible_update(bmain, false);
-
- /* TODO(campbell) Syncing duplicates some logic without being 100% identical,
- * keep and eye on this to see if we can generalize in the future. */
if (obact_new == obact_old) {
/* pass */
}
else {
+ ED_object_mode_generic_exit_or_other_window(&eval_ctx_old, bmain->wm.first, workspace, scene_old, obact_old);
ED_object_mode_generic_enter_or_other_window(C, object_mode_old);
}
-
ED_screen_update_after_scene_change(screen, scene_new, layer_new);
ED_render_engine_changed(bmain);
ED_update_for_newframe(bmain, scene_new, layer_new, depsgraph);