diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-10-24 18:58:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-10-24 18:58:31 +0400 |
commit | 30be716fc8e0ada286a94a53bf64dc5d16402c24 (patch) | |
tree | 6d5bbd71a1eea495afabfe7b93e8556b50dbab58 /source/blender/src/editconstraint.c | |
parent | 79224961836db454b454f20479a76b83e3eed3bc (diff) |
Pole Target for IK
==================
This adds an extra target to the IK solver constraint to define the
roll of the IK chain.
http://www.blender.org/development/current-projects/changes-since-244/inverse-kinematics/
Also fixes a crashes using ctrl+I to set an IK constraint on a bone
due to the recent constraints refactor.
Diffstat (limited to 'source/blender/src/editconstraint.c')
-rw-r--r-- | source/blender/src/editconstraint.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c index 0360c4add18..e0588b4c2a0 100644 --- a/source/blender/src/editconstraint.c +++ b/source/blender/src/editconstraint.c @@ -417,18 +417,26 @@ static void test_constraints (Object *owner, const char substring[]) case CONSTRAINT_TYPE_KINEMATIC: { bKinematicConstraint *data = curcon->data; + if (!exist_object(data->tar)) { data->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; - break; } - - if ( (data->tar == owner) && + else if ( (data->tar == owner) && (!get_named_bone(get_armature(owner), data->subtarget))) { curcon->flag |= CONSTRAINT_DISABLE; - break; } + + if (data->poletar && !exist_object(data->poletar)) { + data->poletar = NULL; + } + else if ( (data->poletar == owner) && + (!get_named_bone(get_armature(owner), + data->polesubtarget))) { + curcon->flag |= CONSTRAINT_DISABLE; + } + } break; case CONSTRAINT_TYPE_TRACKTO: @@ -816,7 +824,7 @@ void add_constraint(int only_IK) set_constraint_nth_target(con, ob, pchansel->name, 0); } else if(obsel) { - set_constraint_nth_target(con, obsel, NULL, 0); + set_constraint_nth_target(con, obsel, "", 0); } else if (ELEM4(nr, 11, 13, 14, 15)==0) { /* add new empty as target */ Base *base= BASACT, *newbase; @@ -838,7 +846,7 @@ void add_constraint(int only_IK) else VECCOPY(obt->loc, ob->obmat[3]); - set_constraint_nth_target(con, obt, NULL, 0); + set_constraint_nth_target(con, obt, "", 0); /* restore, add_object sets active */ BASACT= base; |