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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_object.h6
-rw-r--r--source/blender/editors/object/object_edit.c26
-rw-r--r--source/blender/editors/object/object_select.c4
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);