[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23046] branches/blender2.5/blender/source /blender: 2.5 - Armature/Pose Bugfixes:

Joshua Leung aligorith at gmail.com
Mon Sep 7 13:05:16 CEST 2009


Revision: 23046
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23046
Author:   aligorith
Date:     2009-09-07 13:05:16 +0200 (Mon, 07 Sep 2009)

Log Message:
-----------
2.5 - Armature/Pose Bugfixes:

* Added missing prototype from arithb 

* Added define for Axis-Angle rotations. This has not yet been hooked up for actual usage yet, since there are some issues regarding evaluation which I'd like to investigate further first.

* Editing numbuttons for posechannel transforms now updates in realtime. Sending ND_POSE|ND_TRANSFORM was causing confusion for the listeners (which only check for either/or)

* Partial fix for axis drawing on bones. Now the axes are drawn at the tips of the bones again, but unfortunately the texts aren't (since they only use the object matrix, they get drawn at the origin).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c

Modified: branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h	2009-09-07 09:43:04 UTC (rev 23045)
+++ branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h	2009-09-07 11:05:16 UTC (rev 23046)
@@ -377,6 +377,7 @@
 void Vec2Lerpf(float *target, float *a, float *b, float t);
 
 void AxisAngleToQuat(float *q, float *axis, float angle);
+void QuatToAxisAngle(float *q, float *axis, float *angle);
 void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3]);
 void vectoquat(float *vec, short axis, short upflag, float *q);
 

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	2009-09-07 09:43:04 UTC (rev 23045)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	2009-09-07 11:05:16 UTC (rev 23046)
@@ -1816,7 +1816,7 @@
 						if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) {
 							glPushMatrix();
 							glMultMatrixf(pchan->pose_mat);
-							//glTranslatef(0.0f, pchan->bone->length, 0.0f);
+							glTranslatef(0.0f, pchan->bone->length, 0.0f);
 							drawaxes(0.25f*pchan->bone->length, 0, OB_ARROWS);
 							glPopMatrix();
 						}
@@ -2000,7 +2000,7 @@
 						if (arm->flag & ARM_DRAWAXES) {
 							glPushMatrix();
 							set_matrix_editbone(eBone);
-							//glTranslatef(0.0f, eBone->length, 0.0f);
+							glTranslatef(0.0f, eBone->length, 0.0f);
 							drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
 							glPopMatrix();
 						}

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h	2009-09-07 09:43:04 UTC (rev 23045)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h	2009-09-07 11:05:16 UTC (rev 23046)
@@ -206,6 +206,11 @@
 	PCHAN_ROT_YZX,
 	PCHAN_ROT_ZXY,
 	PCHAN_ROT_ZYX,
+	/* NOTE: space is reserved here for 18 other possible 
+	 * euler rotation orders not implemented 
+	 */
+		/* axis angle rotations */
+	PCHAN_ROT_AXISANGLE = -1
 } ePchan_RotMode;
 
 /* Pose ------------------------------------ */

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c	2009-09-07 09:43:04 UTC (rev 23045)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_pose.c	2009-09-07 11:05:16 UTC (rev 23046)
@@ -137,7 +137,7 @@
 	/* check if any change - if so, need to convert data */
 	// TODO: this needs to be generalised at some point to work for objects too...
 	if (value > 0) { /* to euler */
-		if (pchan->rotmode < 0) { // FIXME: need a define for this
+		if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
 			/* axis-angle to euler */
 			float m[3][3];
 			
@@ -154,7 +154,7 @@
 		/* else { no conversion needed } */
 	}
 	else if (value == PCHAN_ROT_QUAT) { /* to quat */
-		if (pchan->rotmode < 0) { // FIXME: need a define for this
+		if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
 			/* axis angle to quat */
 			float q[4];
 			
@@ -169,13 +169,13 @@
 		/* else { no conversion needed } */
 	}
 	else { /* to axis-angle */
-		if (pchan->rotmode > 0) { // FIXME: need a define for this
+		if (pchan->rotmode > 0) {
 			/* euler to axis angle */
 			float q[4];
 			
 			/* convert to temp quat, then to axis angle (since stored in same var) */
 			EulOToQuat(pchan->eul, pchan->rotmode, q);
-			QuatToAxisAngle(q, &pchan->quat[1], pchan->quat[0]);
+			QuatToAxisAngle(q, &pchan->quat[1], &pchan->quat[0]);
 		}
 		else if (pchan->rotmode == PCHAN_ROT_QUAT) {
 			/* quat to axis angle */
@@ -183,7 +183,7 @@
 			
 			/* copy to temp var first, since quats and axis-angle are stored in same place */
 			QuatCopy(q, pchan->quat);
-			QuatToAxisAngle(q, &pchan->quat[1], pchan->quat[0]);
+			QuatToAxisAngle(q, &pchan->quat[1], &pchan->quat[0]);
 		}
 	}
 	
@@ -420,6 +420,7 @@
 		{PCHAN_ROT_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"},
 		{PCHAN_ROT_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"},
 		{PCHAN_ROT_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"},
+		//{PCHAN_ROT_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector."},
 		{0, NULL, 0, NULL, NULL}};
 	
 	StructRNA *srna;
@@ -479,30 +480,30 @@
 	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_ui_text(prop, "Location", "");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Scale", "");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "quat");
 	RNA_def_property_ui_text(prop, "Rotation", "Rotation in Quaternions.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 	
 	prop= RNA_def_property(srna, "euler_rotation", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "eul");
 	RNA_def_property_float_funcs(prop, "rna_PoseChannel_euler_rotation_get", "rna_PoseChannel_euler_rotation_set", NULL);
 	RNA_def_property_ui_text(prop, "Rotation (Euler)", "Rotation in Eulers.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 	
 	prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotmode");
 	RNA_def_property_enum_items(prop, prop_rotmode_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
 	RNA_def_property_ui_text(prop, "Rotation Mode", "");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	/* These three matrix properties await an implementation of the PROP_MATRIX subtype, which currently doesn't exist. */
 /*	prop= RNA_def_property(srna, "channel_matrix", PROP_FLOAT, PROP_MATRIX);
@@ -535,97 +536,97 @@
 	RNA_def_property_boolean_funcs(prop,  "rna_PoseChannel_has_ik_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_dof_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
 	RNA_def_property_ui_text(prop, "IK X DoF", "Allow movement around the X axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_dof_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
 	RNA_def_property_ui_text(prop, "IK Y DoF", "Allow movement around the Y axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_dof_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
 	RNA_def_property_ui_text(prop, "IK Z DoF", "Allow movement around the Z axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
 	RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
 	RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
 	RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis.");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	prop= RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
 	RNA_def_property_range(prop, -180.0f, 0.0f);
 	RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
 	RNA_def_property_range(prop, 0.0f, 180.0f);
 	RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list