Clicksor
FK control Setup.py
Page 1 of 1
FK control Setup.py
- Code:
#
# script : FK control Setup
# usage : import fkCtrl
# author : ANOOP AUGUSTINE
# e-mail : [You must be registered and logged in to see this link.]
# M date : 3-12-10
#################################
### Usage Tip ###
# select the joint hierarchy of all FK joint set in the scence
# with the present selection "import fkCtrl"
import maya.cmds as mc
def fkCtrl():
cj =mc.ls(sl=1,typ='joint')
ctrls,ctrl_G=[],[]
# main "for" Loop
for i in range(len(cj)):
#repalcing the control name
name = 'Ctrl_'+(cj[i].replace('_CJ',''))
# Creating circle Controls
circ = mc.circle(n=name,r=0.5)
mc.DeleteHistory(circ)
ctrls.append(circ[0])
# Grouping controls
ctrl_G.append(mc.group(ctrls[i],n=name+'_G'))
Pconst = mc.parentConstraint(cj[i],name+'_G',mo=0)#position ctrls to joints
mc.delete(Pconst)
# control rotate Position
mc.setAttr(name+'.ry',90)
mc.makeIdentity (name,apply =1,r =1,n= 0)
# finding the child joints and controls for Constraint
if mc.listRelatives(cj[i],c=1,typ='joint'):
if mc.listRelatives(cj[i],p=1,typ='joint'):
mc.parentConstraint(ctrls[i-1],ctrl_G[i],mo=1)
mc.parentConstraint(ctrls[i],cj[i],mo=0)
else : mc.delete(ctrl_G[i]) # deleting unwanted groups
fkCtrl()
[You must be registered and logged in to see this link.]
Anoop K- Posts : 9
Points : 36
Reputation : -1
Join date : 2011-12-08
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum