diff options
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 26 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 4 |
2 files changed, 29 insertions, 1 deletions
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); |