[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40531] trunk/blender/source/blender/ editors/space_view3d/drawarmature.c: correction to armature drawing code, was implicitly casting the bone flag to a short when it contains flags in the int range .

Campbell Barton ideasman42 at gmail.com
Sun Sep 25 06:55:07 CEST 2011


Revision: 40531
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40531
Author:   campbellbarton
Date:     2011-09-25 04:55:04 +0000 (Sun, 25 Sep 2011)
Log Message:
-----------
correction to armature drawing code, was implicitly casting the bone flag to a short when it contains flags in the int range.
also was converting pose bone constflag to an int which is harmless but may as well not to it.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawarmature.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2011-09-25 04:47:46 UTC (rev 40530)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2011-09-25 04:55:04 UTC (rev 40531)
@@ -146,7 +146,7 @@
 }
 
 /* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor (short colCode, int boneflag, int constflag)
+static short set_pchan_glColor (short colCode, int boneflag, short constflag)
 {
 	switch (colCode) {
 	case PCHAN_COLOR_NORMAL:
@@ -752,7 +752,7 @@
 
 
 /* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
 {
 	float head, tail /*, length*/;
 	float *headvec, *tailvec, dirvec[3];
@@ -861,7 +861,7 @@
 }
 
 /* does wire only for outline selecting */
-static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
 {
 	GLUquadricObj	*qobj;
 	float head, tail, length;
@@ -991,7 +991,7 @@
 static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; 
 
 
-static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
 {
 	float length;
 	
@@ -1125,7 +1125,7 @@
 	}
 }
 
-static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
 {
 	float xwidth, length, zwidth;
 	
@@ -1238,7 +1238,7 @@
 	}
 }
 
-static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
 {
 	Mat4 *bbones = NULL;
 	int segments = 0;
@@ -1288,7 +1288,7 @@
 	draw_wire_bone_segments(pchan, bbones, length, segments);
 }
 
-static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length)
+static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
 {
 	
 	/*	Draw a 3d octahedral bone, we use normalized space based on length,
@@ -1659,7 +1659,7 @@
 	float smat[4][4], imat[4][4], bmat[4][4];
 	int index= -1;
 	short do_dashed= 3, draw_wire= 0;
-	short flag, constflag;
+	int flag;
 	
 	/* being set below */
 	arm->layer_used= 0;
@@ -1880,6 +1880,7 @@
 				 ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
 			{
 				if (bone->layer & arm->layer) {
+					const short constflag= pchan->constflag;
 					if ((do_dashed & 1) && (pchan->parent)) {
 						/* Draw a line from our root to the parent's tip 
 						 *	- only if V3D_HIDE_HELPLINES is enabled...
@@ -1901,16 +1902,16 @@
 						 * 	- only if temporary chain (i.e. "autoik")
 						 */
 						if (arm->flag & ARM_POSEMODE) {
-							if (pchan->constflag & PCHAN_HAS_IK) {
+							if (constflag & PCHAN_HAS_IK) {
 								if (bone->flag & BONE_SELECTED) {
-									if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
+									if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
 									else glColor3ub(200, 200, 50);	// add theme!
 									
 									glLoadName(index & 0xFFFF);
 									pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
 								}
 							}
-							else if (pchan->constflag & PCHAN_HAS_SPLINEIK) {
+							else if (constflag & PCHAN_HAS_SPLINEIK) {
 								if (bone->flag & BONE_SELECTED) {
 									glColor3ub(150, 200, 50);	// add theme!
 									
@@ -1935,7 +1936,6 @@
 						flag |= BONE_DRAW_ACTIVE;
 					
 					/* extra draw service for pose mode */
-					constflag= pchan->constflag;
 
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);




More information about the Bf-blender-cvs mailing list