from ctrlUI_lib import createClav2, createSphere
import maya.cmds as cmds
import maya.OpenMaya as om
from functools import partial

def duplicateChain(*args):
    
    global ogChain
    global chainLen
    global switcherLoc
    global side
    global controllerColor
    global clavCheckbox
    global rigGrp, ctrlGrp
    
    ogRootchain = cmds.ls(sl = True, type = "joint")[0]        
    ogChain = cmds.listRelatives(ogRootchain, ad = True, type = "joint")
    ogChain.append(ogRootchain)
    ogChain.reverse()
    side = ogRootchain[0:2]

    # Initialize input from UI
    scaleController = cmds.intField(scaleField_UI, q=1, v=1)
    blendCheckbox = cmds.checkBox(blendCheckbox_UI, q=1, v=1) 
    constraintCheckBox = cmds.checkBox(constraintCheckBox_UI, q=1, v=1) 
    
    chainMenu = cmds.optionMenu("chainMenu_UI", q=1, v=1)

    clavCheckbox = cmds.checkBox(clavCheckbox_UI, q=1, v=0)

    if side == "l_": controllerColor = rgb=(0, 0, 255)
    elif side == "r_": controllerColor = rgb=(255, 0, 0)

    if chainMenu == "Leg": chainLen = 5
    else: #this is totally unscalable but for now it's ok
        chainLen = 3

    #suffix for the new chains
    newJointList = ["_ik", "_fk", "_scale"]
    for newJoint in newJointList:
        for i in range(chainLen):
            
            if blendCheckbox == 0 and constraintCheckBox == 0:
                cmds.error("pls, select one relation type")
                break

            newJointName = ogChain[i] + newJoint

            #create a joint, copy their position and freeze transform
            cmds.joint(n = newJointName)
            cmds.matchTransform(newJointName, ogChain[i])
            cmds.makeIdentity(newJointName, a = 1, t = 0, r = 1, s = 0)
        
        #deselect to make the two different hierarchies
        cmds.select(cl = 1)

    cmds.parent((ogChain[0] + "_ik"), world = True)
    cmds.setAttr(ogChain[0] + "_ik.visibility", 0)
    cmds.setAttr(ogChain[0] + "_fk.visibility", 0)

    # Create a locator used for switching IK/FK mode and snap it between two joints
    switcherLoc = cmds.spaceLocator(n=side + chainMenu + "_ikfk_Switch")
    switcherLocGrp = cmds.group(em=1, n=switcherLoc[0] + "_grp")
    cmds.color(switcherLoc, rgb=(255, 255, 0)) #yellow
    cmds.delete(cmds.pointConstraint(switcherLoc, switcherLocGrp))
    cmds.parent(switcherLoc, switcherLocGrp)
    cmds.delete(cmds.pointConstraint(ogChain[1], ogChain[2], switcherLocGrp))
    cmds.addAttr(switcherLoc, ln="FKIK_Mode", at="short", min=0, max=1, k=1, r=1)
    cmds.move(0,0,-12, switcherLocGrp, r=1) #IMPROVE THIS SHIT
    cmds.parentConstraint(ogChain[1], switcherLocGrp, mo=1)
    
    #remove .t, .r, .s and .v from the channelbox
    for coord in ["X", "Y", "Z"]:
        cmds.setAttr(switcherLoc[0] + ".translate" + coord, k=0, l=1)
        cmds.setAttr(switcherLoc[0] + ".rotate" + coord, k=0, l=1)
        cmds.setAttr(switcherLoc[0] + ".scale" + coord, k=0, l=1)
    cmds.setAttr(switcherLoc[0] + ".visibility", k=0, l=1)
    
    # Create hierarchy groups
    rigGrp = cmds.group(em=1, n= side + chainMenu + "_rig_grp")
    ctrlGrp = cmds.group(em=1, n= side + chainMenu + "_ctrl_grp")

    cmds.delete(cmds.parentConstraint(ogChain[0], rigGrp))
    cmds.delete(cmds.parentConstraint(ogChain[0], ctrlGrp))
    cmds.parent(ctrlGrp, rigGrp)

    # Execute
    if blendCheckbox == 1:
        blendNodeFunc(scaleController, chainMenu)
    
    if constraintCheckBox == 1:
        constraintFunc(scaleController, chainMenu)

    if clavCheckbox == 1:
        clavSel(scaleController)
    else:
        cmds.parent(ogChain[0] + "_ik", ogChain[0] + "_fk", ctrlGrp)
        cmds.parent(ogChain[0] + "_fk_anim_grp", ctrlGrp)
        cmds.parent(switcherLocGrp, rigGrp)
    

def clavSel(scaleClav):

    # Select clavicle Joint moving up and put it at the top of the chain
    clavJoint = cmds.pickWalk(ogChain[0], d="up")[0]
    #ogChain.insert(0, clavJoint)

    clavController = createClav2(clavJoint + "_anim") # Import coordinates from ctrlUI_lib
    cmds.delete(cmds.pointConstraint(clavJoint, clavController))

    # Create offset group, FDH and move up 
    clavControllerGrp = cmds.group(n=clavController + "_grp", em=1)
    cmds.delete(cmds.parentConstraint(clavJoint, clavControllerGrp))
    cmds.parent(clavController, clavControllerGrp)
    fixedScale = scaleClav/4
    cmds.scale(fixedScale, fixedScale, fixedScale, clavController)
    cmds.makeIdentity(clavController, a=1)
    cmds.move(0,10,0, clavControllerGrp, ws=1, r=1)
    cmds.color(clavController, rgb=controllerColor)
    
    # Move pivots on clavicle joint
    piv = cmds.xform(clavJoint, q=True, ws=True, t=True)
    cmds.xform(clavController, ws=True, piv=piv)
    cmds.xform(clavControllerGrp, ws=True, piv=piv)
    
    cmds.orientConstraint(clavController, clavJoint)

    # Parent ik and fk chain under clavicle controller    
    cmds.parent((ogChain[0]+"_fk_anim_grp"),(ogChain[0] + "_ik"), (ogChain[0] + "_fk"), clavController)

    cmds.parent(clavControllerGrp, ctrlGrp)


def visCheck(vis):
    if vis == "Arm":
        asd = True
    if vis == "Leg":
        asd = False
    cmds.checkBox(clavCheckbox_UI, e=1, vis=asd, v=asd)

# Buttons +1 and +3
count = 0

def addOneUnit(*args):
    global count
    count = count + 1
    cmds.intField(scaleField_UI, v=1+count, e=1)


def addThreeUnit(*args):
    global count
    count = count + 3
    cmds.intField(scaleField_UI, v=1+count, e=1)


def blendNodeFunc(scaleController, selectChain):

    # Create some blendColors node with the same name of the joint
    for x in range(chainLen):

        blendColorsNode = cmds.createNode("blendColors", n = ogChain[x] + "_blend")

        # Connect FK and IK chains into blendColors channels and then connect the output to the original joint chain
        cmds.connectAttr((ogChain[x] + "_ik.rotate"), blendColorsNode + ".color1")
        cmds.connectAttr((ogChain[x] + "_fk.rotate"), blendColorsNode + ".color2")
        cmds.connectAttr((blendColorsNode + ".output"), (ogChain[x] + ".rotate" ))
        cmds.connectAttr(switcherLoc[0]+".FKIK_Mode", blendColorsNode + ".blender")

    ikChainBuild(scaleController, selectChain)
    fkControllerCreator(scaleController, selectChain)


