diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-22 09:31:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-24 07:24:04 +0300 |
commit | 9f3c5a061de50293286ea4118b46c379ed0744e7 (patch) | |
tree | 5c7700fdd335e9792c55dd89e390c0d786458425 /source | |
parent | a1f44e43a253eabee74f40315b62cc0c0ff4cb9c (diff) |
Fix outliner and animation editors exiting multi-object edit-mode
When multiple objects were in edit-mode,
only the active object would exit edit-mode.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_object.h | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 26 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 4 |
3 files changed, 35 insertions, 1 deletions
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 7ba2992b8fe..bd1a4a0c63f 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -207,6 +207,12 @@ bool ED_object_editmode_exit_ex(struct Main *bmain, int flag); bool ED_object_editmode_exit(struct bContext *C, int flag); +bool ED_object_editmode_exit_multi_ex(struct Main *bmain, + struct Scene *scene, + struct ViewLayer *view_layer, + int flag); +bool ED_object_editmode_exit_multi(struct bContext *C, int flag); + bool ED_object_editmode_enter_ex(struct Main *bmain, struct Scene *scene, struct Object *ob, diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 41886dd1dcd..4cf49d262ca 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -683,6 +683,32 @@ bool ED_object_editmode_exit(bContext *C, int flag) return ED_object_editmode_exit_ex(bmain, scene, obedit, flag); } +bool ED_object_editmode_exit_multi_ex(Main *bmain, Scene *scene, ViewLayer *view_layer, int flag) +{ + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + if (obedit == NULL) { + return false; + } + bool changed = false; + const short obedit_type = obedit->type; + + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + Object *ob = base->object; + if ((ob->type == obedit_type) && (ob->mode & OB_MODE_EDIT)) { + changed |= ED_object_editmode_exit_ex(bmain, scene, base->object, flag); + } + } + return changed; +} + +bool ED_object_editmode_exit_multi(bContext *C, int flag) +{ + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + return ED_object_editmode_exit_multi_ex(bmain, scene, view_layer, flag); +} + bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag) { bool ok = false; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index ede0a92cede..b36d89dc37a 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -152,7 +152,9 @@ void ED_object_base_activate_with_mode_exit_if_needed(bContext *C, Base *base) if (obedit) { Object *ob = base->object; if (((ob->mode & OB_MODE_EDIT) == 0) || (obedit->type != ob->type)) { - ED_object_editmode_exit(C, EM_FREEDATA); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ED_object_editmode_exit_multi_ex(bmain, scene, view_layer, EM_FREEDATA); } } ED_object_base_activate(C, base); |