PyDriver a soloution to IK/FK switch ??

Pydriver exciting stuff does it mean we can now create a custom controller for an IK/FK switch ?? I have an idea but my programming skills are non exsitant.

I’ve been giving this a lot of thought and would like to know if it would be possible now to have a IK/FK switch simiar to the one that some maya rigs use bear with me on this it will make sense…(hopefully)

See tutorial on http://rigging101.com/ ik/fk switching tutorial.

http://student.vfs.com/%7Em07goosh/rigging101/free/ikfkswitching/images/sdk.gif Set Driven Key Select as your driver the locator switchIKFK.
As the driven, select the elbowREAL_orientConstraint1. (You can select it on your Hypergraph)
You’ll have elbowIKW0 and elbowFKW1 as attributes.
Create a Set Driven Key with armIKFK set to 0 and elbowIKW0 set to 1 and elbowFKW1 to 0.
Create a Set Driven Key with armIKFK set to 10 and elbowIKW0 set to 0 and elbowFKW1 to 1.
Do the same for the shoulder.

(Driven Keys as we know can be achieved through the use of actions on the armature.)

http://student.vfs.com/%7Em07goosh/rigging101/free/ikfkswitching/images/attribute.gif Controller
Create a locator.
Name it: switchIKFK
Add an attribute called “armIKFK” with a range of 0 to 1

(what im thinking here is that another bone could be used with a custom bone shape to be seen by animators which controlls the IK/Fk switch)

In other words what im propsing is you have your arm chain set up.

Two actions one where the IK constraints are enabled.
Another action where the IK constraints are disabled.
Over the same time frame on top of each other.
So you’d have two actions.

One called something like “IKon” time frame being 1 - 10
Another called something like “IKoff” time frame being 1-10
Then setting a dummy bone to be the driver for these actions.

Then link this bone to an atractive cotroller object with a custom bone shape (maybe have to use constraints ???)

The linking of this to work I think needs PyDriver as I remeber tring to do it in 2.40 and it wouldn’t work with IPO Drivers.

However we now have PyDriver which if I undersatnd correctly can write to itself thus making the creation of custom controllers viable.

Like I said I am no way a programmer an can just about do hello world with HTML so my challenge is for someone to come up with the PyDriver expression that would make this work.

I really hope this makes sense if it doesnt please let me know and i’ll try to explain a bit better.

Cheers :slight_smile:

Well all that seems interesting, and btw thanks for the link as I’ve wondered how the Maya IK/FK switch works, but it just seems like tremendous overkill to me.

Just move the IK slider to 0 or 1, seems pretty simple to me :wink:

Mike

Yeah you are right moving the IK slider is a solution however this rig set up provides less need to go into the playing about of sliders within character animation.

Its part of a set-up ive been devloping for a while but have come to a full stop with the IK/FK switch if i can get it utilised using this method I and other character animators will be able to work more intuitivly (wrong spl i know but hey) within the viewport.

The less sliders to play with the more the animator can just concentrate on the character and movement, as everything will be inside one window.

if ya see what i mean. Disagree if ya want but i find animation easier that way.

http://blenderartists.org/forum/%5BURL=http://imageshack.us%5D%5BIMG%5Dhttp://img165.imageshack.us/img165/4241/ikswitchse0.jpg%5B/IMG%5D%5B/URL%5Dhttp://img165.imageshack.us/img165/4241/ikswitchse0.jpg
sorta thing i mean with the blue box being the switch

Plus it’d be cool to know that it could be done would open a whole new world of rigging possibiites within blender.(creating custom constraints with PyDrivers that is)

Cheers for the respnse m8 :slight_smile:

You probably don’t need Python for this. Just create a bone somewhere in your rig (I would just use the ik handle!) and set its x rotation to drive the influence key of the ik constraint. Then all you would need to do to disable ik is rotate the handle out of the way! (Don’t forget to key the handle rotation too)

I just tried adding an IPO driver to the INF channel and it doesn’t work.

Also tried adding a simple PyDriver expression and it doesn’t work either.

i.e.

 ob("Empty").LocX 

http://mediawiki.blender.org/index.php/BlenderDev/PyDrivers

It appears that either

  • INF channel for bones is not “driveable”

or it’s a bug :slight_smile:

I’ll post it on the bug tracker and see if we can get any info … or maybe get the functionality fixed.

Mike

Cool nice one Mike_S

" I’ll post it on the bug tracker and see if we can get any info … or maybe get the functionality fixed."

Glad to see that someone is getting what im on about :slight_smile:

Be good if we coud get that sorted

Thanks for the quick replies guys :slight_smile:

Okay, I tried it and I didn’t have very many problems. The first problem is that you can’t add a driver to an armature that is driving itself (you need two objects). Second it has been months since I last tried to make a driver!

Anyway here is a blend showing it working. And yes I was going through the BSOD tutorials. Their great! I can’t wait till I have enough time to finish some of them :wink:

Keys to making it work:
Have a seperate driver object
give your driven channel some keys defining how the drivers curve will map to the driven
key your driver - it is the ipo of the driver that determines the output of the driven
don’t forget (like I just did) to parent your driver to your armature!

Hmm, that shouldn’t be necessary, though it does seem to be needed for an IK constraint INF channel. I’d call this a bug or at least an obscure “quirk” :slight_smile:

I tried adding an IPO-driver “switch” for rotation and track-to constraints and the “driver-object IPO” is not neccessary in those cases.

Mike

There are a few more issues involved:

  • Some rigs may have more than one control that you need to adjust to switch between IK and FK setups - Proog and Emo have not only the IK constraint but also a bunch of other copy rotations that need to be changed as well.
  • Best would be some nice way to automatically set the keys so that there are no jumps in the transition. You want the positions/rotations of the bones under IK influence to continue through the same positions/rotations that they were in previously, set by FK, and vice versa. This gets tricky if you want to actually blend rather than just switch IK/FK on/off in one frame.

Yeah the blend is what i was thinking of as in my little doodle up above, the manipulator would work not only as the IK object to move say an arm for instance.
…but the little box inside the manipulator would act as a means to blend between IK being on or off.

Thinking about it as i say i dont know anything about programming but couldn’t you say have the action for “IK off” be linked to the “IK off” word doodah…and the “Ik on” action be linked to the “IK on” word doodah then set up some sort of script where a visual element such as the blue box in this case controll the percentage by which it was on???

I think this is why I was looking originally at the “IK on” action being 10 frames long frame 1 being 100% frame 10 being 0%; and the “IK off” action being agin 10 frames long frame 1 being 0% and frame 10 being 100%

The illustration again just to show ya

I actually implimented this into my BSOD rig last night - works fine. I setup a widget to control the strength of my floor constraints too. The same object is driving all four constraints.

As for blending - isn’t that covered by keying the rotation of the widget.
For keeping transform - can’t you just key the bones on the frame before turning of the ik?

Broken is right, it is nearly impossable to get an instant change from Ik to Fk with this setup.

Also I had a problem with the inf ipo effecting the the constraint a little without the widget being keyed - the ipo is evaluated the same as if it didn’t have a driver. The solution is simple though - negitive rotations corispond to times < frame zero. Set all your drivers to use negative rotations and the inf will not be seen in any animation :wink:

I agree that it would be good to have someone go through the ipo driver code as it concerns constraints. It works as it is, but it seems a bit off. For instance the driver evaluation seemed to be off by one frame in some of my tests?

Hi,
Kitsu IK/FK switch works fine for me, thanks for the help!