From f608b3c44402ef5c58217481d93e7fa83c9cd7cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 29 Jul 2012 17:49:14 +0000 Subject: code cleanup: - building without python works again - rename maxi/mini to i_max/i_min (so thay are available for function names) - some minor edits to IK stretch setting (no functional changes). --- source/blender/ikplugin/intern/iksolver_plugin.c | 3 ++- source/blender/ikplugin/intern/itasc_plugin.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/ikplugin/intern') diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 86bdc7e1ab6..af15333ece5 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -334,7 +334,8 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]); if (tree->stretch && (pchan->ikstretch > 0.0f)) { - double ikstretch = (double)pchan->ikstretch * (double)pchan->ikstretch; + const float ikstretch = pchan->ikstretch * pchan->ikstretch; + /* this function does its own clamping */ IK_SetStiffness(seg, IK_TRANS_Y, 1.0f - ikstretch); IK_SetLimit(seg, IK_TRANS_Y, IK_STRETCH_STIFF_MIN, IK_STRETCH_STIFF_MAX); } diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 1154605c673..516a4c7fdda 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1254,8 +1254,9 @@ static IK_Scene *convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) joint = bone->name; joint += ":TY"; ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]); - float ikstretch = pchan->ikstretch * pchan->ikstretch; - weight[1] = (1.0 - minf(1.0 - ikstretch, 0.99)); + const float ikstretch = pchan->ikstretch * pchan->ikstretch; + /* why invert twice here? */ + weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - IK_STRETCH_STIFF_EPS)); weights.push_back(weight[1]); } if (!ret) -- cgit v1.2.3