diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-13 17:08:15 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-13 17:08:15 +0400 |
commit | b5a57b193d098fa343cf053167e1faf5078c28c9 (patch) | |
tree | 3088a209d29042c5ad51f16eb9f1f80230d8e045 /source/blender/ikplugin/intern/itasc_plugin.cpp | |
parent | 2414abae0662c3aa80f4910a48b544900ec42930 (diff) |
Fix #29041: parenting problem with tree IK for iTaSC and iksolver, where it
would use the wrong bone as parent on brancing. Patch by Juha Maki-Kanto.
Diffstat (limited to 'source/blender/ikplugin/intern/itasc_plugin.cpp')
-rw-r--r-- | source/blender/ikplugin/intern/itasc_plugin.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 2cb3a32ae3e..f4720b7fc41 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -326,11 +326,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co break; for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); } - parent= a-1; + segcount= segcount-a; target->tip= tree->totchannel + segcount - 1; if (segcount > 0) { + for(parent = a - 1; parent < tree->totchannel; parent++) + if(tree->pchan[parent] == chanlist[segcount-1]->parent) + break; + + /* shouldn't happen, but could with dependency cycles */ + if(parent == tree->totchannel) + parent = a - 1; + /* resize array */ newsize= tree->totchannel + segcount; oldchan= tree->pchan; |