Fix crash in do-versions after recent changes

No one can simply go into a datablock before it was linked.
This commit is contained in:
Sergey Sharybin 2018-12-11 12:44:29 +01:00
parent 48225a4658
commit d415b5c7b8
Notes: blender-bot 2023-02-14 04:33:27 +01:00
Referenced by issue #59381, UV editor - Pinned vertex turns red only after another action
Referenced by issue #59266, Hard to select a single face when set to display as wireframe
Referenced by issue #59270, Modifiers not working for curves
Referenced by issue #59241, Cannot shift + select to add more nodes to selection
Referenced by issue #59229, Going to Wireframe while in edit mode crashes Blender
Referenced by issue #59220, Deleting object causes blender 2.8 to crash
Referenced by issue #59203, Edit mode : Multi-data objects view not sync
Referenced by issue #59204, Measure tool crashed Blender
Referenced by issue #59207, Material suddenly became emissive, but not for all objects using it
Referenced by issue #59168, Blender 2.8 (9a8b6d51c1) - Crash when going in Edit Mode with Multiresolution modifier
1 changed files with 14 additions and 12 deletions

View File

@ -917,6 +917,20 @@ void do_versions_after_linking_280(Main *bmain)
}
BKE_paint_toolslots_init_from_main(bmain);
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 36)) {
/* Ensure we get valid rigidbody object/constraint data in relevant collections' objects. */
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
if (rbw == NULL) {
continue;
}
BKE_rigidbody_objects_collection_validate(scene, rbw);
BKE_rigidbody_constraints_collection_validate(scene, rbw);
}
}
}
/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already.
@ -2489,18 +2503,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
dir[0] = -dir[0];
}
}
/* Ensure we get valid rigidbody object/constraint data in relevant collections' objects. */
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
if (rbw == NULL) {
continue;
}
BKE_rigidbody_objects_collection_validate(scene, rbw);
BKE_rigidbody_constraints_collection_validate(scene, rbw);
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 37)) {