0 Volts -Maya gallery
Please Register to View Free Download Links
And Unwanted Ads

Join the forum, it's quick and easy

0 Volts -Maya gallery
Please Register to View Free Download Links
And Unwanted Ads
0 Volts -Maya gallery
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Clicksor

FK control Setup.py

Go down

FK control Setup.py Empty FK control Setup.py

Post  Anoop K Fri Apr 27, 2012 3:15 pm

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

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum