There are 3 parts. 1) covers the basic idea and some rudimentary vector math 2) covers the python scipting of those concepts in Maya and 3) introduces "message attributes" which are nifty little attrs that can be really useful to bump up functionality of your rigs/scripts.
Maya/Rigging: IK to FK snapping, part 1 from zeth willie on Vimeo.
Maya/Rigging: IK to FK snapping, part 2 from zeth willie on Vimeo.
Maya/Rigging: IK to FK snapping, part 3 from zeth willie on Vimeo.
Oh, yeah. Here is the code for the basic version of the IK/FK script in python (the script using the message attrs will depend on your specific attr names):
import maya.cmds as cmds import maya.OpenMaya as om #select the joints we need sel = cmds.ls(sl=True) #assign selection fkWrist = sel fkShldr = sel fkElbow = sel ikWrist = sel ikPv = sel #get positions from fk fkwRaw = cmds.xform(fkwrist, ws=True, q=True, t=True) fkwPos = om.MVector(fkwRaw, fkwRaw, fkwRaw) fkeRaw = cmds.xform(fkelbow, ws=True, q=True, t=True) fkePos = om.MVector(fkeRaw, fkeRaw, fkeRaw) fksRaw = cmds.xform(fkshldr, ws=True, q=True, t=True) fksPos = om.MVector(fksRaw, fksRaw, fksRaw) #set position of IK wrist ctrl cmds.move(fkwPos.x, fkwPos.y, fkwPos.z, ikwrist) #start figuring out pole vector pos #find avg (midpoint) of shoulder and wrist midpoint = (fkwPos + fksPos) / 2 #find pv direction pvOrigin = fkePos - midpoint #extend that length pvRaw = pvOrigin * 2 #position pvRaw at midpoint pvPos = pvRaw + midpoint #stick pole vector at pvPos cmds.move(pvPos.x, pvPos.y, pvPos.z, ikpv)
Once I get the little things hammered out in the zbw_messageMapper script that I showed in the video, I'll post that up too. . .
EDIT: One more thing! Here's the link to Ryan Trowbridge's site. http://www.rtrowbridge.com/blog/ Not sure how to access individual posts, but the post from March 09 has the video of the MasterClass on Vector Math in Maya. Good stuff. Also just bought his book on Python for Games and Film. Can't wait to read it!