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:
authorCampbell Barton <ideasman42@gmail.com>2021-01-22 03:33:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-22 04:38:55 +0300
commit7b528b2a3ad33b3ad7328213669d8179528e254b (patch)
tree8fcf33d4ff47f7d5519b8b7a769c5c04e05bccb2 /source/blender/editors/object/object_select.c
parent99e5d5ba21a44a9caa4f10b86c5065b916a096b4 (diff)
Fix T84920: Crash undoing object activation in the outliner
Regression from d8992192e5512380f57433df113f3e3f8b22f7cb The original code relied on having a separate edit-object pointer than the active object. Use a utility function to avoid code duplication as there are other areas that have similar functionality.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r--source/blender/editors/object/object_select.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index ab404f0a72d..ede0a92cede 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -143,6 +143,21 @@ void ED_object_base_activate(bContext *C, Base *base)
ED_object_base_active_refresh(CTX_data_main(C), scene, view_layer);
}
+void ED_object_base_activate_with_mode_exit_if_needed(bContext *C, Base *base)
+{
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ /* Currently we only need to be concerned with edit-mode. */
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ if (obedit) {
+ Object *ob = base->object;
+ if (((ob->mode & OB_MODE_EDIT) == 0) || (obedit->type != ob->type)) {
+ ED_object_editmode_exit(C, EM_FREEDATA);
+ }
+ }
+ ED_object_base_activate(C, base);
+}
+
bool ED_object_base_deselect_all_ex(ViewLayer *view_layer,
View3D *v3d,
int action,