[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24436] trunk/blender/source/blender: Bugfixes for Armatures, SplineIK, and F-Curve RNA:

Joshua Leung aligorith at gmail.com
Tue Nov 10 00:41:48 CET 2009


Revision: 24436
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24436
Author:   aligorith
Date:     2009-11-10 00:41:48 +0100 (Tue, 10 Nov 2009)

Log Message:
-----------
Bugfixes for Armatures, SplineIK, and F-Curve RNA:
* Fixed the handling of the 'draw_active' flag for drawing of armatures. This is now cleared from bones in old files (so one bone always got represented as active in the viewport even when others were selected), and the flag is correctly set temporarily when drawing the bones (only one place had been done).

* Fixed typo with SplineIK that was making the root bone of the bone chains always be ignored. Similar functionality can come back at some point, but in a more useful form.

* Shortened the UI names for the F-Curve colouring modes to increase readability. The old ones were too long to be able to distinguish between entries in the UI.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/space_view3d/drawarmature.c
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c	2009-11-09 23:33:56 UTC (rev 24435)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c	2009-11-09 23:41:48 UTC (rev 24436)
@@ -1694,8 +1694,6 @@
 		/* setup new empty array for the points list */
 		if (ikData->points) 
 			MEM_freeN(ikData->points);
-		// NOTE: just do chainlen+1 always for now, since we may get crashes otherwise
-		//ikData->numpoints= (ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT)? ikData->chainlen : ikData->chainlen+1;
 		ikData->numpoints= ikData->chainlen+1; 
 		ikData->points= MEM_callocN(sizeof(float)*ikData->numpoints, "Spline IK Binding");
 		
@@ -1754,6 +1752,7 @@
 		maxScale = totLength / splineLen;
 		
 		/* apply scaling correction to all of the temporary points */
+		// TODO: this is really not adequate enough on really short chains
 		for (i = 0; i < segcount; i++)
 			jointPoints[i] *= maxScale;
 	}
@@ -1833,7 +1832,6 @@
 	}
 	
 	/* step 1b: get xyz positions for the head endpoint of the bone */
-		/* firstly, calculate the position that the path suggests */
 	if ( where_on_path(ikData->tar, tree->points[index+1], vec, dir, NULL, &rad) ) {
 		/* store the position, and convert it to pose space */
 		Mat4MulVecfl(ob->imat, vec);
@@ -1842,12 +1840,6 @@
 		/* set the new radius (it should be the average value) */
 		radius = (radius+rad) / 2;
 	}
-	if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) && (pchan == tree->root)) 
-	{
-		// this is the root bone, and it can be controlled however we like...
-		// TODO: how do we calculate the offset of the root, if we don't even know the binding?
-		VECCOPY(poseHead, pchan->pose_head);
-	}
 	
 	/* step 2: determine the implied transform from these endpoints 
 	 *	- splineVec: the vector direction that the spline applies on the bone
@@ -1927,7 +1919,7 @@
 	}
 	
 	/* step 5: set the location of the bone in the matrix */
-	VECCOPY(poseMat[3], pchan->pose_head);
+	VECCOPY(poseMat[3], poseHead);
 	
 	/* finally, store the new transform */
 	Mat4CpyMat4(pchan->pose_mat, poseMat);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2009-11-09 23:33:56 UTC (rev 24435)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2009-11-09 23:41:48 UTC (rev 24436)
@@ -2367,6 +2367,8 @@
 	bone->prop= newdataadr(fd, bone->prop);
 	if(bone->prop)
 		IDP_DirectLinkProperty(bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+		
+	bone->flag &= ~BONE_DRAW_ACTIVE;
 
 	link_list(fd, &bone->childbase);
 

Modified: trunk/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2009-11-09 23:33:56 UTC (rev 24435)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2009-11-09 23:41:48 UTC (rev 24436)
@@ -1629,10 +1629,11 @@
 					flag= bone->flag;
 					if ( (bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) )
 						flag &= ~BONE_CONNECTED;
-
-					if(bone==arm->act_bone)
+					
+					/* set temporary flag for drawing bone as active */
+					if (bone == arm->act_bone)
 						flag |= BONE_DRAW_ACTIVE;
-
+					
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);
 					
@@ -1708,6 +1709,10 @@
 							flag= bone->flag;
 							if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
 								flag &= ~BONE_CONNECTED;
+								
+							/* set temporary flag for drawing bone as active */
+							if (bone == arm->act_bone)
+								flag |= BONE_DRAW_ACTIVE;
 							
 							draw_custom_bone(scene, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
 							
@@ -1800,6 +1805,10 @@
 					if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
 						flag &= ~BONE_CONNECTED;
 					
+					/* set temporary flag for drawing bone as active */
+					if (bone == arm->act_bone)
+						flag |= BONE_DRAW_ACTIVE;
+					
 					/* extra draw service for pose mode */
 					constflag= pchan->constflag;
 					if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
@@ -1875,12 +1884,12 @@
 							Mat4CpyMat4(bmat, pchan->pose_mat);
 							bone_matrix_translate_y(bmat, pchan->bone->length);
 							glMultMatrixf(bmat);
-
+							
 							/* do cached text draw immediate to include transform */
 							view3d_cached_text_draw_begin();
 							drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS);
 							view3d_cached_text_draw_end(v3d, ar, 1, bmat);
-
+							
 							glPopMatrix();
 						}
 					}
@@ -1959,6 +1968,10 @@
 					flag= eBone->flag;
 					if ( (eBone->parent) && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) )
 						flag &= ~BONE_CONNECTED;
+						
+					/* set temporary flag for drawing bone as active */
+					if (eBone == arm->act_edbone)
+						flag |= BONE_DRAW_ACTIVE;
 					
 					if (arm->drawtype==ARM_ENVELOPE)
 						draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
@@ -1994,6 +2007,10 @@
 				flag= eBone->flag;
 				if ( (eBone->parent) && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) )
 					flag &= ~BONE_CONNECTED;
+					
+				/* set temporary flag for drawing bone as active */
+				if (eBone == arm->act_edbone)
+					flag |= BONE_DRAW_ACTIVE;
 				
 				if (arm->drawtype == ARM_ENVELOPE) {
 					if (dt < OB_SOLID)
@@ -2063,12 +2080,12 @@
 							get_matrix_editbone(eBone, bmat);
 							bone_matrix_translate_y(bmat, eBone->length);
 							glMultMatrixf(bmat);
-
+							
 							/* do cached text draw immediate to include transform */
 							view3d_cached_text_draw_begin();
 							drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
 							view3d_cached_text_draw_end(v3d, ar, 1, bmat);
-
+							
 							glPopMatrix();
 						}
 						

Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2009-11-09 23:33:56 UTC (rev 24435)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2009-11-09 23:41:48 UTC (rev 24436)
@@ -652,8 +652,8 @@
 		{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", ""},
 		{0, NULL, 0, NULL, NULL}};
 	static EnumPropertyItem prop_mode_color_items[] = {
-		{FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Automatic Rainbow", ""},
-		{FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Automatic XYZ to RGB", ""},
+		{FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Auto Rainbow", ""},
+		{FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Auto XYZ to RGB", ""},
 		{FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined", ""},
 		{0, NULL, 0, NULL, NULL}};
 





More information about the Bf-blender-cvs mailing list