[Bf-blender-cvs] [be7ef0060f9] fracture_modifier: fix for initial rotation in convert to object and convert to keyframes

Martin Felke noreply at git.blender.org
Thu Aug 24 11:39:19 CEST 2017


Commit: be7ef0060f9dabb12ea92847c9e51e676862ccb3
Author: Martin Felke
Date:   Thu Aug 24 11:39:09 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rBbe7ef0060f9dabb12ea92847c9e51e676862ccb3

fix for initial rotation in convert to object and convert to keyframes

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

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 dad220a9ed8..a9421f6fe89 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2720,6 +2720,10 @@ static Object* do_convert_meshisland_to_object(MeshIsland *mi, Scene* scene, Gro
 			add_v3_v3(loc, mi->rigidbody->pos);
 			copy_v3_v3(size, s->impact_size);
 
+			if (mode) {
+				mul_qt_qtqt(rot, rot, mi->rot);
+			}
+
 			copy_v3_v3(ob_new->size, size);
 			copy_v3_v3(ob_new->loc, loc);
 			copy_qt_qt(ob_new->quat, rot);
@@ -3326,6 +3330,10 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
 						rot[2] = mi->rots[x*4+2];
 						rot[3] = mi->rots[x*4+3];
 
+						if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL) {
+							mul_qt_qtqt(rot, rot, mi->rot);
+						}
+
 						if (i >= start + 1)
 						{
 							//taken from rigidbody.py
@@ -3334,6 +3342,7 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
 							//	obj.rotation_quaternion = -q2
 							//else:
 							//	obj.rotation_quaternion = q2
+
 							if (dot_qtqt(prevrot, rot) < 0.0) {
 								negate_v4(rot);
 							}
@@ -3469,6 +3478,11 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
 		add_v3_v3(ob_new->loc, diff);
 
 		copy_qt_qt(ob_new->quat, ob->quat);
+
+		if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL) {
+			mul_qt_qtqt(ob_new->quat, ob_new->quat, mi->rot);
+		}
+
 		copy_v3_v3(ob_new->rot, ob->rot);
 		copy_v3_v3(ob_new->size, ob->size);
 	}



More information about the Bf-blender-cvs mailing list