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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user