Fix T58993: Duplicating after setting a rigid body world crashes Blender.

There is no guarantee that object in rigidbody collection already have a
valid rgigidbody data when rebuilding deg relations, that is often
generated on-the-fly by actual rigid body simulation.

Note that this can be an issue when generating deg relations I guess...
But at least it won't crash anymore.
This commit is contained in:
Bastien Montagne 2018-12-10 14:10:12 +01:00
parent 448731ac92
commit 073a011f91
Notes: blender-bot 2023-02-14 08:39:23 +01:00
Referenced by issue #58993, Duplicating after setting a rigid body world crashes Blender
1 changed files with 1 additions and 1 deletions

View File

@ -1627,7 +1627,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
/* Geometry must be known to create the rigid body. RBO_MESH_BASE uses the non-evaluated
* mesh, so then the evaluation is unnecessary. */
if (object->rigidbody_object->mesh_source != RBO_MESH_BASE) {
if (object->rigidbody_object != NULL && object->rigidbody_object->mesh_source != RBO_MESH_BASE) {
ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY);
add_relation(geom_key, init_key, "Object Geom Eval -> Rigidbody Rebuild");
}