def constraintFunc(scaleController, selectChain):

    # Create some blendColors node with the same name of the joint
    for x in range(chainLen):
        
        # Setup orient constraints        
        cmds.parentConstraint((ogChain[x] + "_ik"), ogChain[x])
        cmds.parentConstraint((ogChain[x] + "_fk"), ogChain[x])

        # Setup SDK naming convention
        sdkDriver = switcherLoc[0] + ".FKIK_Mode"
        ikSdkDriven = ogChain[x] + "_parentConstraint1." + ogChain[x] + "_ikW0"
        fkSdkDriven = ogChain[x] + "_parentConstraint1." + ogChain[x] + "_fkW1"

        # Setup SDK
        cmds.setAttr(sdkDriver, 0)
        cmds.setDrivenKeyframe(ikSdkDriven, cd=sdkDriver, v=0, dv=0)
        cmds.setDrivenKeyframe(fkSdkDriven, cd=sdkDriver, v=1, dv=0)

        cmds.setAttr(sdkDriver, 1)
        cmds.setDrivenKeyframe(ikSdkDriven, cd=sdkDriver, v=1, dv=1)
        cmds.setDrivenKeyframe(fkSdkDriven, cd=sdkDriver, v=0, dv=1)

    
    ikChainBuild(scaleController, selectChain)
    fkControllerCreator(scaleController, selectChain)
    

def fkControllerCreator(fkSize, legOrArm):
    
    orientController = cmds.optionMenu("UI_orientControllerMenu", q=1, v=1)

    # Create controllers and group offsets
    # Change rotation, color
    for y in range(chainLen):
        anim_group = cmds.group(em=1, n=ogChain[y] + "_fk_anim_grp")
        fk_controller = cmds.circle(n=ogChain[y] + "_fk_anim")[0] # If not [0] it'll warn some stuff related to Maya underworld

        # Set scale 
        cmds.scale(fkSize, fkSize, fkSize, fk_controller)
            
        cmds.matchTransform(anim_group, ogChain[y])
        cmds.delete(cmds.parentConstraint(ogChain[y], fk_controller))
        cmds.parent(fk_controller, anim_group)

        # Set controller orientation based on second axis 
        if orientController == "x": cmds.rotate(90,0,0, fk_controller)
        if orientController == "y": cmds.rotate(0,90,0, fk_controller)
        if orientController == "z": cmds.rotate(0,0,90, fk_controller)
        
        # Freeze transform, delete history and set color
        cmds.makeIdentity(fk_controller, a = 1, t = 1, r = 1, s = 0)
        cmds.delete(fk_controller, ch = 1)
        cmds.color(fk_controller, rgb=controllerColor)
        
        # Set SDK visibility
        sdkDriver = switcherLoc[0] + ".FKIK_Mode"
        cmds.setAttr(sdkDriver, 1)
        cmds.setDrivenKeyframe(ogChain[0] + "_fk_anim_grp.visibility", cd=sdkDriver, v=1, dv=0)
        cmds.setAttr(sdkDriver, 0)
        cmds.setDrivenKeyframe(ogChain[0] + "_fk_anim_grp.visibility", cd=sdkDriver, v=0, dv=1)

        # Lock .t and .s attributes
        #for x in ["X", "Y", "Z"]:
            #cmds.setAttr(fk_controller + ".translate" + x, k=0, l=1)
            #cmds.setAttr(fk_controller + ".scale" + x, k=0, l=1)

    # Create ordered hierarchy
    for x in reversed(range(chainLen)):
        if x == 0:
            continue
        cmds.parent(ogChain[x] + "_fk_anim_grp", ogChain[x-1] + "_fk_anim")

    # Set orientConstraint _anim controllers with _fk hierarchy
    for x in range(chainLen):
        cmds.parentConstraint(ogChain[x] + "_fk_anim", ogChain[x] + "_fk")
        # If leg chain is selected delete toe controller, else not
        if legOrArm == "Leg":
            if x == (chainLen-1):
                cmds.delete(ogChain[chainLen-1] + "_fk_anim_grp")


def ikChainBuild(scaleIK, HandleName):
    
    masterIkHandle = cmds.ikHandle(sj=ogChain[0] + "_ik", ee=ogChain[2] + "_ik", sol="ikRPsolver", n=side + HandleName + "_ikHandle")
    cmds.setAttr(masterIkHandle[0] + ".visibility", 0)
    
    if HandleName == "Arm": 
        #print ("scaleController", scaleField_UI)
        armIk(scaleIK, masterIkHandle, HandleName)
    else:   
        #print ("scaleController", scaleField_UI)
        legIK(scaleIK, masterIkHandle, HandleName)


def armIk(armIkScale, armikHandle, pvName):

    ikHandJoint = cmds.joint(n=side + "hand_ik")
    cmds.delete(cmds.parentConstraint(ogChain[2] + "_ik", ikHandJoint))
    cmds.makeIdentity(ikHandJoint, a = 1, t = 1, r = 1, s = 0)
    if side == "l_":
        cmds.move(10,0,0, ikHandJoint, r=1, os=1)
    else:
        cmds.move(-10,0,0, ikHandJoint, r=1, os=1)
    cmds.parent(ikHandJoint, ogChain[2] + "_ik")
    handikHandle = cmds.ikHandle(sj=ogChain[2] + "_ik", ee=ikHandJoint, n=side + "hand_ikHandle", sol="ikSCsolver")
    cmds.parent(handikHandle[0], armikHandle[0])
    
    #create IK controller ---> CUBE
    crvIkCube = cmds.curve(d=1, p=[(-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, 0.5, 0.5),
                                    (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5), (-0.5, -0.5, -0.5),
                                    (-0.5, 0.5, -0.5), (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5),
                                    (0.5, -0.5, 0.5), (0.5, 0.5, 0.5), (0.5, 0.5, -0.5),
                                    (0.5, -0.5, -0.5), (0.5, -0.5, 0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5)], 
                                    k=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5], n=side + "hand_ik_anim" )

    # Rename shape node                 
    shapeList = cmds.listRelatives(crvIkCube, s = True)
    cmds.rename(shapeList, crvIkCube + "Shape")
    
    crvIkCubeGrp = cmds.group(n=crvIkCube + "_grp")
    cmds.delete(cmds.parentConstraint(ogChain[2] + "_ik", crvIkCubeGrp))

    cmds.color(crvIkCube, rgb=controllerColor)
    cmds.scale(armIkScale, armIkScale, armIkScale, crvIkCubeGrp)

    cmds.parent(armikHandle[0], crvIkCube)

    pvController = createSphere(nome= side+pvName+"_PV")

    findPoleVector(loc=pvController, targetHandle=armikHandle[0])

    cmds.addAttr(pvController, at="enum", enumName = "------", ln="Attributes", k=1, r=1)
    cmds.addAttr(pvController, ln="Follow", k=1, r=1, min=0, max=1)
    cmds.addAttr(pvController, ln="Follow_Clav_Hand", k=1, r=1, min=0, max=1, dv=0.5)

    # Parent ikController and PV under _rig_GRP
    cmds.parent(crvIkCubeGrp, pvController + "_grp" ,rigGrp)
    
    #set SDK visibility
    sdkDriver = switcherLoc[0] + ".FKIK_Mode"
    cmds.setAttr(sdkDriver, 0)
    cmds.setDrivenKeyframe(crvIkCubeGrp + ".visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setAttr(sdkDriver, 1)
    cmds.setDrivenKeyframe(crvIkCubeGrp + ".visibility", cd=sdkDriver, v=1, dv=1)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=1, dv=1)

