[Bf-blender-cvs] [7b4a37b] fracture_modifier: partial fix, take proper constraint locations and rotations into account when converting back to objects, but todo, take own object transform into account too

Martin Felke noreply at git.blender.org
Fri Jan 22 00:36:23 CET 2016


Commit: 7b4a37b1b067b45de2395749e29dcec5ce4546d3
Author: Martin Felke
Date:   Fri Jan 22 00:36:14 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rB7b4a37b1b067b45de2395749e29dcec5ce4546d3

partial fix, take proper constraint locations and rotations into account when converting back to objects, but todo, take own object transform into account too

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

M	source/blender/editors/object/object_modifier.c

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

diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 6070b9a..6a72937 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2854,17 +2854,31 @@ static Object* do_convert_constraints(FractureModifierData *fmd, RigidBodyShardC
 		BKE_rigidbody_calc_threshold(max_con_mass, fmd, con);
 	}
 
-	/*use same settings as in modifier
-	 *XXX Maybe use the CENTER between objects ? Might be correct for Non fixed constraints*/
-	/* location for fixed constraints doesnt matter, so keep old setting */
-	/* keep in sync with rigidbody.c, BKE_rigidbody_validate_sim_shard_constraint() */
-	if (con->type == RBC_TYPE_FIXED) {
-		copy_v3_v3(rbcon->loc, ob1->loc);
+	if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
+	{
+		/*TODO XXX, take own transform into account too*/
+		float loc[3], rot[4], mat[4][4], size[3] = {1.0f, 1.0f, 1.0f};
+
+		copy_v3_v3(rbcon->loc, con->pos);
+		copy_qt_qt(rbcon->quat, con->orn);
+
+		loc_quat_size_to_mat4(mat, loc, rot, size);
+		copy_m4_m4(rbcon->obmat, mat);
 	}
-	else {
-		/* else set location to center */
-		add_v3_v3v3(rbcon->loc, ob1->loc, ob2->loc);
-		mul_v3_fl(rbcon->loc, 0.5f);
+	else
+	{
+		/*use same settings as in modifier
+		 *XXX Maybe use the CENTER between objects ? Might be correct for Non fixed constraints*/
+		/* location for fixed constraints doesnt matter, so keep old setting */
+		/* keep in sync with rigidbody.c, BKE_rigidbody_validate_sim_shard_constraint() */
+		if (con->type == RBC_TYPE_FIXED) {
+			copy_v3_v3(rbcon->loc, ob1->loc);
+		}
+		else {
+			/* else set location to center */
+			add_v3_v3v3(rbcon->loc, ob1->loc, ob2->loc);
+			mul_v3_fl(rbcon->loc, 0.5f);
+		}
 	}
 
 	/*omit check for existing objects in group, since this seems very slow, and should not be necessary in this internal function*/




More information about the Bf-blender-cvs mailing list