[Bf-blender-cvs] [0c0e9390d1c] master: Revert "Fix entering edit-mode when object mode and edit-data don't match"

Campbell Barton noreply at git.blender.org
Thu Apr 8 12:40:51 CEST 2021


Commit: 0c0e9390d1caec7858eb95ea2641cbf6d54e5e1f
Author: Campbell Barton
Date:   Thu Apr 8 18:48:23 2021 +1000
Branches: master
https://developer.blender.org/rB0c0e9390d1caec7858eb95ea2641cbf6d54e5e1f

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.

===================================================================

M	source/blender/editors/object/object_edit.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list