View Full Version : scriptJob for IK/FK switch

03 March 2006, 02:54 AM
Here at the studio, we all want to have a rig that has the IK always following the FK and viceversa. AT ALL TIMES. Right now the way we do it is to switch from IK to FK (or back) and then I made a script that aligns the controls for example if you are switching from FK to IK, the script point and orient constraint the IK controller to the FK wrist controller and then deletes the constraint.

so basically the switch is done in 2 steps:
1) going from FK to IK
2) press a button that launches the IKFK_Snap which aligns the controls


I am looking into using scriptJob in order to automate this. I would like to have Maya launching the "IKFK_Snap" script when we switch. so I made these 2 scriptJob and I put them in a script node in the character's scene:

scriptJob -kws -attributeChange switches_ctrl.LeftArm_IK L_armIKFK_Snap; //for the Left Arm

scriptJob -kws -attributeChange switches_ctrl.RightArm_IK R_armIKFK_Snap; //for the right arm

It works very well until we start to animate. The reason is that (I hope I can explain myself well enough) when the animator changes the current time and goes over a keyframe that makes the switch, Maya sees it as a "-attributeChange" , it will launch the IKFK_Snap script and that will cause the alignment between the controller making the whole thing pretty weird and not working properly.

My question is.... is there a way to tell the scriptJob the difference between USER changing the value and value changed just because I am changing the time?

Please I need help with this. If you don't understand what I am trying to eaplain let me know so I will try and explain it better.

Thank you very much

03 March 2006, 07:28 PM
Right now I kind of solved the problem by just creating a button that switches from IK to FK and viceversa, and takes care of the alignment of the controls. However I would also be interested in finding out a way to use scriptJob to do that.


03 March 2006, 04:50 AM
not too sure about this, but isn't there a "playback" conditon in the scriptjob command itself? I think I read about it in the help files. So you could check the state of the playback, and if true, run your script from the scriptjob.

03 March 2006, 07:36 PM
I noticed there are options to control the time change or the playback in the scriptJob, but I can't seem to find the right syntax to do that.

02 February 2007, 05:00 AM
Just wondering if a solution was ever found for this. I'm having the exact same problem.

CGTalk Moderation
02 February 2007, 05:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.