diff options
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index dec7d3ece2c..904e267304b 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -649,16 +649,18 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB } if (!rest) { + const int num_segments = bone->segments - 1; // XXX: why n - 1, and not n? + float scaleFactorIn = 1.0f; - if (a <= bone->segments - 1) { + if (a <= num_segments) { const float scaleIn = bone->scaleIn * pchan->scaleIn; - scaleFactorIn = 1.0f + (scaleIn - 1.0f) * ((float)(bone->segments - a - 1) / (float)(bone->segments - 1)); + scaleFactorIn = 1.0f + (scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments); } float scaleFactorOut = 1.0f; if (a >= 0) { const float scaleOut = bone->scaleOut * pchan->scaleOut; - scaleFactorOut = 1.0 + (scaleOut - 1.0f) * ((float)(a + 1) / (float)(bone->segments - 1)); + scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments); } float scalefac = scaleFactorIn * scaleFactorOut; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 5d3d301d6fe..db9ae7ad42d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1152,14 +1152,16 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU /* "extra" scale facs... */ { + const int num_segments = ebone->segments - 1; // XXX: why n - 1, and not n? + float scaleFactorIn = 1.0f; - if (a <= ebone->segments - 1) { - scaleFactorIn = 1.0f + (ebone->scaleIn - 1.0f) * ((float)(ebone->segments - a - 1) / (float)(ebone->segments - 1)); + if (a <= num_segments) { + scaleFactorIn = 1.0f + (ebone->scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments); } float scaleFactorOut = 1.0f; if (a >= 0) { - scaleFactorOut = 1.0 + (ebone->scaleOut - 1.0f) * ((float)(a + 1) / (float)(ebone->segments - 1)); + scaleFactorOut = 1.0f + (ebone->scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments); } float scalefac = scaleFactorIn * scaleFactorOut; |