diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 11:48:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 13:34:29 +0300 |
commit | 0c0e9390d1caec7858eb95ea2641cbf6d54e5e1f (patch) | |
tree | ea8f7a1accc76bcc866178698d1f816eef5a8dee /source/blender/editors/object/object_edit.c | |
parent | 3249ab70ef6124e7fb910f987b0e033f42035bfa (diff) |
Revert "Fix entering edit-mode when object mode and edit-data don't match"
Before this change, object-data could only have
one of the objects referencing it in edit-mode.
Reverting since multiple meshes in edit-mode (for the same object data)
isn't thread-safe as the evaluated edit-meshes are created in the
original edit-mesh, causing a crash updating the depsgraph
for linked duplicates, see: T86767.
While we could support this case, it's a bigger project without
significant benefits, so reinstate the limitation of only
allowing a single object to be in edit-mode for each object data.
This adds back the error from T85974 which caused an assertion
but didn't crash in release builds.
This reverts commit 2b60d7d09c51716e8d98834061c1a61ed6b96cf5.
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c774bc9f9cc..b1b66554088 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -718,26 +718,22 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag return false; } + /* This checks actual `ob->data`, for cases when other scenes have it in edit-mode context. + * Currently multiple objects sharing a mesh being in edit-mode at once isn't supported, + * see: T86767. */ + if (BKE_object_is_in_editmode(ob)) { + return true; + } + if (BKE_object_obdata_is_libdata(ob)) { /* Ideally the caller should check this. */ CLOG_WARN(&LOG, "Unable to enter edit-mode on library data for object '%s'", ob->id.name + 2); return false; } - if ((ob->mode & OB_MODE_EDIT) == 0) { - ob->restore_mode = ob->mode; - - ob->mode = OB_MODE_EDIT; - } + ob->restore_mode = ob->mode; - /* This checks actual `object->data`, - * for cases when other scenes have it in edit-mode context. - * - * It's important to run this after setting the object's mode (above), since in rare cases - * the object may have the edit-data but not it's object-mode set. See T85974. */ - if (BKE_object_is_in_editmode(ob)) { - return true; - } + ob->mode = OB_MODE_EDIT; if (ob->type == OB_MESH) { ok = true; |