diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-03-02 16:19:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-03-02 16:23:02 +0300 |
commit | f9f559a05fc16e66031210e62bd7bc51d26208a3 (patch) | |
tree | ca121db88fc0c7898ca1fa46ca2c5907a0a465c0 /source/blender/editors/object/object_modes.c | |
parent | 35bd1bb957b3c7491875d58d0092eab39c3b4e0e (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/object/object_modes.c')
-rw-r--r-- | source/blender/editors/object/object_modes.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 47cbf782e07..33867a9f33e 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -281,4 +281,17 @@ bool ED_object_mode_generic_enter_or_other_window( } } +void ED_object_mode_generic_exit_or_other_window( + const struct EvaluationContext *eval_ctx, wmWindowManager *wm, + struct WorkSpace *workspace, struct Scene *scene, struct Object *ob) +{ + if (ob == NULL) { + return; + } + bool is_active = ED_workspace_object_mode_in_other_window(wm, NULL, ob, NULL); + if (is_active == false) { + ED_object_mode_generic_exit(eval_ctx, workspace, scene, ob); + } +} + /** \} */ |