bugfix [#23528] ED_pose_channel_in_IK_chain() doesn't take length of IK chain into account

This commit is contained in:
Campbell Barton 2010-09-13 06:57:03 +00:00
parent bd5a62cfcb
commit 0c815a42fd

@ -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->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 */