diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2020-09-09 12:46:40 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2020-09-09 12:48:52 +0300 |
commit | d51c8f78ff8a210675dae44048156c23e3793508 (patch) | |
tree | 809aa4e321f5771d46aad901a2a1804dd31b0aca /source/blender/blenkernel/intern/rigidbody.c | |
parent | 377a1e3d7b7f108c5feff24dc2adb5ef7c402989 (diff) |
Fix T80596: Convert to Curve from Mesh crashes Blender
The point cache code needs a non NULL rbw pointer.
This could have been avoided if there was a sanity check in the convert
function, so added a check there as well.
Diffstat (limited to 'source/blender/blenkernel/intern/rigidbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 7eab716d805..0a31af032d3 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1554,18 +1554,18 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob, const bo BKE_collection_object_add(bmain, scene->master_collection, ob); } BKE_collection_object_remove(bmain, rbw->group, ob, free_us); + + /* flag cache as outdated */ + BKE_rigidbody_cache_reset(rbw); + /* Reset cache as the object order probably changed after freeing the object. */ + PTCacheID pid; + BKE_ptcache_id_from_rigidbody(&pid, NULL, rbw); + BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); } /* remove object's settings */ BKE_rigidbody_free_object(ob, rbw); - /* flag cache as outdated */ - BKE_rigidbody_cache_reset(rbw); - /* Reset cache as the object order probably changed after freeing the object. */ - PTCacheID pid; - BKE_ptcache_id_from_rigidbody(&pid, NULL, rbw); - BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); - /* Dependency graph update */ DEG_relations_tag_update(bmain); DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); |