[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33317] trunk/blender/source/blender/ editors/armature/editarmature.c: bone roll recalculate, option to use active bones Z axis.

Campbell Barton ideasman42 at gmail.com
Thu Nov 25 21:50:50 CET 2010


Revision: 33317
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33317
Author:   campbellbarton
Date:     2010-11-25 21:50:50 +0100 (Thu, 25 Nov 2010)

Log Message:
-----------
bone roll recalculate, option to use active bones Z axis.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2010-11-25 19:49:07 UTC (rev 33316)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2010-11-25 20:50:50 UTC (rev 33317)
@@ -2108,6 +2108,7 @@
 	{0, "X", 0, "X Axis", ""},
 	{1, "Y", 0, "Y Axis", ""},
 	{2, "Z", 0, "Z Axis", ""},
+	{5, "ACTIVE", 0, "Active Bone", ""},
 	{6, "VIEW", 0, "View Axis", ""},
 	{7, "CURSOR", 0, "Cursor", ""},
 	{0, NULL, 0, NULL, NULL}
@@ -2155,14 +2156,29 @@
 			}
 
 			copy_v3_v3(vec, rv3d->viewinv[2]);
+			mul_m3_v3(imat, vec);
 		}
+		else if (type==5) {
+			bArmature *arm= ob->data;
+			EditBone *ebone= (EditBone *)arm->act_edbone;
+			float mat[3][3], nor[3];
+
+			if(ebone==NULL) {
+				BKE_report(op->reports, RPT_ERROR, "No active bone set");
+				return OPERATOR_CANCELLED;
+			}
+
+			sub_v3_v3v3(nor, ebone->tail, ebone->head);
+			vec_roll_to_mat3(nor, ebone->roll, mat);			
+			copy_v3_v3(vec, mat[2]);
+		}
 		else { /* Axis */
 			assert(type >= 0 && type <= 5);
 			if(type<3)	vec[type]= 1.0f; 
 			else		vec[type-2]= -1.0f; 
+			mul_m3_v3(imat, vec);
 		}
 
-		mul_m3_v3(imat, vec);
 		if(axis_flip) negate_v3(vec);
 
 		CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {





More information about the Bf-blender-cvs mailing list