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:
authorBastien Montagne <bastien@blender.org>2022-05-18 18:19:15 +0300
committerBastien Montagne <bastien@blender.org>2022-05-18 18:19:15 +0300
commit14a893f20ea3b0bb6b2ff33c2245b3c78ee407b3 (patch)
treeaa691f623ab10a2cb9307a5341975674f101b518 /source/blender/editors
parentc56103356f642041f76c0be84772a40f1caad9df (diff)
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/util/ed_util.c9
1 files changed, 7 insertions, 2 deletions
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;
}