finger improvements

a while back i posted some python auto finger rig thing. turns out that was garbage! the good news is this one isn’t as much garbage! select the top most knuckle joint of a simple 3 joint finger (not including end joint) run this in your script editor and boom! auto curl, spread, and individual knuckle bends. works on mirrored joints too. i think. let me know if it doesn’t

import maya.cmds as cmds
hiSel =
selection = = True)
cmds.setAttr(selection[0]+'.jointOrientX', 0)
cmds.setAttr(selection[0]+'.jointOrientY', 0)
cmds.setAttr(selection[0]+'.jointOrientZ', 0)
topJointWS = cmds.xform(selection[0], q = True, ws = True, rp =True)
midJointWS = cmds.xform(selection[1], q = True, ws = True, rp =True)
btmJointWS = cmds.xform(selection[2], q = True, ws = True, rp =True)
topNull =[0], n = 'topNull')
midNull =[1], n = 'midNull')
btmNull =[2], n = 'btmNull')
cmds.move(topJointWS[0],topJointWS[1],topJointWS[2], topNull+'.rotatePivot', topNull+'.scalePivot')
cmds.move(midJointWS[0],midJointWS[1],midJointWS[2], midNull+'.rotatePivot', midNull+'.scalePivot')
cmds.move(btmJointWS[0],btmJointWS[1],btmJointWS[2], btmNull+'.rotatePivot', btmNull+'.scalePivot')
#add controller to top and give it bend attrs
myCtrlName = selection[0]+'_curl'
fingerCtrl = cmds.curve(d=1, p=[(0,0,0),(0,1.5,0),(0,2,-0.5),(0,2.5,0),(0,2,0.5),(0,1.5,0)], k=[1,2,3,4,5,6], n = myCtrlName)
cmds.parent(fingerCtrl, selection[0], relative = True)
cmds.parent(fingerCtrl, w = True)
#lock and hide attrs
cmds.setAttr(fingerCtrl+'.translate', lock=True, k = False, cb= False)
cmds.setAttr(fingerCtrl+'.scale', lock=True, k = False, cb= False)
cmds.addAttr(fingerCtrl, at='float', ln='topBend', k = True)
cmds.addAttr(fingerCtrl, at='float', ln='midBend', k = True)
cmds.addAttr(fingerCtrl, at='float', ln='bottomBend', k = True)

#connect bend attrs to the joints
cmds.connectAttr(fingerCtrl+’.topBend’, selection[0]+’.rz’)
cmds.connectAttr(fingerCtrl+’.midBend’, selection[1]+’.rz’)
cmds.connectAttr(fingerCtrl+’.bottomBend’, selection[2]+’.rz’)
cmds.connectAttr(fingerCtrl+’.ry’, selection[0]+’.ry’)
#make SDKs on the nulls for the curl