diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-14 00:39:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-14 00:49:20 +0300 |
commit | 769c9a2363ed7dae5fceeea1f94e685482719901 (patch) | |
tree | 11d5e117a25848644900f717e37d7f133f7f734e /source/blender/makesrna/intern/rna_layer.c | |
parent | 6e040b045ab1d94a877ab6f72f431c9b64e1121c (diff) |
Object Mode: remove Scene.obedit
This means we can support having the same scene in different windows
with different edit-objects.
Diffstat (limited to 'source/blender/makesrna/intern/rna_layer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index efa05ed5b92..9489fa243dc 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -73,6 +73,7 @@ const EnumPropertyItem rna_enum_collection_type_items[] = { #include "BKE_node.h" #include "BKE_scene.h" #include "BKE_mesh.h" +#include "BKE_object.h" #include "BKE_workspace.h" #include "DEG_depsgraph_build.h" @@ -845,11 +846,25 @@ static void rna_LayerObjects_active_object_update(struct bContext *C, PointerRNA if (scene != ptr->id.data) { return; } - ViewLayer *view_layer = (ViewLayer *)ptr->data; - if (scene->obedit) { - ED_object_editmode_exit(C, EM_FREEDATA); + + /* We don't know the previous active object in update. + * + * Not correct because it's possible other work-spaces use these. + * although that's a corner case. */ + WorkSpace *workspace = CTX_wm_workspace(C); + if (workspace->object_mode & OB_MODE_EDIT) { + Object *obact = OBACT(view_layer); + FOREACH_OBJECT(view_layer, ob) { + if (ob != obact) { + if (BKE_object_is_in_editmode(ob)) { + ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA); + } + } + } + FOREACH_OBJECT_END; } + ED_object_base_activate(C, view_layer->basact); } |