[Bf-blender-cvs] [14a893f20ea] blender-v3.2-release: Fix T98225: file saved with an object in sculptmode that is disabled in viewports crashes on reload

Bastien Montagne noreply at git.blender.org
Wed May 18 17:21:20 CEST 2022


Commit: 14a893f20ea3b0bb6b2ff33c2245b3c78ee407b3
Author: Bastien Montagne
Date:   Wed May 18 17:19:15 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB14a893f20ea3b0bb6b2ff33c2245b3c78ee407b3

Fix T98225: file saved with an object in sculptmode that is disabled in viewports crashes on reload

Issue revealed by rB90e12e823ff0. Hidden objects may not be fully
evaluated by the despgraph, do not attempt to restore edit/sculpt/etc.
modes for those.

Should also be backported to 2.93 LTS release.

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

M	source/blender/editors/util/ed_util.c

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

diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index f07364cd4d3..e7b3bce700e 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -19,6 +19,7 @@
 
 #include "BKE_collection.h"
 #include "BKE_global.h"
+#include "BKE_layer.h"
 #include "BKE_lib_id.h"
 #include "BKE_lib_remap.h"
 #include "BKE_main.h"
@@ -137,8 +138,12 @@ void ED_editors_init(bContext *C)
       ED_object_posemode_enter_ex(bmain, ob);
     }
 
-    /* Other edit/paint/etc. modes are only settable for objects in active scene currently. */
-    if (!BKE_collection_has_object_recursive(scene->master_collection, ob)) {
+    /* Other edit/paint/etc. modes are only settable for objects visible in active scene currently.
+     * Otherwise, they (and their obdata) may not be (fully) evaluated, which is mandatory for some
+     * modes like Sculpt.
+     * Ref. T98225. */
+    if (!BKE_collection_has_object_recursive(scene->master_collection, ob) ||
+        !BKE_scene_has_object(scene, ob) || (ob->visibility_flag & OB_HIDE_VIEWPORT) != 0) {
       continue;
     }



More information about the Bf-blender-cvs mailing list