Commit: d8b561de76d5d4498c79c68de2aec7a13a4bc2dd
Author: Martin Felke
Date:   Sun Nov 29 19:59:47 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rBd8b561de76d5d4498c79c68de2aec7a13a4bc2dd

fix: make sure a rigidbody exists on each mesh island after loading when trying 
to access it

===================================================================

M       source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 680bc91..108a905 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5007,10 +5007,15 @@ static void read_meshIsland(FileData *fd, MeshIsland 
**address)
        mi->vertno = newdataadr(fd, mi->vertno);
 
        mi->rigidbody = newdataadr(fd, mi->rigidbody);
-       mi->rigidbody->physics_object = newdataadr(fd, 
mi->rigidbody->physics_object);
-       mi->rigidbody->physics_shape = newdataadr(fd, 
mi->rigidbody->physics_shape);
-       mi->rigidbody->flag |= RBO_FLAG_NEEDS_VALIDATE;
-       mi->rigidbody->flag |= RBO_FLAG_NEEDS_RESHAPE;
+       if (mi->rigidbody)
+       {
+               /*should not happen that a mesh island has no rigidbody... */
+               /*maybe the modifier was inactive while saving ?*/
+               mi->rigidbody->physics_object = newdataadr(fd, 
mi->rigidbody->physics_object);
+               mi->rigidbody->physics_shape = newdataadr(fd, 
mi->rigidbody->physics_shape);
+               mi->rigidbody->flag |= RBO_FLAG_NEEDS_VALIDATE;
+               mi->rigidbody->flag |= RBO_FLAG_NEEDS_RESHAPE;
+       }
 
        mi->neighbor_ids = newdataadr(fd, mi->neighbor_ids );
        mi->bb = newdataadr(fd, mi->bb);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to