def legIK(ikFootScale, legikHandle, pvName):

    ballikHandle = cmds.ikHandle(sj=ogChain[2] + "_ik", ee=ogChain[3] + "_ik", sol="ikSCsolver", n=side + "ball_ikHandle")
    toeikHandle = cmds.ikHandle(sj=ogChain[3] + "_ik", ee=ogChain[4] + "_ik", sol="ikSCsolver", n=side + "toe_ikHandle")
    
    # Create and place ik controller
    ikFootControl = cmds.curve(d=2, p=[(0.997, 0, 1.789), (0, 0, 2.39), (-0.997,0,1.789), (-1.108, 0, 0), (-0.784, 0,-2.5),
              (0, 0,-3), (0.784, 0, -2.5), (1.108, 0, 0), (0.997, 0, 1.789), (0, 0, 2.39)],
              k=[0,1,2,3,4,5,6,7,8,9,10], n=side + "leg_anim_ik")

    # Rename shape node
    shapeList = cmds.listRelatives(ikFootControl, s = True)
    cmds.rename(shapeList, ikFootControl + "Shape")
              
    ikFootControlGrp = cmds.group(em=1, n=ikFootControl + "_grp")
    cmds.parent(ikFootControl, ikFootControlGrp)
    
    # Set size, freeze transform, create offset group and color
    cmds.scale(ikFootScale, ikFootScale, ikFootScale, ikFootControlGrp)  
    cmds.move(0,-3.2,0, ikFootControl, r=1)
    cmds.makeIdentity(ikFootControl, a = 1, t = 1, r = 1, s = 1)
    cmds.delete(ikFootControl, ch = 1)
    cmds.delete(cmds.pointConstraint(ogChain[3] + "_ik", ikFootControlGrp))
    cmds.color(ikFootControl, rgb=controllerColor) 
    
    # pivot snapping on ankle joint
    piv = cmds.xform(ogChain[2], q=True, ws=True, t=True)
    cmds.xform(ikFootControl, ws=True, piv=piv)

    cmds.parent(ballikHandle[0], toeikHandle[0], legikHandle[0], ikFootControl)
    
    #---------- Making Pole Vector -------------#
    # Pole Vector controller ---> Sphere
    pvController = createSphere(nome= side+pvName+"_PV")

    findPoleVector(loc=pvController, targetHandle=legikHandle[0])

    cmds.addAttr(pvController, ln="Follow", k=1, r=1, min=0, max=1)
    cmds.addAttr(pvController, ln="Follow_Leg_Foot", k=1, r=1, min=0, max=1, dv=0.5)
    
    # Create attributes on ikController
    cmds.addAttr(ikFootControl, at="enum",enumName = "------", ln="Attributes", k=1, r=1)
    cmds.addAttr(ikFootControl, ln="Twist", k=1, r=1)
    cmds.addAttr(ikFootControl, ln="Lateral_Roll", k=1, r=1)
    for bone in ["Ankle", "Ball", "Toe_Tap"]:
        cmds.addAttr(ikFootControl, at="enum", enumName = "------", ln=bone, k=1, r=1)
        for coord in ["X", "Y", "Z"]:
            cmds.addAttr(ikFootControl, ln=bone+coord, k=1, r=1)

    # Parent ikController and PV under _rig_GRP
    cmds.parent(ikFootControlGrp, pvController + "_grp" ,rigGrp)
    
    # Set SDK visibility
    sdkDriver = switcherLoc[0] + ".FKIK_Mode"
    cmds.setAttr(sdkDriver, 0)
    cmds.setDrivenKeyframe(ikFootControlGrp + ".visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setAttr(sdkDriver, 1)
    cmds.setDrivenKeyframe(ikFootControlGrp + ".visibility", cd=sdkDriver, v=1, dv=1)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=1, dv=1)
    
def findPoleVector(loc, targetHandle):

    # This func is kinda black magic
    # All credits to https://vimeo.com/66015036
    start = cmds.xform(ogChain[0], q=1, ws=1, t=1)
    mid = cmds.xform(ogChain[1], q=1, ws=1, t=1)
    end = cmds.xform(ogChain[2], q=1, ws=1, t=1)

    startV = om.MVector(start[0], start[1], start[2])
    midV = om.MVector(mid[0], mid[1], mid[2])
    endV = om.MVector(end[0], end[1], end[2])

    startEnd = endV - startV
    startMid = midV - startV

    dotP = startMid * startEnd
    proj = float(dotP) / float(startEnd.length())
    startEndN = startEnd.normal()
    projV = startEndN * proj

    arrowV = startMid - projV
    arrowV*= 10 #distance from joint
    finalV = arrowV + midV
    
    cmds.xform(loc, ws=1, t=(finalV.x, finalV.y ,finalV.z))

    locGrp = cmds.group(em=1, n=loc + "_grp")

    #snap, parent offsetGrp, set color and then make Constraint
    cmds.delete(cmds.pointConstraint(loc, locGrp))
    cmds.parent(loc, locGrp)
    cmds.makeIdentity(loc, a=1, t=1, r=1, s=1)
    cmds.color(loc, rgb=controllerColor)

    cmds.poleVectorConstraint(loc, targetHandle)


