diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-22 12:00:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-22 12:00:14 +0300 |
commit | 8eaea99d987194a5dc32aec404a2b1784eea0841 (patch) | |
tree | 5df4d25678c793e04584851e705106421a2c9f20 /source/blender/editors | |
parent | 927d099ec099e176b6e1f65555cbd4e70f681301 (diff) | |
parent | 3a9d43cf31da4f322c0789329b249c041ad1e3d7 (diff) |
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/editors')
-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 247163281e8..73326a2d5f2 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); |