diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-13 10:57:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-13 10:57:03 +0400 |
commit | 0c815a42fd42ffb19321945617686ff82921b873 (patch) | |
tree | 16ec96760c86463d05556217055696b13f7097d0 /source | |
parent | bd5a62cfcb7ddf4a6c111eede3d4a496902138ee (diff) |
bugfix [#23528] ED_pose_channel_in_IK_chain() doesn't take length of IK chain into account
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 3bbbb271bda..b8c945f0d77 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -157,7 +157,7 @@ static short pose_has_protected_selected(Object *ob, short only_selected, short } /* only for real IK, not for auto-IK */ -int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) +static int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level) { bConstraint *con; Bone *bone; @@ -167,18 +167,25 @@ int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) for(con= pchan->constraints.first; con; con= con->next) { if(con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data= con->data; - if((data->flag & CONSTRAINT_IK_AUTO)==0) - return 1; + if(data->rootbone == 0 || data->rootbone > level) { + if((data->flag & CONSTRAINT_IK_AUTO)==0) + return 1; + } } } for(bone= pchan->bone->childbase.first; bone; bone= bone->next) { pchan= get_pose_channel(ob->pose, bone->name); - if(pchan && ED_pose_channel_in_IK_chain(ob, pchan)) + if(pchan && pose_channel_in_IK_chain(ob, pchan, level + 1)) return 1; } return 0; } +int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) +{ + return pose_channel_in_IK_chain(ob, pchan, 0); +} + /* ********************************************** */ /* Motion Paths */ |