diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-11-24 20:48:40 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-11-24 20:48:40 +0300 |
commit | 933ac8db12729327ccd313dea0575ad2eb631fa0 (patch) | |
tree | 1947aee693151e7038465fdb8b9276503a6f0d3b /source | |
parent | 8a4a2d96d0fb38548366a73a44440deba43571e7 (diff) |
Link pole controls to the parent of the bone with the IK constraint.
Presumably, this should give better result, but tests where not conclusive.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/editarmature_retarget.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/src/editarmature_retarget.c b/source/blender/src/editarmature_retarget.c index 062ca95031f..00cfafad0f5 100644 --- a/source/blender/src/editarmature_retarget.c +++ b/source/blender/src/editarmature_retarget.c @@ -805,15 +805,26 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* constraint targets */ if (cti && cti->get_constraint_targets) { + int target_index; + cti->get_constraint_targets(con, &targets); - for (ct= targets.first; ct; ct= ct->next) + for (target_index = 0, ct= targets.first; ct; target_index++, ct= ct->next) { if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) { /* SET bone link to bone corresponding to pchan */ EditBone *link = BLI_ghash_lookup(rg->bones_map, pchan->name); + /* for pole targets, link to parent bone instead, if possible */ + if (con->type == CONSTRAINT_TYPE_KINEMATIC && target_index == 1) + { + if (link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name)) + { + link = link->parent; + } + } + found = RIG_parentControl(ctrl, link); } } @@ -1011,14 +1022,12 @@ static void RIG_reconnectControlBones(RigGraph *rg) { if (VecLenf(ctrl->bone->tail, bone->head) < 0.01) { - printf("%s -> %s: TL_HEAD\n", ctrl->bone->name, bone->name); ctrl->tail_mode = TL_HEAD; ctrl->link_tail = bone; break; } else if (VecLenf(ctrl->bone->tail, bone->tail) < 0.01) { - printf("%s -> %s: TL_TAIL\n", ctrl->bone->name, bone->name); ctrl->tail_mode = TL_TAIL; ctrl->link_tail = bone; break; @@ -1031,10 +1040,6 @@ static void RIG_reconnectControlBones(RigGraph *rg) { } } - else - { - printf("%s FIT\n", ctrl->bone->name); - } } } @@ -1808,6 +1813,17 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize) if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE) { RigControl *ctrl_child; + +#if 0 + printf("CTRL: %s LINK: %s", ctrl->bone->name, ctrl->link->name); + + if (ctrl->link_tail) + { + printf(" TAIL: %s", ctrl->link_tail->name); + } + + printf("\n"); +#endif /* if there was a tail link: apply link, recalc resize factor and qrot */ if (ctrl->tail_mode != TL_NONE) |