Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-02-07 07:38:45 +0300
committerJoshua Leung <aligorith@gmail.com>2010-02-07 07:38:45 +0300
commit447e4efaac08d64f91f77d62cc071db636f6a099 (patch)
tree52fee8537539a6d3613f726c6dab0ad17962e719 /source/blender/editors/space_view3d/drawarmature.c
parente939e74e88c31afc79f849c2b1122f8ef700b6fa (diff)
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.
Diffstat (limited to 'source/blender/editors/space_view3d/drawarmature.c')
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 9e5d20fca7f..cc3769c70fc 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1479,8 +1479,9 @@ static void draw_pose_dofs(Object *ob)
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 @@ static void draw_pose_dofs(Object *ob)
/* 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 @@ static void draw_pose_dofs(Object *ob)
}
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;