[Bf-blender-cvs] [16443b1] master: Fix T39874: Bone roll resets if bones are moved in edit mode

Bastien Montagne noreply at git.blender.org
Thu Apr 24 21:26:47 CEST 2014


Commit: 16443b1ae0f79e853ce13f17a3513a12c5cd8883
Author: Bastien Montagne
Date:   Thu Apr 24 21:15:43 2014 +0200
https://developer.blender.org/rB16443b1ae0f79e853ce13f17a3513a12c5cd8883

Fix T39874: Bone roll resets if bones are moved in edit mode

Own stupid typo in rBee387c6addb2, sigh...

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

M	source/blender/editors/armature/armature_edit.c

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

diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 24d941e..c5aa81c 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -217,7 +217,7 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const bool
 	vec_roll_to_mat3(nor, 0.0f, mat);
 
 	/* check the bone isn't aligned with the axis */
-	if (is_zero_v3(align_axis) || dot_v3v3(align_axis, mat[2]) <= (1.0f - FLT_EPSILON)) {
+	if (dot_v3v3(align_axis, mat[2]) >= (1.0f - FLT_EPSILON)) {
 		return roll;
 	}
 
@@ -226,7 +226,7 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const bool
 	sub_v3_v3v3(align_axis_proj, align_axis, vec);
 
 	if (axis_only) {
-		if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI / 2.0)) {
+		if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI_2)) {
 			negate_v3(align_axis_proj);
 		}
 	}
@@ -236,9 +236,8 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const bool
 	cross_v3_v3v3(vec, mat[2], align_axis_proj);
 
 	if (dot_v3v3(vec, nor) < 0.0f) {
-		roll = -roll;
+		return -roll;
 	}
-
 	return roll;
 }




More information about the Bf-blender-cvs mailing list