def showUI():
    
    global chainMenu_UI
    global scaleField_UI
    global orientControllerMenu
    global constraintCheckBox_UI
    global blendCheckbox_UI
    global plusOne_UI
    global plusThree_UI
    global clavCheckbox_UI
    
    if cmds.window("switchModeUI", ex = 1): cmds.deleteUI("switchModeUI")
    myWin = cmds.window("switchModeUI", t="IKFK Builder", w=300, h=300, s=1)
    mainLayout = cmds.formLayout(nd=50)
    
    # Useful in selecting which chain: Leg or Arm? 
    chainMenu_UI = cmds.optionMenu("chainMenu_UI", l="Which chain?", cc=visCheck)
    cmds.menuItem(l="Leg")
    cmds.menuItem(l="Arm")

    constraintCheckBox_UI = cmds.checkBox(label = "orientConsts+SDK Mode", v=0, 
                                          cc= lambda state: (cmds.checkBox(blendCheckbox_UI, e=1, en=state-1)))
    blendCheckbox_UI = cmds.checkBox(label = "blendColor Mode", v=0, 
                                     cc= lambda state: (cmds.checkBox(constraintCheckBox_UI, e=1, en=state-1)))

    clavCheckbox_UI = cmds.checkBox(l="Clavicle", vis=0)

    # Useful in orienting FK controllers as the user wishes. Maybe this can be improved
    orientControllerMenu = cmds.optionMenu("UI_orientControllerMenu", l="What's the secondary axis")
    cmds.menuItem(l="x")
    cmds.menuItem(l="y")
    cmds.menuItem(l="z")

    # Scale the UI becase you'll never know
    scaleControllerText = cmds.text(l="Controllers size")
    scaleField_UI = cmds.intField(en=10, v=1, min=1)

    plusOne_UI = cmds.button(l="+1", c=addOneUnit)
    plusThree_UI = cmds.button(l="+3", c=addThreeUnit)
    
    separator01 = cmds.separator(h=5)
    separator02 = cmds.separator(h=5)

    #
    execButton = cmds.button(l="Duplicate Chain", c=partial(duplicateChain, blendNodeFunc, constraintFunc))

    cmds.formLayout(mainLayout, e=1,
                    attachForm = [
                        (chainMenu_UI, "left", 8), (chainMenu_UI, "top", 5), (chainMenu_UI, "right", 80),
                        (clavCheckbox_UI, "top", 7),
                        (blendCheckbox_UI, "left", 5),
                        (separator01, "left", 1), (separator01, "right", 2),
                        #--------------------
                        
                        (scaleField_UI, "right", 65), (scaleField_UI, "left", 5),
                        (plusOne_UI, "right", 5), 
                        (plusThree_UI, "right", 5),
                        (scaleControllerText, "left", 5),
                        (separator02, "left", 1), (separator02, "right", 2),
                        #--------------------
                        
                        (orientControllerMenu, "left", 8), (orientControllerMenu, "top", 5),
                        #--------------------
                        
                        (execButton, "bottom", 5), (execButton, "left", 5), (execButton, "right", 5),
                    ],
                    attachControl = [(clavCheckbox_UI, "left", 10, chainMenu_UI),
                                     (constraintCheckBox_UI, "top", 5, chainMenu_UI),
                                     (blendCheckbox_UI, "top", 5, chainMenu_UI),
                                     (separator01, "top", 5, constraintCheckBox_UI),
                                     (scaleField_UI, "top", 5, separator01),
                                     (scaleControllerText, "top", 8, separator01),
                                     (plusOne_UI, "top", 4, separator01),
                                     (plusThree_UI, "top", 4, separator01),
                                     (separator02, "top", 6, scaleField_UI),
                                     (orientControllerMenu, "top", 6, separator02),
                    
                    ],
                    
                    attachPosition = [#(clavCheckbox_UI, "right", 0, 10),
                                      (constraintCheckBox_UI, "left", 0, 26), (blendCheckbox_UI, "right", 10, 24),
                                      (scaleControllerText, "left", 5, 0), (scaleField_UI, "left", 110, 0), #(scaleField_UI, "right",0, 40),
                                      (plusOne_UI, "right", 0, 45),
                                      (plusThree_UI, "right", 0, 49)
                    ]
    
    
    )
    
    cmds.showWindow(myWin)
    
