[Bf-blender-cvs] [d7651d6] fracture_modifier: fix for crash when appending node groups if Fracture Modifier is active and frame > 1

Martin Felke noreply at git.blender.org
Wed Nov 2 20:41:11 CET 2016


Commit: d7651d65debcd01c45317103a715a33796ae82a3
Author: Martin Felke
Date:   Wed Nov 2 20:40:31 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rBd7651d65debcd01c45317103a715a33796ae82a3

fix for crash when appending node groups if Fracture Modifier is active and frame > 1

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

M	source/blender/blenkernel/intern/rigidbody.c

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index f7fd268..9a0699f 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2483,15 +2483,35 @@ void BKE_rigidbody_world_groups_relink(RigidBodyWorld *rbw)
 
 void BKE_rigidbody_world_id_loop(RigidBodyWorld *rbw, RigidbodyWorldIDFunc func, void *userdata)
 {
+	GroupObject *go;
+
 	func(rbw, (ID **)&rbw->group, userdata, IDWALK_NOP);
 	func(rbw, (ID **)&rbw->constraints, userdata, IDWALK_NOP);
 	func(rbw, (ID **)&rbw->effector_weights->group, userdata, IDWALK_NOP);
 
+	/* in regular blender one rigidbody is equivalent to one object, but in FM build you can have more
+	 * rigidbodies in the world than objects in the object array... thats why loop over the group of objects
+	 * of the rigidbody world... the rbw->objects array would contain group objects only anyway, also dont forget
+	 * regular constraints if there are any */
+
+	/*
 	if (rbw->objects) {
 		int i;
 		for (i = 0; i < rbw->numbodies; i++) {
 			func(rbw, (ID **)&rbw->objects[i], userdata, IDWALK_NOP);
 		}
+	}*/
+
+	if (rbw->group) {
+		for (go = rbw->group->gobject.first; go; go = go->next) {
+			func(rbw, (ID **)&go->ob, userdata, IDWALK_NOP);
+		}
+	}
+
+	if (rbw->constraints) {
+		for (go = rbw->constraints->gobject.first; go; go = go->next) {
+			func(rbw, (ID **)&go->ob, userdata, IDWALK_NOP);
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list