Revision: 26658
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26658
Author:   aligorith
Date:     2010-02-07 05:38:45 +0100 (Sun, 07 Feb 2010)

Log Message:
-----------
Fixed display of IK DOF limits for bones. The old rotations were using M_PI/360 
instead of M_PI/180 in many places, which I overlooked when porting this over 
to using radians only.

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    
2010-02-07 02:54:41 UTC (rev 26657)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c    
2010-02-07 04:38:45 UTC (rev 26658)
@@ -1479,8 +1479,9 @@
                                                                        float 
amin[3], amax[3];
                                                                        
                                                                        for 
(i=0; i<3; i++) {
-                                                                               
amin[i]= (float)sin(pchan->limitmin[i]);
-                                                                               
amax[i]= (float)sin(pchan->limitmax[i]);
+                                                                               
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
+                                                                               
amin[i]= (float)sin(pchan->limitmin[i]*0.5f);
+                                                                               
amax[i]= (float)sin(pchan->limitmax[i]*0.5f);
                                                                        }
                                                                        
                                                                        
glScalef(1.0f, -1.0f, 1.0f);
@@ -1498,13 +1499,14 @@
                                                        
                                                        /* arcs */
                                                        if (pchan->ikflag & 
BONE_IK_ZLIMIT) {
+                                                               /* OpenGL 
requires rotations in degrees; so we're taking the average angle here */
                                                                theta= 
0.5f*(pchan->limitmin[2]+pchan->limitmax[2]) * (float)(180.0f/M_PI);
                                                                
glRotatef(theta, 0.0f, 0.0f, 1.0f);
                                                                
                                                                glColor3ub(50, 
50, 255);        // blue, Z axis limit
                                                                
glBegin(GL_LINE_STRIP);
                                                                for (a=-16; 
a<=16; a++) {
-                                                                       float 
fac= ((float)a)/16.0f;
+                                                                       float 
fac= ((float)a)/16.0f * 0.5f; /* *0.5f here comes from M_PI/360.0f when 
rotations were still in degrees */
                                                                        
                                                                        phi= 
fac * (pchan->limitmax[2] - pchan->limitmin[2]);
                                                                        
@@ -1520,13 +1522,14 @@
                                                        }                       
                
                                                        
                                                        if (pchan->ikflag & 
BONE_IK_XLIMIT) {
-                                                               theta= 0.5f * 
(pchan->limitmin[0] + pchan->limitmax[0]) * (float)(180.0f/M_PI);
+                                                       /* OpenGL requires 
rotations in degrees; so we're taking the average angle here */
+                                                               theta= 
0.5f*(pchan->limitmin[0] + pchan->limitmax[0]) * (float)(180.0f/M_PI);
                                                                
glRotatef(theta, 1.0f, 0.0f, 0.0f);
                                                                
                                                                glColor3ub(255, 
50, 50);        // Red, X axis limit
                                                                
glBegin(GL_LINE_STRIP);
                                                                for (a=-16; 
a<=16; a++) {
-                                                                       float 
fac= ((float)a)/16.0f;
+                                                                       float 
fac= ((float)a)/16.0f * 0.5f; /* *0.5f here comes from M_PI/360.0f when 
rotations were still in degrees */
                                                                        phi= 
(float)(0.5*M_PI) + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
                                                                        
                                                                        i= (a 
== -16) ? 2 : 3;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to