showUI()
[((17, 14, 17, 72), 'maya.cmds.listRelatives', 'cmds.listRelatives', (), '', True, 'import maya.cmds as cmds\n'), ((23, 22, 23, 60), 'maya.cmds.intField', 'cmds.intField', (), '', True, 'import maya.cmds as cmds\n'), ((24, 20, 24, 61), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((25, 25, 25, 71), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((27, 16, 27, 57), 'maya.cmds.optionMenu', 'cmds.optionMenu', (), '', True, 'import maya.cmds as cmds\n'), ((29, 19, 29, 59), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((57, 4, 57, 51), 'maya.cmds.parent', 'cmds.parent', (), '', True, 'import maya.cmds as cmds\n'), ((58, 4, 58, 50), 'maya.cmds.setAttr', 'cmds.setAttr', ({(58, 17, 58, 46): "(ogChain[0] + '_ik.visibility')", (58, 48, 58, 49): '(0)'}, {}), "(ogChain[0] + '_ik.visibility', 0)", True, 'import maya.cmds as cmds\n'), ((59, 4, 59, 50), 'maya.cmds.setAttr', 'cmds.setAttr', ({(59, 17, 59, 46): "(ogChain[0] + '_fk.visibility')", (59, 48, 59, 49): '(0)'}, {}), "(ogChain[0] + '_fk.visibility', 0)", True, 'import maya.cmds as cmds\n'), ((62, 18, 62, 72), 'maya.cmds.spaceLocator', 'cmds.spaceLocator', (), '', True, 'import maya.cmds as cmds\n'), ((63, 21, 63, 64), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((64, 4, 64, 46), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((66, 4, 66, 44), 'maya.cmds.parent', 'cmds.parent', ({(66, 16, 66, 27): 'switcherLoc', (66, 29, 66, 43): 'switcherLocGrp'}, {}), '(switcherLoc, switcherLocGrp)', True, 'import maya.cmds as cmds\n'), ((68, 4, 68, 81), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((69, 4, 69, 43), 'maya.cmds.move', 'cmds.move', (), '', True, 'import maya.cmds as cmds\n'), ((70, 4, 70, 59), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', (), '', True, 'import maya.cmds as cmds\n'), ((77, 4, 77, 58), 'maya.cmds.setAttr', 'cmds.setAttr', (), '', True, 'import maya.cmds as cmds\n'), ((80, 13, 80, 63), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((81, 14, 81, 65), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((85, 4, 85, 32), 'maya.cmds.parent', 'cmds.parent', ({(85, 16, 85, 23): 'ctrlGrp', (85, 25, 85, 31): 'rigGrp'}, {}), '(ctrlGrp, rigGrp)', True, 'import maya.cmds as cmds\n'), ((108, 21, 108, 53), 'ctrlUI_lib.createClav2', 'createClav2', ({(108, 33, 108, 52): "clavJoint + '_anim'"}, {}), "(clavJoint + '_anim')", False, 'from ctrlUI_lib import createClav2, createSphere\n'), ((112, 24, 112, 67), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((114, 4, 114, 50), 'maya.cmds.parent', 'cmds.parent', ({(114, 16, 114, 30): 'clavController', (114, 32, 114, 49): 'clavControllerGrp'}, {}), '(clavController, clavControllerGrp)', True, 'import maya.cmds as cmds\n'), ((116, 4, 116, 66), 'maya.cmds.scale', 'cmds.scale', ({(116, 15, 116, 25): 'fixedScale', (116, 27, 116, 37): 'fixedScale', (116, 39, 116, 49): 'fixedScale', (116, 51, 116, 65): 'clavController'}, {}), '(fixedScale, fixedScale, fixedScale, clavController)', True, 'import maya.cmds as cmds\n'), ((117, 4, 117, 42), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((118, 4, 118, 51), 'maya.cmds.move', 'cmds.move', (), '', True, 'import maya.cmds as cmds\n'), ((119, 4, 119, 51), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((122, 10, 122, 56), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((123, 4, 123, 48), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((124, 4, 124, 51), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((126, 4, 126, 52), 'maya.cmds.orientConstraint', 'cmds.orientConstraint', ({(126, 26, 126, 40): 'clavController', (126, 42, 126, 51): 'clavJoint'}, {}), '(clavController, clavJoint)', True, 'import maya.cmds as cmds\n'), ((129, 4, 129, 103), 'maya.cmds.parent', 'cmds.parent', ({(129, 17, 129, 42): "(ogChain[0] + '_fk_anim_grp')", (129, 45, 129, 63): "(ogChain[0] + '_ik')", (129, 67, 129, 85): "(ogChain[0] + '_fk')", (129, 88, 129, 102): 'clavController'}, {}), "(ogChain[0] + '_fk_anim_grp', ogChain[0] + '_ik', ogChain[0] +\n    '_fk', clavController)", True, 'import maya.cmds as cmds\n'), ((131, 4, 131, 43), 'maya.cmds.parent', 'cmds.parent', ({(131, 16, 131, 33): 'clavControllerGrp', (131, 35, 131, 42): 'ctrlGrp'}, {}), '(clavControllerGrp, ctrlGrp)', True, 'import maya.cmds as cmds\n'), ((139, 4, 139, 55), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((147, 4, 147, 48), 'maya.cmds.intField', 'cmds.intField', (), '', True, 'import maya.cmds as cmds\n'), ((153, 4, 153, 48), 'maya.cmds.intField', 'cmds.intField', (), '', True, 'import maya.cmds as cmds\n'), ((203, 23, 203, 75), 'maya.cmds.optionMenu', 'cmds.optionMenu', (), '', True, 'import maya.cmds as cmds\n'), ((257, 21, 257, 133), 'maya.cmds.ikHandle', 'cmds.ikHandle', (), '', True, 'import maya.cmds as cmds\n'), ((258, 4, 258, 54), 'maya.cmds.setAttr', 'cmds.setAttr', ({(258, 17, 258, 50): "(masterIkHandle[0] + '.visibility')", (258, 52, 258, 53): '(0)'}, {}), "(masterIkHandle[0] + '.visibility', 0)", True, 'import maya.cmds as cmds\n'), ((270, 18, 270, 48), 'maya.cmds.joint', 'cmds.joint', (), '', True, 'import maya.cmds as cmds\n'), ((272, 4, 272, 62), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((277, 4, 277, 48), 'maya.cmds.parent', 'cmds.parent', ({(277, 16, 277, 27): 'ikHandJoint', (277, 29, 277, 47): "(ogChain[2] + '_ik')"}, {}), "(ikHandJoint, ogChain[2] + '_ik')", True, 'import maya.cmds as cmds\n'), ((278, 19, 278, 115), 'maya.cmds.ikHandle', 'cmds.ikHandle', (), '', True, 'import maya.cmds as cmds\n'), ((279, 4, 279, 48), 'maya.cmds.parent', 'cmds.parent', ({(279, 16, 279, 31): 'handikHandle[0]', (279, 33, 279, 47): 'armikHandle[0]'}, {}), '(handikHandle[0], armikHandle[0])', True, 'import maya.cmds as cmds\n'), ((282, 16, 287, 125), 'maya.cmds.curve', 'cmds.curve', (), '', True, 'import maya.cmds as cmds\n'), ((290, 16, 290, 55), 'maya.cmds.listRelatives', 'cmds.listRelatives', (), '', True, 'import maya.cmds as cmds\n'), ((291, 4, 291, 47), 'maya.cmds.rename', 'cmds.rename', ({(291, 16, 291, 25): 'shapeList', (291, 27, 291, 46): "(crvIkCube + 'Shape')"}, {}), "(shapeList, crvIkCube + 'Shape')", True, 'import maya.cmds as cmds\n'), ((293, 19, 293, 51), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((296, 4, 296, 46), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((297, 4, 297, 64), 'maya.cmds.scale', 'cmds.scale', ({(297, 15, 297, 25): 'armIkScale', (297, 27, 297, 37): 'armIkScale', (297, 39, 297, 49): 'armIkScale', (297, 51, 297, 63): 'crvIkCubeGrp'}, {}), '(armIkScale, armIkScale, armIkScale, crvIkCubeGrp)', True, 'import maya.cmds as cmds\n'), ((299, 4, 299, 42), 'maya.cmds.parent', 'cmds.parent', ({(299, 16, 299, 30): 'armikHandle[0]', (299, 32, 299, 41): 'crvIkCube'}, {}), '(armikHandle[0], crvIkCube)', True, 'import maya.cmds as cmds\n'), ((301, 19, 301, 56), 'ctrlUI_lib.createSphere', 'createSphere', (), '', False, 'from ctrlUI_lib import createClav2, createSphere\n'), ((305, 4, 305, 89), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((306, 4, 306, 67), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((307, 4, 307, 85), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((310, 4, 310, 60), 'maya.cmds.parent', 'cmds.parent', ({(310, 16, 310, 28): 'crvIkCubeGrp', (310, 30, 310, 51): "(pvController + '_grp')", (310, 53, 310, 59): 'rigGrp'}, {}), "(crvIkCubeGrp, pvController + '_grp', rigGrp)", True, 'import maya.cmds as cmds\n'), ((314, 4, 314, 30), 'maya.cmds.setAttr', 'cmds.setAttr', ({(314, 17, 314, 26): 'sdkDriver', (314, 28, 314, 29): '(0)'}, {}), '(sdkDriver, 0)', True, 'import maya.cmds as cmds\n'), ((315, 4, 315, 81), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((316, 4, 316, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((317, 4, 317, 30), 'maya.cmds.setAttr', 'cmds.setAttr', ({(317, 17, 317, 26): 'sdkDriver', (317, 28, 317, 29): '(1)'}, {}), '(sdkDriver, 1)', True, 'import maya.cmds as cmds\n'), ((318, 4, 318, 81), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((319, 4, 319, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((323, 19, 323, 122), 'maya.cmds.ikHandle', 'cmds.ikHandle', (), '', True, 'import maya.cmds as cmds\n'), ((324, 18, 324, 120), 'maya.cmds.ikHandle', 'cmds.ikHandle', (), '', True, 'import maya.cmds as cmds\n'), ((327, 20, 329, 65), 'maya.cmds.curve', 'cmds.curve', (), '', True, 'import maya.cmds as cmds\n'), ((332, 16, 332, 59), 'maya.cmds.listRelatives', 'cmds.listRelatives', (), '', True, 'import maya.cmds as cmds\n'), ((333, 4, 333, 51), 'maya.cmds.rename', 'cmds.rename', ({(333, 16, 333, 25): 'shapeList', (333, 27, 333, 50): "(ikFootControl + 'Shape')"}, {}), "(shapeList, ikFootControl + 'Shape')", True, 'import maya.cmds as cmds\n'), ((335, 23, 335, 65), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((336, 4, 336, 48), 'maya.cmds.parent', 'cmds.parent', ({(336, 16, 336, 29): 'ikFootControl', (336, 31, 336, 47): 'ikFootControlGrp'}, {}), '(ikFootControl, ikFootControlGrp)', True, 'import maya.cmds as cmds\n'), ((339, 4, 339, 71), 'maya.cmds.scale', 'cmds.scale', ({(339, 15, 339, 26): 'ikFootScale', (339, 28, 339, 39): 'ikFootScale', (339, 41, 339, 52): 'ikFootScale', (339, 54, 339, 70): 'ikFootControlGrp'}, {}), '(ikFootScale, ikFootScale, ikFootScale, ikFootControlGrp)', True, 'import maya.cmds as cmds\n'), ((340, 4, 340, 43), 'maya.cmds.move', 'cmds.move', (), '', True, 'import maya.cmds as cmds\n'), ((341, 4, 341, 64), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((342, 4, 342, 38), 'maya.cmds.delete', 'cmds.delete', (), '', True, 'import maya.cmds as cmds\n'), ((344, 4, 344, 50), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((347, 10, 347, 57), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((348, 4, 348, 47), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((350, 4, 350, 79), 'maya.cmds.parent', 'cmds.parent', ({(350, 16, 350, 31): 'ballikHandle[0]', (350, 33, 350, 47): 'toeikHandle[0]', (350, 49, 350, 63): 'legikHandle[0]', (350, 65, 350, 78): 'ikFootControl'}, {}), '(ballikHandle[0], toeikHandle[0], legikHandle[0], ikFootControl)', True, 'import maya.cmds as cmds\n'), ((354, 19, 354, 56), 'ctrlUI_lib.createSphere', 'createSphere', (), '', False, 'from ctrlUI_lib import createClav2, createSphere\n'), ((358, 4, 358, 67), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((359, 4, 359, 84), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((362, 4, 362, 89), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((363, 4, 363, 53), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((364, 4, 364, 60), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((371, 4, 371, 64), 'maya.cmds.parent', 'cmds.parent', ({(371, 16, 371, 32): 'ikFootControlGrp', (371, 34, 371, 55): "(pvController + '_grp')", (371, 57, 371, 63): 'rigGrp'}, {}), "(ikFootControlGrp, pvController + '_grp', rigGrp)", True, 'import maya.cmds as cmds\n'), ((375, 4, 375, 30), 'maya.cmds.setAttr', 'cmds.setAttr', ({(375, 17, 375, 26): 'sdkDriver', (375, 28, 375, 29): '(0)'}, {}), '(sdkDriver, 0)', True, 'import maya.cmds as cmds\n'), ((376, 4, 376, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((377, 4, 377, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((378, 4, 378, 30), 'maya.cmds.setAttr', 'cmds.setAttr', ({(378, 17, 378, 26): 'sdkDriver', (378, 28, 378, 29): '(1)'}, {}), '(sdkDriver, 1)', True, 'import maya.cmds as cmds\n'), ((379, 4, 379, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((380, 4, 380, 85), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((386, 12, 386, 50), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((387, 10, 387, 48), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((388, 10, 388, 48), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((390, 13, 390, 53), 'maya.OpenMaya.MVector', 'om.MVector', ({(390, 24, 390, 32): 'start[0]', (390, 34, 390, 42): 'start[1]', (390, 44, 390, 52): 'start[2]'}, {}), '(start[0], start[1], start[2])', True, 'import maya.OpenMaya as om\n'), ((391, 11, 391, 45), 'maya.OpenMaya.MVector', 'om.MVector', ({(391, 22, 391, 28): 'mid[0]', (391, 30, 391, 36): 'mid[1]', (391, 38, 391, 44): 'mid[2]'}, {}), '(mid[0], mid[1], mid[2])', True, 'import maya.OpenMaya as om\n'), ((392, 11, 392, 45), 'maya.OpenMaya.MVector', 'om.MVector', ({(392, 22, 392, 28): 'end[0]', (392, 30, 392, 36): 'end[1]', (392, 38, 392, 44): 'end[2]'}, {}), '(end[0], end[1], end[2])', True, 'import maya.OpenMaya as om\n'), ((406, 4, 406, 59), 'maya.cmds.xform', 'cmds.xform', (), '', True, 'import maya.cmds as cmds\n'), ((408, 13, 408, 45), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((412, 4, 412, 28), 'maya.cmds.parent', 'cmds.parent', ({(412, 16, 412, 19): 'loc', (412, 21, 412, 27): 'locGrp'}, {}), '(loc, locGrp)', True, 'import maya.cmds as cmds\n'), ((413, 4, 413, 46), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((414, 4, 414, 40), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((416, 4, 416, 48), 'maya.cmds.poleVectorConstraint', 'cmds.poleVectorConstraint', ({(416, 30, 416, 33): 'loc', (416, 35, 416, 47): 'targetHandle'}, {}), '(loc, targetHandle)', True, 'import maya.cmds as cmds\n'), ((430, 7, 430, 42), 'maya.cmds.window', 'cmds.window', (), '', True, 'import maya.cmds as cmds\n'), ((431, 12, 431, 76), 'maya.cmds.window', 'cmds.window', (), '', True, 'import maya.cmds as cmds\n'), ((432, 17, 432, 39), 'maya.cmds.formLayout', 'cmds.formLayout', (), '', True, 'import maya.cmds as cmds\n'), ((435, 19, 435, 81), 'maya.cmds.optionMenu', 'cmds.optionMenu', (), '', True, 'import maya.cmds as cmds\n'), ((436, 4, 436, 26), 'maya.cmds.menuItem', 'cmds.menuItem', (), '', True, 'import maya.cmds as cmds\n'), ((437, 4, 437, 26), 'maya.cmds.menuItem', 'cmds.menuItem', (), '', True, 'import maya.cmds as cmds\n'), ((444, 22, 444, 56), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((447, 27, 447, 100), 'maya.cmds.optionMenu', 'cmds.optionMenu', (), '', True, 'import maya.cmds as cmds\n'), ((448, 4, 448, 24), 'maya.cmds.menuItem', 'cmds.menuItem', (), '', True, 'import maya.cmds as cmds\n'), ((449, 4, 449, 24), 'maya.cmds.menuItem', 'cmds.menuItem', (), '', True, 'import maya.cmds as cmds\n'), ((450, 4, 450, 24), 'maya.cmds.menuItem', 'cmds.menuItem', (), '', True, 'import maya.cmds as cmds\n'), ((453, 26, 453, 57), 'maya.cmds.text', 'cmds.text', (), '', True, 'import maya.cmds as cmds\n'), ((454, 20, 454, 52), 'maya.cmds.intField', 'cmds.intField', (), '', True, 'import maya.cmds as cmds\n'), ((456, 17, 456, 50), 'maya.cmds.button', 'cmds.button', (), '', True, 'import maya.cmds as cmds\n'), ((457, 19, 457, 54), 'maya.cmds.button', 'cmds.button', (), '', True, 'import maya.cmds as cmds\n'), ((459, 18, 459, 37), 'maya.cmds.separator', 'cmds.separator', (), '', True, 'import maya.cmds as cmds\n'), ((460, 18, 460, 37), 'maya.cmds.separator', 'cmds.separator', (), '', True, 'import maya.cmds as cmds\n'), ((465, 4, 506, 5), 'maya.cmds.formLayout', 'cmds.formLayout', (), '', True, 'import maya.cmds as cmds\n'), ((508, 4, 508, 26), 'maya.cmds.showWindow', 'cmds.showWindow', ({(508, 20, 508, 25): 'myWin'}, {}), '(myWin)', True, 'import maya.cmds as cmds\n'), ((16, 18, 16, 52), 'maya.cmds.ls', 'cmds.ls', (), '', True, 'import maya.cmds as cmds\n'), ((55, 8, 55, 27), 'maya.cmds.select', 'cmds.select', (), '', True, 'import maya.cmds as cmds\n'), ((65, 16, 65, 65), 'maya.cmds.pointConstraint', 'cmds.pointConstraint', ({(65, 37, 65, 48): 'switcherLoc', (65, 50, 65, 64): 'switcherLocGrp'}, {}), '(switcherLoc, switcherLocGrp)', True, 'import maya.cmds as cmds\n'), ((67, 16, 67, 76), 'maya.cmds.pointConstraint', 'cmds.pointConstraint', ({(67, 37, 67, 47): 'ogChain[1]', (67, 49, 67, 59): 'ogChain[2]', (67, 61, 67, 75): 'switcherLocGrp'}, {}), '(ogChain[1], ogChain[2], switcherLocGrp)', True, 'import maya.cmds as cmds\n'), ((74, 8, 74, 69), 'maya.cmds.setAttr', 'cmds.setAttr', (), '', True, 'import maya.cmds as cmds\n'), ((75, 8, 75, 66), 'maya.cmds.setAttr', 'cmds.setAttr', (), '', True, 'import maya.cmds as cmds\n'), ((76, 8, 76, 65), 'maya.cmds.setAttr', 'cmds.setAttr', (), '', True, 'import maya.cmds as cmds\n'), ((83, 16, 83, 57), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(83, 38, 83, 48): 'ogChain[0]', (83, 50, 83, 56): 'rigGrp'}, {}), '(ogChain[0], rigGrp)', True, 'import maya.cmds as cmds\n'), ((84, 16, 84, 58), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(84, 38, 84, 48): 'ogChain[0]', (84, 50, 84, 57): 'ctrlGrp'}, {}), '(ogChain[0], ctrlGrp)', True, 'import maya.cmds as cmds\n'), ((97, 8, 97, 68), 'maya.cmds.parent', 'cmds.parent', ({(97, 20, 97, 38): "(ogChain[0] + '_ik')", (97, 40, 97, 58): "(ogChain[0] + '_fk')", (97, 60, 97, 67): 'ctrlGrp'}, {}), "(ogChain[0] + '_ik', ogChain[0] + '_fk', ctrlGrp)", True, 'import maya.cmds as cmds\n'), ((98, 8, 98, 57), 'maya.cmds.parent', 'cmds.parent', ({(98, 20, 98, 47): "(ogChain[0] + '_fk_anim_grp')", (98, 49, 98, 56): 'ctrlGrp'}, {}), "(ogChain[0] + '_fk_anim_grp', ctrlGrp)", True, 'import maya.cmds as cmds\n'), ((99, 8, 99, 43), 'maya.cmds.parent', 'cmds.parent', ({(99, 20, 99, 34): 'switcherLocGrp', (99, 36, 99, 42): 'rigGrp'}, {}), '(switcherLocGrp, rigGrp)', True, 'import maya.cmds as cmds\n'), ((105, 16, 105, 49), 'maya.cmds.pickWalk', 'cmds.pickWalk', (), '', True, 'import maya.cmds as cmds\n'), ((109, 16, 109, 63), 'maya.cmds.pointConstraint', 'cmds.pointConstraint', ({(109, 37, 109, 46): 'clavJoint', (109, 48, 109, 62): 'clavController'}, {}), '(clavJoint, clavController)', True, 'import maya.cmds as cmds\n'), ((113, 16, 113, 67), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(113, 38, 113, 47): 'clavJoint', (113, 49, 113, 66): 'clavControllerGrp'}, {}), '(clavJoint, clavControllerGrp)', True, 'import maya.cmds as cmds\n'), ((161, 26, 161, 83), 'maya.cmds.createNode', 'cmds.createNode', (), '', True, 'import maya.cmds as cmds\n'), ((164, 8, 164, 82), 'maya.cmds.connectAttr', 'cmds.connectAttr', ({(164, 26, 164, 51): "(ogChain[x] + '_ik.rotate')", (164, 54, 164, 81): "(blendColorsNode + '.color1')"}, {}), "(ogChain[x] + '_ik.rotate', blendColorsNode + '.color1')", True, 'import maya.cmds as cmds\n'), ((165, 8, 165, 82), 'maya.cmds.connectAttr', 'cmds.connectAttr', ({(165, 26, 165, 51): "(ogChain[x] + '_fk.rotate')", (165, 54, 165, 81): "(blendColorsNode + '.color2')"}, {}), "(ogChain[x] + '_fk.rotate', blendColorsNode + '.color2')", True, 'import maya.cmds as cmds\n'), ((166, 8, 166, 82), 'maya.cmds.connectAttr', 'cmds.connectAttr', ({(166, 26, 166, 53): "(blendColorsNode + '.output')", (166, 57, 166, 79): "(ogChain[x] + '.rotate')"}, {}), "(blendColorsNode + '.output', ogChain[x] + '.rotate')", True, 'import maya.cmds as cmds\n'), ((167, 8, 167, 83), 'maya.cmds.connectAttr', 'cmds.connectAttr', ({(167, 25, 167, 52): "(switcherLoc[0] + '.FKIK_Mode')", (167, 54, 167, 82): "(blendColorsNode + '.blender')"}, {}), "(switcherLoc[0] + '.FKIK_Mode', blendColorsNode + '.blender')", True, 'import maya.cmds as cmds\n'), ((179, 8, 179, 63), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(179, 31, 179, 49): "(ogChain[x] + '_ik')", (179, 52, 179, 62): 'ogChain[x]'}, {}), "(ogChain[x] + '_ik', ogChain[x])", True, 'import maya.cmds as cmds\n'), ((180, 8, 180, 63), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(180, 31, 180, 49): "(ogChain[x] + '_fk')", (180, 52, 180, 62): 'ogChain[x]'}, {}), "(ogChain[x] + '_fk', ogChain[x])", True, 'import maya.cmds as cmds\n'), ((188, 8, 188, 34), 'maya.cmds.setAttr', 'cmds.setAttr', ({(188, 21, 188, 30): 'sdkDriver', (188, 32, 188, 33): '(0)'}, {}), '(sdkDriver, 0)', True, 'import maya.cmds as cmds\n'), ((189, 8, 189, 68), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((190, 8, 190, 68), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((192, 8, 192, 34), 'maya.cmds.setAttr', 'cmds.setAttr', ({(192, 21, 192, 30): 'sdkDriver', (192, 32, 192, 33): '(1)'}, {}), '(sdkDriver, 1)', True, 'import maya.cmds as cmds\n'), ((193, 8, 193, 68), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((194, 8, 194, 68), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((208, 21, 208, 68), 'maya.cmds.group', 'cmds.group', (), '', True, 'import maya.cmds as cmds\n'), ((212, 8, 212, 57), 'maya.cmds.scale', 'cmds.scale', ({(212, 19, 212, 25): 'fkSize', (212, 27, 212, 33): 'fkSize', (212, 35, 212, 41): 'fkSize', (212, 43, 212, 56): 'fk_controller'}, {}), '(fkSize, fkSize, fkSize, fk_controller)', True, 'import maya.cmds as cmds\n'), ((214, 8, 214, 51), 'maya.cmds.matchTransform', 'cmds.matchTransform', ({(214, 28, 214, 38): 'anim_group', (214, 40, 214, 50): 'ogChain[y]'}, {}), '(anim_group, ogChain[y])', True, 'import maya.cmds as cmds\n'), ((216, 8, 216, 46), 'maya.cmds.parent', 'cmds.parent', ({(216, 20, 216, 33): 'fk_controller', (216, 35, 216, 45): 'anim_group'}, {}), '(fk_controller, anim_group)', True, 'import maya.cmds as cmds\n'), ((224, 8, 224, 68), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((225, 8, 225, 42), 'maya.cmds.delete', 'cmds.delete', (), '', True, 'import maya.cmds as cmds\n'), ((226, 8, 226, 54), 'maya.cmds.color', 'cmds.color', (), '', True, 'import maya.cmds as cmds\n'), ((230, 8, 230, 34), 'maya.cmds.setAttr', 'cmds.setAttr', ({(230, 21, 230, 30): 'sdkDriver', (230, 32, 230, 33): '(1)'}, {}), '(sdkDriver, 1)', True, 'import maya.cmds as cmds\n'), ((231, 8, 231, 95), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((232, 8, 232, 34), 'maya.cmds.setAttr', 'cmds.setAttr', ({(232, 21, 232, 30): 'sdkDriver', (232, 32, 232, 33): '(0)'}, {}), '(sdkDriver, 0)', True, 'import maya.cmds as cmds\n'), ((233, 8, 233, 95), 'maya.cmds.setDrivenKeyframe', 'cmds.setDrivenKeyframe', (), '', True, 'import maya.cmds as cmds\n'), ((244, 8, 244, 75), 'maya.cmds.parent', 'cmds.parent', ({(244, 20, 244, 47): "(ogChain[x] + '_fk_anim_grp')", (244, 49, 244, 74): "(ogChain[x - 1] + '_fk_anim')"}, {}), "(ogChain[x] + '_fk_anim_grp', ogChain[x - 1] + '_fk_anim')", True, 'import maya.cmds as cmds\n'), ((248, 8, 248, 74), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(248, 30, 248, 53): "(ogChain[x] + '_fk_anim')", (248, 55, 248, 73): "(ogChain[x] + '_fk')"}, {}), "(ogChain[x] + '_fk_anim', ogChain[x] + '_fk')", True, 'import maya.cmds as cmds\n'), ((271, 16, 271, 70), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(271, 38, 271, 56): "(ogChain[2] + '_ik')", (271, 58, 271, 69): 'ikHandJoint'}, {}), "(ogChain[2] + '_ik', ikHandJoint)", True, 'import maya.cmds as cmds\n'), ((274, 8, 274, 49), 'maya.cmds.move', 'cmds.move', (), '', True, 'import maya.cmds as cmds\n'), ((276, 8, 276, 50), 'maya.cmds.move', 'cmds.move', (), '', True, 'import maya.cmds as cmds\n'), ((294, 16, 294, 71), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(294, 38, 294, 56): "(ogChain[2] + '_ik')", (294, 58, 294, 70): 'crvIkCubeGrp'}, {}), "(ogChain[2] + '_ik', crvIkCubeGrp)", True, 'import maya.cmds as cmds\n'), ((343, 16, 343, 74), 'maya.cmds.pointConstraint', 'cmds.pointConstraint', ({(343, 37, 343, 55): "(ogChain[3] + '_ik')", (343, 57, 343, 73): 'ikFootControlGrp'}, {}), "(ogChain[3] + '_ik', ikFootControlGrp)", True, 'import maya.cmds as cmds\n'), ((366, 8, 366, 86), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((411, 16, 411, 49), 'maya.cmds.pointConstraint', 'cmds.pointConstraint', ({(411, 37, 411, 40): 'loc', (411, 42, 411, 48): 'locGrp'}, {}), '(loc, locGrp)', True, 'import maya.cmds as cmds\n'), ((430, 44, 430, 73), 'maya.cmds.deleteUI', 'cmds.deleteUI', ({(430, 58, 430, 72): '"""switchModeUI"""'}, {}), "('switchModeUI')", True, 'import maya.cmds as cmds\n'), ((50, 12, 50, 40), 'maya.cmds.joint', 'cmds.joint', (), '', True, 'import maya.cmds as cmds\n'), ((51, 12, 51, 57), 'maya.cmds.matchTransform', 'cmds.matchTransform', ({(51, 32, 51, 44): 'newJointName', (51, 46, 51, 56): 'ogChain[i]'}, {}), '(newJointName, ogChain[i])', True, 'import maya.cmds as cmds\n'), ((52, 12, 52, 71), 'maya.cmds.makeIdentity', 'cmds.makeIdentity', (), '', True, 'import maya.cmds as cmds\n'), ((209, 24, 209, 62), 'maya.cmds.circle', 'cmds.circle', (), '', True, 'import maya.cmds as cmds\n'), ((215, 20, 215, 68), 'maya.cmds.parentConstraint', 'cmds.parentConstraint', ({(215, 42, 215, 52): 'ogChain[y]', (215, 54, 215, 67): 'fk_controller'}, {}), '(ogChain[y], fk_controller)', True, 'import maya.cmds as cmds\n'), ((219, 36, 219, 70), 'maya.cmds.rotate', 'cmds.rotate', ({(219, 48, 219, 50): '(90)', (219, 51, 219, 52): '(0)', (219, 53, 219, 54): '(0)', (219, 56, 219, 69): 'fk_controller'}, {}), '(90, 0, 0, fk_controller)', True, 'import maya.cmds as cmds\n'), ((220, 36, 220, 70), 'maya.cmds.rotate', 'cmds.rotate', ({(220, 48, 220, 49): '(0)', (220, 50, 220, 52): '(90)', (220, 53, 220, 54): '(0)', (220, 56, 220, 69): 'fk_controller'}, {}), '(0, 90, 0, fk_controller)', True, 'import maya.cmds as cmds\n'), ((221, 36, 221, 70), 'maya.cmds.rotate', 'cmds.rotate', ({(221, 48, 221, 49): '(0)', (221, 50, 221, 51): '(0)', (221, 52, 221, 54): '(90)', (221, 56, 221, 69): 'fk_controller'}, {}), '(0, 0, 90, fk_controller)', True, 'import maya.cmds as cmds\n'), ((368, 12, 368, 64), 'maya.cmds.addAttr', 'cmds.addAttr', (), '', True, 'import maya.cmds as cmds\n'), ((463, 52, 463, 106), 'functools.partial', 'partial', ({(463, 60, 463, 74): 'duplicateChain', (463, 76, 463, 89): 'blendNodeFunc', (463, 91, 463, 105): 'constraintFunc'}, {}), '(duplicateChain, blendNodeFunc, constraintFunc)', False, 'from functools import partial\n'), ((44, 16, 44, 59), 'maya.cmds.error', 'cmds.error', ({(44, 27, 44, 58): '"""pls, select one relation type"""'}, {}), "('pls, select one relation type')", True, 'import maya.cmds as cmds\n'), ((252, 16, 252, 65), 'maya.cmds.delete', 'cmds.delete', ({(252, 28, 252, 64): "(ogChain[chainLen - 1] + '_fk_anim_grp')"}, {}), "(ogChain[chainLen - 1] + '_fk_anim_grp')", True, 'import maya.cmds as cmds\n'), ((440, 61, 440, 109), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n'), ((442, 56, 442, 109), 'maya.cmds.checkBox', 'cmds.checkBox', (), '', True, 'import maya.cmds as cmds\n')]