diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-10-14 22:51:00 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-10-14 22:51:00 +0400 |
commit | 96d2dc7d090975687e5b99495fcc1e5725e75120 (patch) | |
tree | 2f7d1527f992b802c25a237c7ed19a3eb3c54afa /source/blender/ikplugin/intern | |
parent | f579fe5681873749077b39a67f79ba6f7544d784 (diff) |
iTaSC: Selection of constrained axis for CopyPose constraint
This commit implements more of the CopyPose capabilities in
Blender. It is now possible to select which axis will be
constrained in position and orientation to obtain
interesting effects. Another option selects if the axis
are relative to the end effector or to the target.
Unlocking a position axis means that the coordinate along
this axis is not constrained and can take any value.
Unlocking the Y axis of the End Effector produces an
'aiming' effect: the end effector is oriented towards
the target but without stretching.
Unlocking a rotation axis means that the end effector can
freely rotation along that axis. Unlocking the Y axis
produces a 'tangent' effect: the end effector aligns with
the Y axis of the target but can rotate along that axis.
A 'floor' effect is possible if the position Z axis of the
target is unlocked. More effects are possible an can be
combined.
Diffstat (limited to 'source/blender/ikplugin/intern')
-rw-r--r-- | source/blender/ikplugin/intern/itasc_plugin.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 7f4c1967207..b6fceabdb46 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1417,10 +1417,22 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) switch (condata->type) { case CONSTRAINT_IK_COPYPOSE: controltype = 0; - if ((condata->flag & CONSTRAINT_IK_ROT) && (condata->orientweight != 0.0)) - controltype |= iTaSC::CopyPose::CTL_ROTATION; - if ((condata->weight != 0.0)) - controltype |= iTaSC::CopyPose::CTL_POSITION; + if (condata->flag & CONSTRAINT_IK_ROT) { + if (!(condata->flag & CONSTRAINT_IK_NO_ROT_X)) + controltype |= iTaSC::CopyPose::CTL_ROTATIONX; + if (!(condata->flag & CONSTRAINT_IK_NO_ROT_Y)) + controltype |= iTaSC::CopyPose::CTL_ROTATIONY; + if (!(condata->flag & CONSTRAINT_IK_NO_ROT_Z)) + controltype |= iTaSC::CopyPose::CTL_ROTATIONZ; + } + if (condata->flag & CONSTRAINT_IK_POS) { + if (!(condata->flag & CONSTRAINT_IK_NO_POS_X)) + controltype |= iTaSC::CopyPose::CTL_POSITIONX; + if (!(condata->flag & CONSTRAINT_IK_NO_POS_Y)) + controltype |= iTaSC::CopyPose::CTL_POSITIONY; + if (!(condata->flag & CONSTRAINT_IK_NO_POS_Z)) + controltype |= iTaSC::CopyPose::CTL_POSITIONZ; + } if (controltype) { iktarget->constraint = new iTaSC::CopyPose(controltype, controltype, bonelen); // set the gain @@ -1432,7 +1444,10 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) iktarget->errorCallback = copypose_error; iktarget->controlType = controltype; // add the constraint - ret = scene->addConstraintSet(iktarget->constraintName, iktarget->constraint, armname, iktarget->targetName, ikscene->channels[iktarget->channel].tail); + if (condata->flag & CONSTRAINT_IK_TARGETAXIS) + ret = scene->addConstraintSet(iktarget->constraintName, iktarget->constraint, iktarget->targetName, armname, "", ikscene->channels[iktarget->channel].tail); + else + ret = scene->addConstraintSet(iktarget->constraintName, iktarget->constraint, armname, iktarget->targetName, ikscene->channels[iktarget->channel].tail); } break; case CONSTRAINT_IK_DISTANCE: |