コード例 #1
0
ファイル: Func.py プロジェクト: darkuress/arFace
    def createBrowCtl(self, jntNum, orderJnts):
        """
        create extra controllor for the panel
        """
        ctlP = "browDetailCtrl0"
        kids = cmds.listRelatives (ctlP, ad=True, type ='transform')   
        if kids:
            cmds.delete (kids)
            
        attTemp = ['scaleX','scaleY','scaleZ', 'rotateX','rotateY', 'tz', 'visibility' ]  
        index = 0

        for jnt in orderJnts:                            
            detailCtl = cmds.circle ( n = 'browDetail' + str(index+1).zfill(2), ch=False, o =True, nr = ( 0, 0, 1), r = 0.2 )
            detailPlane = cmds.nurbsPlane ( ax = ( 0, 0, 1 ), w = 0.1,  lengthRatio = 10, degree = 3, ch=False, n = 'browDetail'+ str(index+1).zfill(2) + 'P' )
            increment = 2.0/(jntNum-1)
            cmds.parent (detailCtl[0], detailPlane[0], relative=True )
            cmds.parent (detailPlane[0], ctlP, relative=True )
            cmds.setAttr (detailPlane[0] + '.tx', -2 + increment*index*2 )
            cmds.xform ( detailCtl[0], r =True, s = (0.2, 0.2, 0.2))  
            cmds.setAttr (detailCtl[0] +".overrideEnabled", 1)
            cmds.setAttr (detailCtl[0] +"Shape.overrideEnabled", 1)
            cmds.setAttr( detailCtl[0]+"Shape.overrideColor", 20)        
            
            cmds.transformLimits ( detailCtl[0] , tx = ( -.4, .4), etx=( True, True) )
            cmds.transformLimits ( detailCtl[0], ty = ( -.8, .8), ety=( True, True) )
            
            for att in attTemp:
                cmds.setAttr (detailCtl[0] +"."+ att, lock = True, keyable = False, channelBox =False)
                    
            index = index + 1
コード例 #2
0
ファイル: ikRig.py プロジェクト: siamkiw/kiwToolModules
def legIkAttrConnection(ankleCtrlName, side):
    mc.connectAttr(ankleCtrlName + '.toeRoll',
                   'toe_ikPiv' + side + '_grp' + '.rx')
    mc.connectAttr(ankleCtrlName + '.ballRoll',
                   'ballRoll_ikPiv' + side + '_grp' + '.rx')
    mc.connectAttr(ankleCtrlName + '.heelRoll',
                   'heel_ikPiv' + side + '_grp' + '.rx')
    mc.connectAttr(ankleCtrlName + '.toeTwist',
                   'toe_ikPiv' + side + '_grp' + '.rz')
    mc.connectAttr(ankleCtrlName + '.heelTwist',
                   'heel_ikPiv' + side + '_grp' + '.rz')
    mc.connectAttr(ankleCtrlName + '.legTwist',
                   'leg_ik' + side + '_ikh' + '.twist')
    mc.connectAttr(ankleCtrlName + '.toeBend',
                   'toeBend_ikPiv' + side + '_grp' + '.rx')
    mc.connectAttr(ankleCtrlName + '.footRock',
                   'footIn_ikPiv' + side + '_grp' + '.ry')
    mc.connectAttr(ankleCtrlName + '.footRock',
                   'footOut_ikPiv' + side + '_grp' + '.ry')
    mc.transformLimits('footOut_ikPiv' + side + '_grp',
                       ry=(0, 180),
                       ery=(1, 0))
    mc.transformLimits('footIn_ikPiv' + side + '_grp',
                       ry=(-180, 0),
                       ery=(0, 1))
コード例 #3
0
ファイル: hacks.py プロジェクト: guileschool/ls-rigging-tools
def setLimitsOnAttrs(limitsTbl, objs):
    for eachObj in objs:
        for attr, limits in limitsTbl.items():
            kw = {}
            kw['e%s' % attr] = (1, 1)
            kw[attr] = limits
            mc.transformLimits(eachObj, **kw)
コード例 #4
0
ファイル: dpSingle.py プロジェクト: nilouco/dpAutoRigSystem
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".flip", 0)
     
     cmds.addAttr(self.moduleGrp, longName="indirectSkin", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".indirectSkin", 0)
     
     cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
     cmds.setAttr(self.jGuide1+".template", 1)
     cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
     
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint+".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd+".template", 1)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     cmds.parent(self.jGuideEnd, self.jGuide1)
     cmds.parentConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ParentConstraint")
     cmds.parentConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ParentConstraint")
     cmds.scaleConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ScaleConstraint")
     cmds.scaleConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ScaleConstraint")
コード例 #5
0
ファイル: utils.py プロジェクト: Bumpybox/Tapp
def sliderA(prefix):
    cmds.undoInfo(openChunk=True)
    
    #create nodes
    grp=cmds.group(empty=True,n=(prefix+'_grp'))
    cnt=cmds.circle(r=0.1,ch=False,n=(prefix+'_cnt'))
    shp=cmds.circle(o=True,r=1,ch=False,d=1,s=4,n=(prefix+'_shp'))
    
    #setup shp
    cmds.move(-1,0,0,'%s.cv[0]' % shp[0],r=True,os=True)
    cmds.move(-1,0,0,'%s.cv[4]' % shp[0],r=True,os=True)
    cmds.move(0,-1,0,'%s.cv[1]' % shp[0],r=True,os=True)
    cmds.move(1,0,0,'%s.cv[2]' % shp[0],r=True,os=True)
    cmds.move(0,1,0,'%s.cv[3]' % shp[0],r=True,os=True)
    
    cmds.parent(shp,grp)
    
    cmds.setAttr('%s.overrideEnabled' % shp[0],1)
    cmds.setAttr('%s.overrideDisplayType' % shp[0],2)
    
    #setup cnt
    cmds.parent(cnt,shp)
    
    cmds.setAttr('%s.overrideEnabled' % cnt[0],1)
    
    cmds.transformLimits(cnt,tx=(-1,1),etx=(1,1))
    cmds.transformLimits(cnt,ty=(-1,1),ety=(1,1))
    
    setupAttrs(prefix,cnt[0])
    
    return grp
    
    cmds.undoInfo(closeChunk=True)
コード例 #6
0
def createShape(prefix=''):
    """
    create a unit slider for blend operation
    :param prefix: str, prefix of the control
    :param scale: float, scale of the control
    :return: str, ctrlBox of the unitSliderControl
    """
    Ctrl = cmds.circle(radius=0.2, nr=(1, 0, 0), n=prefix + '_Ctrl')[0]
    cmds.transformLimits(Ctrl,
                         tx=(0, 0),
                         ty=(0, 1),
                         tz=(0, 0),
                         etx=(1, 1),
                         ety=(1, 1),
                         etz=(1, 1))

    CtrlBox = cmds.curve(d=1,
                         p=[(0, 0, 0), (0, 1, 0)],
                         k=[0, 1],
                         n=prefix + '_CtrlBox')
    parentCrvShape = cmds.listRelatives(CtrlBox, s=1)
    cmds.setAttr(parentCrvShape[0] + '.template', 1)

    cmds.parent(Ctrl, CtrlBox)
    cmds.makeIdentity(CtrlBox, apply=1, t=1, r=1, s=1, n=0)
    cmds.select(cl=1)

    return CtrlBox
コード例 #7
0
 def lockHideControlAttrs(self, *args):
     if cmds.ls(sl=True) == []:
         return
     sel = cmds.ls(sl=True)
     for s in sel:
         cmds.transformLimits(s,
                              tx=(-1, 1),
                              ty=(-1, 1),
                              tz=(-1, 1),
                              rx=(-45, 45),
                              ry=(-45, 45),
                              rz=(-45, 45),
                              etx=(True, True),
                              ety=(True, True),
                              etz=(True, True),
                              erx=(True, True),
                              ery=(True, True),
                              erz=(True, True))
         # Check if attribute has connection.
         attrlist = [
             '.tx', '.ty', '.tz', '.rx', '.ry', '.rz', '.sx', '.sy', '.sz'
         ]
         for a in attrlist:
             iscon = cmds.listConnections(s + a, d=True, s=False)
             if iscon == None:
                 cmds.setAttr(s + a, l=True)
コード例 #8
0
def lockAndScaleSlider(thingToLock):

	print minValueToInject

	intFieldMin = cmds.intField(minCtrlValue, query=True, value=True)#get user input
	
	intFieldMax = cmds.intSliderGrp(maxCtrlValue, query=True, value=True)#get user input

	floatFieldMax = float(intFieldMax)

	scaleRatioMax = floatFieldMax / (floatFieldMax*floatFieldMax)

	sliderBox = cmds.curve(n="sliderTemp", p=[[intFieldMax, 0, 0], [intFieldMax, 0.1, 0], [minValueToInject, 0.1, -0], [minValueToInject, 0, -0], [intFieldMax, 0, 0]],d=1)

	cmds.transformLimits(thingToLock, tx=[minValueToInject, intFieldMax], etx=[1, 1])

	parent("tempMainCurve", "sliderTemp")

	scaleToX(sliderBox, scaleRatioMax)

	scaleToX("tempMainCurve", intFieldMax)

	lockAllButTx('tempMainCurve')

	cmds.rename("sliderTemp", "Slider")

	cmds.rename("tempMainCurve", "Controler")
コード例 #9
0
ファイル: dpControls.py プロジェクト: nilouco/dpAutoRigSystem
def cvBaseGuide(ctrlName, r=1):
    """Create a control to be used as a Base Guide control.
        Returns the main control (circle) and the radius control in a list.
    """
    # get radius by checking linear unit
    r = dpCheckLinearUnit(r)
    # create a simple circle curve:
    circle = cmds.circle(n=ctrlName, ch=True, o=True, nr=(0, 0, 1), d=3, s=8, radius=r)[0]
    radiusCtrl = cmds.circle(n=ctrlName+"_RadiusCtrl", ch=True, o=True, nr=(0, 1, 0), d=3, s=8, radius=(r/4.0))[0]
    # rename curveShape:
    renameShape([circle, radiusCtrl])
    # configure system of limits and radius:
    cmds.setAttr(radiusCtrl+".translateX", r)
    cmds.parent(radiusCtrl, circle, relative=True)
    cmds.transformLimits(radiusCtrl, tx=(0.01, 1), etx=(True, False))
    setLockHide([radiusCtrl], ['ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
    # find makeNurbCircle history of the circles:
    historyList = findHistory([circle, radiusCtrl], 'makeNurbCircle')
    circleHistory     = historyList[0]
    radiusCtrlHistory = historyList[1]
    # rename and make a connection for circle:
    circleHistory = cmds.rename(circleHistory, circle+"_makeNurbCircle")
    cmds.connectAttr(radiusCtrl+".tx", circleHistory+".radius", force=True)
    radiusCtrlHistory = cmds.rename(radiusCtrlHistory, radiusCtrl+"_makeNurbCircle")
    # create a mutiplyDivide in order to automatisation the radius of the radiusCtrl:
    radiusCtrlMD = cmds.createNode('multiplyDivide', name=radiusCtrl+'_MD')
    cmds.connectAttr(radiusCtrl+'.translateX', radiusCtrlMD+'.input1X', force=True)
    cmds.setAttr(radiusCtrlMD+'.input2X', 0.15)
    cmds.connectAttr(radiusCtrlMD+".outputX", radiusCtrlHistory+".radius", force=True)
    # colorize curveShapes:
    colorShape([circle, radiusCtrl], 'yellow')
    cmds.select(clear=True)
    return [circle, radiusCtrl]
コード例 #10
0
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".flip", 0)
     cmds.addAttr(self.moduleGrp, longName="fatherB", dataType='string')
     
     cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     
     self.cvALoc, shapeSizeCH = self.ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLocA", r=0.3, d=1, guide=True)
     self.connectShapeSize(shapeSizeCH)
     self.jAGuide = cmds.joint(name=self.guideName+"_jAGuide", radius=0.001)
     cmds.setAttr(self.jAGuide+".template", 1)
     cmds.parent(self.jAGuide, self.moduleGrp, relative=True)
     
     self.cvBLoc, shapeSizeCH = self.ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLocB", r=0.3, d=1, guide=True)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvBLoc, self.cvALoc)
     cmds.setAttr(self.cvBLoc+".tz", 3)
     cmds.setAttr(self.cvBLoc+".rotateX", 180)
     self.jBGuide = cmds.joint(name=self.guideName+"_jBGuide", radius=0.001)
     cmds.setAttr(self.jBGuide+".template", 1)
     cmds.transformLimits(self.cvBLoc, tz=(0.01, 1), etz=(True, False))
     self.ctrls.setLockHide([self.cvBLoc], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     
     cmds.parent(self.cvALoc, self.moduleGrp)
     cmds.parent(self.jBGuide, self.jAGuide)
     cmds.parentConstraint(self.cvALoc, self.jAGuide, maintainOffset=False, name=self.jAGuide+"_ParentConstraint")
     cmds.parentConstraint(self.cvBLoc, self.jBGuide, maintainOffset=False, name=self.jBGuide+"_ParentConstraint")
     cmds.scaleConstraint(self.cvALoc, self.jAGuide, maintainOffset=False, name=self.jAGuide+"_ScaleConstraint")
     cmds.scaleConstraint(self.cvBLoc, self.jBGuide, maintainOffset=False, name=self.jBGuide+"_ScaleConstraint")
コード例 #11
0
ファイル: faceRig.py プロジェクト: Cgoodw/MayaScripting
def createBoxControl(ctrlName):
    mc.curve(d=1,p=[[-1,1,0],[1,1,0],[1,-1,0],[-1,-1,0],[-1,1,0]],n=ctrlName+'_limitBox')
    mc.circle(n=ctrlName, nr=[0,0,1],r=.1)
    mc.transformLimits(ctrlName,etx=[True,True],ety=[True,True])
    
    mc.textCurves(t=ctrlName,n=ctrlName+'_text')
    mc.setAttr(ctrlName+'_textShape.ty',1.1)
    mc.setAttr(ctrlName+'_textShape.tx',-1)
    mc.setAttr(ctrlName+'_textShape.sy',.3)
    mc.setAttr(ctrlName+'_textShape.sx',.3)
    mc.select(ctrlName+'_textShape',hi=True)
    textSel=mc.ls(sl=True)
        
    
    
    for obj in textSel:
        mc.setAttr(obj+'.template',1)
    mc.parent(ctrlName,ctrlName+'_textShape',ctrlName+'_limitBox')
    mc.setAttr(ctrlName+'.tz',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.rx',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.ry',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.rz',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.sz',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.sx',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.sy',lock=True,k=False,channelBox=False)
    mc.setAttr(ctrlName+'.v',lock=True,k=False,channelBox=False)
コード例 #12
0
def sliderA(prefix):
    cmds.undoInfo(openChunk=True)

    #create nodes
    grp = cmds.group(empty=True, n=(prefix + '_grp'))
    cnt = cmds.circle(r=0.1, ch=False, n=(prefix + '_cnt'))
    shp = cmds.circle(o=True, r=1, ch=False, d=1, s=4, n=(prefix + '_shp'))

    #setup shp
    cmds.move(-1, 0, 0, '%s.cv[0]' % shp[0], r=True, os=True)
    cmds.move(-1, 0, 0, '%s.cv[4]' % shp[0], r=True, os=True)
    cmds.move(0, -1, 0, '%s.cv[1]' % shp[0], r=True, os=True)
    cmds.move(1, 0, 0, '%s.cv[2]' % shp[0], r=True, os=True)
    cmds.move(0, 1, 0, '%s.cv[3]' % shp[0], r=True, os=True)

    cmds.parent(shp, grp)

    cmds.setAttr('%s.overrideEnabled' % shp[0], 1)
    cmds.setAttr('%s.overrideDisplayType' % shp[0], 2)

    #setup cnt
    cmds.parent(cnt, shp)

    cmds.setAttr('%s.overrideEnabled' % cnt[0], 1)

    cmds.transformLimits(cnt, tx=(-1, 1), etx=(1, 1))
    cmds.transformLimits(cnt, ty=(-1, 1), ety=(1, 1))

    setupAttrs(prefix, cnt[0])

    return grp

    cmds.undoInfo(closeChunk=True)
コード例 #13
0
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.setAttr(self.moduleGrp + ".moduleNamespace",
                  self.moduleGrp[:self.moduleGrp.rfind(":")],
                  type='string')
     cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
     cmds.addAttr(self.moduleGrp,
                  longName="style",
                  attributeType='enum',
                  enumName=self.langDic[self.langName]['m042_default'] +
                  ':' + self.langDic[self.langName]['m026_biped'])
     cmds.setAttr(self.moduleGrp + ".nJoints", 1)
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(
         ctrlName=self.guideName + "_JointLoc1", r=0.5)
     self.connectShapeSize(shapeSizeCH)
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(
         ctrlName=self.guideName + "_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint],
                       ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     # Edit GUIDE:
     cmds.setAttr(self.moduleGrp + ".rx", -90)
     cmds.setAttr(self.moduleGrp + ".ry", -90)
     cmds.setAttr(self.moduleGrp + "_RadiusCtrl.tx", 4)
コード例 #14
0
ファイル: dpFkLine.py プロジェクト: martinposta/scripts
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
     cmds.setAttr(self.moduleGrp+".nJoints", 1)
     
     cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".flip", 0)
     
     cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
     cmds.setAttr(self.jGuide1+".template", 1)
     cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
     
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint+".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd+".template", 1)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     cmds.parent(self.jGuideEnd, self.jGuide1)
     cmds.parentConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ParentConstraint")
     cmds.parentConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ParentConstraint")
     cmds.scaleConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ScaleConstraint")
     cmds.scaleConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ScaleConstraint")
コード例 #15
0
ファイル: hacks.py プロジェクト: sayehaye3d/ls-rigging-tools
def setLimitsOnAttrs(limitsTbl, objs):
    for eachObj in objs:
        for attr, limits in limitsTbl.items():
            kw={}
            kw['e%s'%attr] = (1, 1)
            kw[attr] = limits
            mc.transformLimits(eachObj, **kw)
コード例 #16
0
def createShape(prefix=''):
    """
    Create a vertical slider control with proper name
    :param prefix: str, prefixName of the control
    :return: list(str), [sliderPath, mainCtrlBox]
    """
    # create slider
    ctrl = cmds.circle(radius=0.15, nr=(0, 1, 0), n=prefix + '_Ctrl')[0]

    cmds.transformLimits(ctrl, tx=(-1, 1), ty=(0, 0), tz=(0, 0), etx=(1, 1), ety=(1, 1), etz=(1, 1))

    ctrlBox = cmds.curve(d=1, p=[(-1, 0, 0), (1, 0, 0)], k=[0, 1], n=prefix + '_Path')
    parentCrvShape = cmds.listRelatives(ctrlBox, s=1)
    cmds.setAttr(parentCrvShape[0] + '.template', 1)
    cmds.parent(ctrl, ctrlBox)

    cmds.select(cl=1)

    # create text
    textCrv = cmds.textCurves(n=prefix + '_text', font='Times-Roman', t=name.removeSuffix(prefix))[0]

    cmds.setAttr(textCrv + '.overrideEnabled', 1)
    cmds.setAttr(textCrv + '.overrideDisplayType', 2)

    cmds.setAttr(textCrv + '.s', 0.5, 0.5, 0.5)

    cmds.setAttr(textCrv + '.rx', 90)
    cmds.makeIdentity(textCrv, apply=1, t=0, r=1, s=1)

    textHeight = cmds.getAttr(textCrv + '.boundingBoxMaxZ')
    textWidth = cmds.getAttr(textCrv + '.boundingBoxMaxX')

    cmds.setAttr(textCrv + '.tx', (0 - (textWidth/2)))
    cmds.setAttr(textCrv + '.tz', 0.65)

    betterWidth = 1.15
    if textWidth/2 >= 1.15:
        betterWidth = textWidth/2

    # create Main CtrlBox
    mainCtrlBox = cmds.curve(d=1, p=[((0 - (betterWidth + 0.2)), 0, (0.85 + textHeight)),
                                     ((betterWidth + 0.2), 0, (0.85 + textHeight)),
                                     ((betterWidth + 0.2), 0, -0.35),
                                     ((0 - (betterWidth + 0.2)), 0, -0.35),
                                     ((0 - (betterWidth + 0.2)), 0, (0.85 + textHeight))],
                             k=[0, 1, 2, 3, 4], n=prefix + '_ctrlBox')

    parentCrvShape1 = cmds.listRelatives(mainCtrlBox, s=1)
    cmds.setAttr(parentCrvShape1[0] + '.template', 1)

    # clean hierarchy
    cmds.parent(ctrlBox, mainCtrlBox)
    cmds.parent(textCrv, mainCtrlBox)

    cmds.makeIdentity(mainCtrlBox, apply=1, t=0, r=1, s=1)

    cmds.select(cl=1)

    return [ctrlBox, mainCtrlBox]
コード例 #17
0
def createUI(name='NAMEINGERFACE', size=10.0, texto='no name'):

    grp = 'FACE_UI_GRP'
    if not cmds.objExists(grp):
        grp = cmds.group(n=grp, em=True)

    if not cmds.objExists(name + '_UI_ZTR'):

        ztr = cmds.group(n=name + '_UI_ZTR', em=True)

        shape = cmds.curve(n=name + '_UI_TRF',
                           d=1,
                           p=[(1, -1, 0), (1, 1, 0), (-1, 1, 0), (-1, -1, 0),
                              (1, -1, 0)])
        cnt = cmds.circle(n=name + '_UI_CNT', nr=[0, 0, 1], radius=0.3)[0]
        cmds.transformLimits(cnt,
                             tx=(-1, 1),
                             ty=(-1, 1),
                             etx=(True, True),
                             ety=(True, True))

        changeColor([shape], 2)
        changeColor([cnt], 22)

        try:
            text = cmds.textCurves(n=name + '_UI_TCV', f='Arial', t=texto)
            cmds.move(0, size / 2.0, 0, text, absolute=True)
        except:
            pass

        cmds.parent(ztr, grp)
        cmds.parent(shape, ztr)
        cmds.parent(cnt, shape)

        cmds.setAttr(str(shape) + '.scaleX', size)
        cmds.setAttr(str(shape) + '.scaleY', size)
        cmds.setAttr(str(shape) + '.scaleZ', size)

        transfomrs = [
            'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v', 'tx', 'ty'
        ]
        for a in transfomrs[0:7]:
            cmds.setAttr(str(cnt) + '.' + a,
                         lock=True,
                         keyable=False,
                         channelBox=False)
        for a in transfomrs:
            cmds.setAttr(str(shape) + '.' + a,
                         lock=True,
                         keyable=False,
                         channelBox=False)

        cmds.select(ztr)

    else:
        cmds.warning('Eliga otro nombre para la interface porfavor, ' + name +
                     ' ya existe.')
コード例 #18
0
ファイル: controlUI.py プロジェクト: yazici/fromGod
    def slideSinge(self, Text, sign='DEL'):
        WD = CreateControler(self.Color, (1, 1, -1))
        AR = WD.SK_b09(Text + '_M')
        ARGRP = rig.group(AR, n=AR + '_CON_GRP', r=True)
        rig.setAttr(ARGRP + '.sx', 0.08)
        rig.setAttr(ARGRP + '.sy', 0.08)
        rig.setAttr(ARGRP + '.sz', 0.08)
        rig.move(0, 0, 0.165959, AR + '.scalePivot', AR + '.rotatePivot')
        rig.setAttr(ARGRP + '.tz', -0.166)

        SQ = WD.SK_b13(Text + '_RANGE_SQ')
        SQGRP = rig.group(SQ, n=SQ + '_RANGE_GRP', r=True)
        rig.setAttr(SQGRP + '.sx', 0.08)
        rig.setAttr(SQGRP + '.sy', 0.08)
        rig.setAttr(SQGRP + '.sz', 0.337)
        rig.setAttr(SQGRP + '.tz', 0.674)

        TX = self.text(Text)
        TXGRP = rig.group(TX, n=TX + '_TEXT_GRP', r=True)
        rig.setAttr(TXGRP + '.sx', 0.08)
        rig.setAttr(TXGRP + '.sy', 0.08)
        rig.setAttr(TXGRP + '.sz', 0.08)

        if 'up' == sign:
            rig.setAttr(TXGRP + '.tz', 1.519)
        if 'dn' == sign:
            rig.setAttr(TXGRP + '.ry', 90)
            MinZ = rig.xform(TXGRP, q=True, bb=True, ws=True)[2]
            MaxZ = rig.xform(TXGRP, q=True, bb=True, ws=True)[5]
            TZ = ((MaxZ - MinZ) / -2) - 0.2
            rig.setAttr(TXGRP + '.tz', TZ)
        if 'lf' == sign:
            rig.setAttr(TXGRP + '.ry', 90)
            rig.xform(TXGRP,
                      t=[0.34603909286553236, 0.0, 0.67400000000000027],
                      wd=True)
        if 'rt' == sign:
            rig.setAttr(TXGRP + '.ry', 90)
            rig.xform(TXGRP,
                      t=[-0.33073309305179166, 0.0, 0.67400000000000027],
                      wd=True)

        partConGRP = rig.group(TXGRP, SQGRP, ARGRP, n=Text + '_WIDGE_GRP')
        rig.makeIdentity(partConGRP, apply=True, s=True, t=True, r=True)

        rig.transformLimits(AR, tz=(0, 1), etz=(1, 1))
        rig.setAttr(TXGRP + '.overrideEnabled', 1)
        rig.setAttr(TXGRP + '.overrideDisplayType', 2)
        rig.setAttr(SQGRP + '.template', 1)

        if 'DEL' == sign:
            rig.delete(TXGRP)

        return partConGRP, AR
コード例 #19
0
ファイル: initrigset.py プロジェクト: jonntd/mayadev-1
 def rigLegPart(self, side ):
     inverseAim = False
     inverseUp = True
     globalMult = 1
     if side.find( 'R' ) != -1:
         inverseAim= True
         inverseUp = False
         globalMult = -1
         
     hip, knee, ankle, poleV = self.legInitCtlData.getSortList( side )[:4]
     upperLeg, lowerLeg      = self.legInitCtlAdd.getSortList( side )
     
     aimObjectOptions = { 'axis':0, 'upAxis':2, 'inverseAim':inverseAim, 'inverseUp':inverseUp, 'upType':'object', 'upObject':poleV, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
     
     aimObject, anklePoseMltDcmp = rigbase.makeAimObject( ankle, hip, **aimObjectOptions )
     aimObject = cmds.rename( aimObject, aimObject.replace( 'AimObj', 'AimGrp' ) )
     
     rigbase.betweenRigInAimObject( knee, aimObject, dcmp = anklePoseMltDcmp, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
     rigbase.AttrEdit( knee ).lockAttrs( 'ty' )
     
     aimObjectKnee = rigbase.makeAimObject( ankle, knee, **aimObjectOptions )[0]
     aimObjectHip = rigbase.makeAimObject( knee, hip, **aimObjectOptions )[0]
     
     cmds.parent( upperLeg, aimObjectHip )
     cmds.parent( lowerLeg, aimObjectKnee )
     
     upperLegGrp = rigbase.addParent( upperLeg )
     lowerLegGrp = rigbase.addParent( lowerLeg )
     
     upperMtxDcmp = rigbase.getChildMtxDcmp( knee, aimObjectHip )
     lowerMtxDcmp = rigbase.getChildMtxDcmp( ankle, aimObjectKnee )
     upperMultMiddle = cmds.createNode( 'multiplyDivide', n=upperLeg.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
     lowerMultMiddle = cmds.createNode( 'multiplyDivide', n=lowerLeg.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
     
     cmds.connectAttr( upperMtxDcmp+'.ot', upperMultMiddle+'.input1' )
     cmds.connectAttr( lowerMtxDcmp+'.ot', lowerMultMiddle+'.input1' )
     
     cmds.setAttr( upperMultMiddle+'.input2', .5,.5,.5 )
     cmds.setAttr( lowerMultMiddle+'.input2', .5,.5,.5 )
     
     cmds.connectAttr( upperMultMiddle+'.output', upperLegGrp+'.t' )
     cmds.connectAttr( lowerMultMiddle+'.output', lowerLegGrp+'.t' )
     
     cmds.setAttr( upperLegGrp+'.r', 0,0,0 )
     cmds.setAttr( lowerLegGrp+'.r', 0,0,0 )
     
     if side.find( 'L' ) != -1:
         self.outputTransformL = [ aimObjectHip, aimObjectKnee, ankle, poleV ]
         self.outputAddTrL = [ upperLeg, lowerLeg ]
         cmds.transformLimits( knee, tz= [0.01,1], etz=[True, False] )
     else:
         self.outputTransformR = [ aimObjectHip, aimObjectKnee, ankle, poleV ]
         self.outputAddTrR = [ upperLeg, lowerLeg ]
         cmds.transformLimits( knee, tz= [-1,0.01], etz=[False, True] )
コード例 #20
0
ファイル: initrigset.py プロジェクト: jonntd/mayadev-1
 def rigSide(self, side ):
     inverseAim = False
     inverseUp = False
     globalMult = 1
     if side.find( 'R' ) != -1:
         inverseAim = True
         inverseUp = True
         globalMult = -1
         
     shoulder, elbow, wrist, poleV = self.armInitCtlData.getSortList( side )
     upperArm, lowerArm  = self.armInitCtlAdd.getSortList( side )
     
     aimObjectOptions = { 'axis':0, 'upAxis':2, 'inverseAim':inverseAim, 'inverseUp':inverseUp, 'upType':'object', 'upObject':poleV, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
     
     aimObject, wristPoseMltDcmp = rigbase.makeAimObject( wrist, shoulder, **aimObjectOptions )
     aimObject = cmds.rename( aimObject, aimObject.replace( 'AimObj', 'AimGrp' ) )
     
     rigbase.betweenRigInAimObject( elbow, aimObject, dcmp = wristPoseMltDcmp, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
     rigbase.AttrEdit( elbow ).lockAttrs( 'ty' )
     
     aimObjectElbow = rigbase.makeAimObject( wrist, elbow, **aimObjectOptions )[0]
     aimObjectShoulder = rigbase.makeAimObject( elbow, shoulder, **aimObjectOptions )[0]
     
     cmds.parent( upperArm, aimObjectShoulder )
     cmds.parent( lowerArm, aimObjectElbow )
     
     upperArmGrp = rigbase.addParent( upperArm )
     lowerArmGrp = rigbase.addParent( lowerArm )
     
     upperMtxDcmp = rigbase.getChildMtxDcmp( elbow, aimObjectShoulder )
     lowerMtxDcmp = rigbase.getChildMtxDcmp( wrist, aimObjectElbow )
     upperMultMiddle = cmds.createNode( 'multiplyDivide', n=upperArm.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
     lowerMultMiddle = cmds.createNode( 'multiplyDivide', n=lowerArm.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
     
     cmds.connectAttr( upperMtxDcmp+'.ot', upperMultMiddle+'.input1' )
     cmds.connectAttr( lowerMtxDcmp+'.ot', lowerMultMiddle+'.input1' )
     
     cmds.setAttr( upperMultMiddle+'.input2', .5,.5,.5 )
     cmds.setAttr( lowerMultMiddle+'.input2', .5,.5,.5 )
     
     cmds.connectAttr( upperMultMiddle+'.output', upperArmGrp+'.t' )
     cmds.connectAttr( lowerMultMiddle+'.output', lowerArmGrp+'.t' )
     
     cmds.setAttr( upperArmGrp+'.r', 0,0,0 )
     cmds.setAttr( lowerArmGrp+'.r', 0,0,0 )
     
     if side.find( 'L' ) != -1:
         self.outputTransformL = [ aimObjectShoulder, aimObjectElbow, wrist, poleV ]
         self.outputAddTrL = [ upperArm, lowerArm ]
         cmds.transformLimits( elbow, tz= [-1,0.01], etz=[False, True] )
     else:
         self.outputTransformR = [ aimObjectShoulder, aimObjectElbow, wrist, poleV ]
         self.outputAddTrR = [ upperArm, lowerArm ]
         cmds.transformLimits( elbow, tz= [0.01,1], etz=[True, False] )
コード例 #21
0
def cvBaseGuide(ctrlName, r=1):
    """Create a control to be used as a Base Guide control.
        Returns the main control (circle) and the radius control in a list.
    """
    # get radius by checking linear unit
    r = dpCheckLinearUnit(r)
    # create a simple circle curve:
    circle = cmds.circle(n=ctrlName,
                         ch=True,
                         o=True,
                         nr=(0, 0, 1),
                         d=3,
                         s=8,
                         radius=r)[0]
    radiusCtrl = cmds.circle(n=ctrlName + "_RadiusCtrl",
                             ch=True,
                             o=True,
                             nr=(0, 1, 0),
                             d=3,
                             s=8,
                             radius=(r / 4.0))[0]
    # rename curveShape:
    renameShape([circle, radiusCtrl])
    # configure system of limits and radius:
    cmds.setAttr(radiusCtrl + ".translateX", r)
    cmds.parent(radiusCtrl, circle, relative=True)
    cmds.transformLimits(radiusCtrl, tx=(0.01, 1), etx=(True, False))
    setLockHide([radiusCtrl], ['ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
    # find makeNurbCircle history of the circles:
    historyList = findHistory([circle, radiusCtrl], 'makeNurbCircle')
    circleHistory = historyList[0]
    radiusCtrlHistory = historyList[1]
    # rename and make a connection for circle:
    circleHistory = cmds.rename(circleHistory, circle + "_makeNurbCircle")
    cmds.connectAttr(radiusCtrl + ".tx", circleHistory + ".radius", force=True)
    radiusCtrlHistory = cmds.rename(radiusCtrlHistory,
                                    radiusCtrl + "_makeNurbCircle")
    # create a mutiplyDivide in order to automatisation the radius of the radiusCtrl:
    radiusCtrlMD = cmds.createNode('multiplyDivide', name=radiusCtrl + '_MD')
    cmds.connectAttr(radiusCtrl + '.translateX',
                     radiusCtrlMD + '.input1X',
                     force=True)
    cmds.setAttr(radiusCtrlMD + '.input2X', 0.15)
    cmds.connectAttr(radiusCtrlMD + ".outputX",
                     radiusCtrlHistory + ".radius",
                     force=True)
    # colorize curveShapes:
    colorShape([circle, radiusCtrl], 'yellow')
    colorShape([radiusCtrl], 'cyan')
    cmds.setAttr(circle + "Shape.lineWidth", 2)
    cmds.select(clear=True)
    return [circle, radiusCtrl]
コード例 #22
0
ファイル: controllers.py プロジェクト: aterzis/MayaScripts
 def set_limits(self, trans=False, rot=False, scale=False):
     '''
     limit argument is a list of tuples for xyz
     [(xmin, xmax), (ymin, ymax), (zmin, zmax)]
     '''
     if trans:
         cmds.transformLimits(self.name,
                              etx=[True, True],
                              tx=trans[0],
                              ety=[True, True],
                              ty=trans[1],
                              etz=[True, True],
                              tz=trans[2])
コード例 #23
0
ファイル: projectsConfig.py プロジェクト: yazici/fromGod
    def modiUpDnEyelid(prefix, SV, controller, RtV=1):
        UpDnSign = False
        controller.setColor(13)
        if ('_dn' in prefix):
            UpDnSign = True
            controller.setColor(22)

        Lf_up_Cons = [prefix + 'Eyelid_1_M', prefix + 'Eyelid_3_M']
        NewCon = rig.group(controller.SK_b14(prefix + 'Eyelid_M'),
                           n=prefix + 'Eyelid_M_GRP')
        rig.setAttr(NewCon + '.tz', 0.05 * SV)
        rig.setAttr(NewCon + '.rx', 90)
        if UpDnSign:
            rig.setAttr(NewCon + '.sy', -1)
        rig.makeIdentity(NewCon, apply=True, r=True, t=True)
        rig.setAttr(prefix + 'Eyelid_M.sign', 73)
        rig.connectAttr('Jaw_M.vis_second', NewCon + '.visibility')
        M = rig.getAttr(prefix + 'Eyelid_1_M.worldMatrix')
        rig.xform(NewCon, matrix=M)
        rig.parent(NewCon, 'Face_Rigging_GRP')
        rig.pointConstraint(Lf_up_Cons[0].replace('_1_M', '_2_P_FOL'), NewCon)
        rig.hide(Lf_up_Cons[0].replace('_1_M', '_2_M'))

        Lf_up_MD = rig.createNode('multiplyDivide',
                                  n=Lf_up_Cons[0].replace('_1_M', 'MD'),
                                  ss=True)
        rig.setAttr(Lf_up_MD + '.input2X', 0.5)
        rig.setAttr(Lf_up_MD + '.input2Y', 0.5)
        rig.setAttr(Lf_up_MD + '.input2Z', 0.5)
        rig.connectAttr(prefix + 'Eyelid_M.translate', Lf_up_MD + '.input1')
        for i, con in enumerate(Lf_up_Cons):
            sign = -1 * RtV
            if (1 == i):
                sign = 1 * RtV

            PMA = rig.createNode('plusMinusAverage', n=con + '_PMA', ss=True)
            rig.connectAttr(Lf_up_MD + '.output', PMA + '.input3D[0]')
            rig.connectAttr(PMA + '.output3D', con + '_GRP.translate')

            RV = rig.createNode('remapValue', n=con + '_RV', ss=True)
            rig.setAttr(RV + '.inputMin', -30)
            rig.setAttr(RV + '.inputMax', 30)
            rig.setAttr(RV + '.outputMin', -0.08 * sign * SV)
            rig.setAttr(RV + '.outputMax', 0.08 * sign * SV)
            rig.connectAttr(prefix + 'Eyelid_M.rz', RV + '.inputValue')
            rig.connectAttr(RV + '.outValue', PMA + '.input3D[1].input3Dy')
        Lock.hideInvertAttr(
            prefix + 'Eyelid_M',
            ('translateY', 'translateX', 'translateZ', 'rotateZ'))
        rig.transformLimits(prefix + 'Eyelid_M', rz=(-30, 30), erz=(1, 1))
        return NewCon
コード例 #24
0
ファイル: Create.py プロジェクト: miccall/MayaTool
    def FingerLimit(self, side):
        sign = 1
        if side == "L":
            sign = 1
        else:
            sign = -1

        FingerList = "Proxies_" + side + "_Finger***J1"
        FingerJ2 = "Proxies_" + side + "_Finger***J2"
        FingerJ3 = "Proxies_" + side + "_Finger***J3"
        FingerJTip = "Proxies_" + side + "_Finger***JTip"

        cmds.select(FingerList)
        currentSelection = len(cmds.ls(sl=True))
        if currentSelection > 0:
            cmds.select(FingerList)
            finger_J1 = cmds.ls(sl=True)
            for selectedProxy in finger_J1:
                if sign > 0:
                    cmds.transformLimits(selectedProxy, tx=(-0.75, 1), etx=(1, 0))
                else:
                    cmds.transformLimits(selectedProxy, tx=(0, 0.75), etx=(0, 1))

            cmds.select(FingerJ2, FingerJ3, FingerJTip)
            finger_J1 = cmds.ls(sl=True)
            for selectedProxy in finger_J1:
                if sign > 0:
                    cmds.transformLimits(selectedProxy, tx=(-0.5, 1), etx=(1, 0))
                else:
                    cmds.transformLimits(selectedProxy, tx=(0, 0.5), etx=(0, 1))

        pass
コード例 #25
0
    def createGuide(self, *args):
        Base.StartClass.createGuide(self)
        # Custom GUIDE:
        cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
        cmds.setAttr(self.moduleGrp + ".nJoints", 1)

        cmds.setAttr(self.moduleGrp + ".moduleNamespace",
                     self.moduleGrp[:self.moduleGrp.rfind(":")],
                     type='string')

        self.cvJointLoc, shapeSizeCH = self.ctrls.cvJointLoc(
            ctrlName=self.guideName + "_JointLoc1", r=0.3, d=1, guide=True)
        self.connectShapeSize(shapeSizeCH)
        self.jGuide1 = cmds.joint(name=self.guideName + "_JGuide1",
                                  radius=0.001)
        cmds.setAttr(self.jGuide1 + ".template", 1)
        cmds.parent(self.jGuide1, self.moduleGrp, relative=True)

        self.cvEndJoint, shapeSizeCH = self.ctrls.cvLocator(
            ctrlName=self.guideName + "_JointEnd", r=0.2, d=1, guide=True)
        self.connectShapeSize(shapeSizeCH)
        cmds.parent(self.cvEndJoint, self.cvJointLoc)
        cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
        self.jGuideEnd = cmds.joint(name=self.guideName + "_JGuideEnd",
                                    radius=0.001)
        cmds.setAttr(self.jGuideEnd + ".template", 1)
        cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
        self.ctrls.setLockHide([self.cvEndJoint],
                               ['rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

        cmds.parent(self.cvJointLoc, self.moduleGrp)
        cmds.parent(self.jGuideEnd, self.jGuide1)
        self.ctrls.directConnect(self.cvJointLoc, self.jGuide1,
                                 ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
        self.ctrls.directConnect(self.cvEndJoint, self.jGuideEnd,
                                 ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])

        # change the number of falanges to 3:
        self.changeJointNumber(3)

        # create a base cvLoc to start the finger joints:
        self.cvBaseJoint, shapeSizeCH = self.ctrls.cvLocator(
            ctrlName=self.guideName + "_JointLoc0", r=0.2, d=1, guide=True)
        self.connectShapeSize(shapeSizeCH)
        cmds.setAttr(self.cvBaseJoint + ".translateZ", -1)
        cmds.parent(self.cvBaseJoint, self.moduleGrp)

        # transform cvLocs in order to put as a good finger guide:
        cmds.setAttr(self.moduleGrp + ".rotateX", 90)
        cmds.setAttr(self.moduleGrp + ".rotateZ", 90)
コード例 #26
0
ファイル: Joints.py プロジェクト: darkuress/arFace
 def createDetailCtl(self, updn, i):
     """
     draw detail control
     """
     detailCtlP = cmds.group(em =True, n = updn  + 'LipDetailP'+ str(i))
     detailCtl = cmds.circle(n = updn  + 'LipDetail' + str(i), ch=False, o =True, nr =(0, 0, 1), r = 0.05 )
     cmds.parent(detailCtl[0], detailCtlP)
     cmds.setAttr(detailCtl[0]+"Shape.overrideEnabled", 1)
     cmds.setAttr(detailCtl[0]+"Shape.overrideColor", 20)
     cmds.setAttr(detailCtl[0]+'.translate', 0,0,0)
     cmds.transformLimits(detailCtl[0], tx =(-.5, .5), etx=(True, True))
     cmds.transformLimits(detailCtl[0], ty =(-.5, .5), ety=(True, True))
     attTemp = ['scaleX','scaleY','scaleZ', 'rotateX','rotateY','rotateZ', 'tz', 'visibility' ]  
     for y in attTemp:
         cmds.setAttr(detailCtl[0] +"."+ y, lock = True, keyable = False, channelBox =False) 
コード例 #27
0
ファイル: facerig.py プロジェクト: littleTinglan/codeSample
def createController(ctrlName, charName, alignment):
    #Create the limit box
    mc.nurbsSquare(name=charName + '_' + ctrlName + '_limitBox')
    mc.setAttr(charName + '_' + ctrlName + '_limitBox.scaleX', 2.5)
    mc.setAttr(charName + '_' + ctrlName + '_limitBox.scaleY', 2.5)
    mc.makeIdentity(apply=True, scale=True)
    mc.setAttr('top' + charName + '_' + ctrlName + '_limitBox.template', True)
    mc.setAttr('left' + charName + '_' + ctrlName + '_limitBox.template', True)
    mc.setAttr('bottom' + charName + '_' + ctrlName+ '_limitBox.template', True)
    mc.setAttr('right' + charName + '_' + ctrlName+ '_limitBox.template', True)
    
    #Create handle
    ctrlHandleName = charName + '_' + ctrlName + '_ctrl'
    mc.circle(name=ctrlHandleName)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.scaleX', .2)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.scaleY', .2)
    mc.makeIdentity(apply=True, scale=True)
    
    #Limit the handle transform so that it will be only moving within the box
    mc.transformLimits(tx=(-1, 1), etx=(True, True))
    mc.transformLimits(tx=(-1, 1), ety=(True, True))
    #Lock rotation, scale and translate on Z-axis 
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.translateZ', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.rotateX', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.rotateY', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.rotateZ', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.scaleX', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.scaleY', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.scaleZ', lock=True, keyable=False, channelBox=False)
    mc.setAttr(charName + '_' + ctrlName + '_ctrl.visibility', lock=True, keyable=False, channelBox=False)

    #alignment
    if alignment == 'center':
        colorYellow(ctrlHandleName)
    elif alignment == 'right':
        colorRed(ctrlHandleName)
    else:
        colorBlue(ctrlHandleName)

    mc.textCurves(text=ctrlName, name=charName + '_' + ctrlName + '_label_')
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.translateX', -1.2)
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.translateY', 1.3)
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.scaleX', .5)
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.scaleY', .5)
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.scaleZ', .5)
    mc.setAttr(charName + '_' + ctrlName + '_label_Shape.template', True)
    mc.parent(charName + '_' + ctrlName + '_ctrl', charName + '_' + ctrlName + '_label_Shape', charName + '_' + ctrlName + '_limitBox')
コード例 #28
0
ファイル: utils.py プロジェクト: tccoleman/tcTools
def createNodeUntwist(node, twistNodeName, boneAxis=1):
    '''
    createNodeUnTwist('joint1', 'joint1_untwist')
    '''    
    # Set Bone Vector
    boneVec = [0,0,0]
    boneVec[boneAxis] = 1;
    
    # Create untwist joint
    if not MC.objExists(twistNodeName):
        unTwistJnt = MC.duplicate(node)[0]
        unTwistJnt = MC.rename(unTwistJnt, twistNodeName)
        
        if MC.attributeQuery('radius', node=twistNodeName, exists=True):
            MC.setAttr('%s.radius' % twistNodeName, 2)
        MC.delete(MC.listRelatives(unTwistJnt, f=True, children=True))
        
    else:
        raise Exception,'%s node exists, please specify a unique untwist node name' % twistNodeName
        
    # Remove any transform limits on the twist joint   
    MC.transformLimits(twistNodeName, remove=True)
    
    # Set joint's rotateOrder to xyz because the angleBetween node only outputs in xyz order
    MC.setAttr('%s.rotateOrder' % twistNodeName, 0)
    
    # joint orient is included in matrix, so we need another xform to break it out
    rotMat = MC.createNode('transform', name='%s_xf' % twistNodeName, parent=twistNodeName)
    for attr in ['rotateX','rotateY','rotateZ', 'rotateOrder']:
        MC.connectAttr('%s.%s' % (node, attr), '%s.%s' % (rotMat, attr))
    
    rotPt = MC.createNode('pointMatrixMult', name='%s_pmm' % twistNodeName)
    MC.connectAttr('%s.matrix' % rotMat,  '%s.inMatrix' % rotPt)
    MC.setAttr('%s.inPoint' % rotPt, boneVec[0], boneVec[1], boneVec[2])
    MC.setAttr('%s.vectorMultiply' % rotPt, True)
    
    calcRot = MC.createNode('angleBetween', name='%s_angbt' % rotPt)
    MC.setAttr('%s.vector1' % calcRot, boneVec[0], boneVec[1], boneVec[2])
    MC.connectAttr('%s.output' % rotPt, '%s.vector2' % calcRot)
    
    # Get euler rotations and plug back into our untwist node
    for attr in ['X','Y','Z']:
        MC.connectAttr('%s.euler%s' % (calcRot, attr), '%s.rotate%s' % (twistNodeName, attr) )
        MC.connectAttr('%s.scale%s' % (node, attr), '%s.scale%s' % (twistNodeName, attr) )
    
    return twistNodeName
コード例 #29
0
def ConnectControlToBlendshape(controller, blendAttr, clampValue, multiplyer):
	
	cmds.transformLimits(controller.split(".")[0], tx=(-1,1), etx=(True,True))
	
	clampNode = cmds.createNode("clamp", n=blendAttr.replace(".","_")+"_clm")
	if (clampValue>0):
		cmds.setAttr( clampNode+".maxR", clampValue );
	else:
		cmds.setAttr( clampNode+".minR", clampValue );	

	multNode = cmds.createNode("multiplyDivide", n=blendAttr.replace(".","_")+"_mdn")
	cmds.setAttr( multNode+".input2X", multiplyer );

	cmds.connectAttr(controller, clampNode+".inputR" )
	cmds.connectAttr(clampNode+".outputR", multNode+".input1X" )


	cmds.connectAttr(multNode+".outputX", blendAttr )
コード例 #30
0
ファイル: puppet.py プロジェクト: jonntd/Public
 def __setup_main_control(self):
     #--- this method setups the main control
     if not cmds.objExists(self.main_ctl + '.globalScale'):
         attr = attribute.Attribute()
         attr.addAttr(node=self.main_ctl,
                      attrName='globalScale',
                      attrType='double',
                      min=0,
                      default=1)
         #--- connect the scale attributes of the main control with the gs
         for axis in 'xyz':
             attr.connectAttr(node=[self.main_ctl, self.main_ctl],
                              attribute=['globalScale', 's' + axis])
         #--- limit the scale minimum to 0.01
         cmds.transformLimits(self.main_ctl,
                              scaleX=(0.01, 1),
                              scaleY=(0.01, 1),
                              scaleZ=(0.01, 1),
                              enableScaleX=(1, 0),
                              enableScaleY=(1, 0),
                              enableScaleZ=(1, 0))
         #--- lock the scale attributes of the main control
         attr.lockAttr(node=self.main_ctl, attribute=['s'])
     if not cmds.objExists(self.main_ctl + '.displayType'):
         attr = attribute.Attribute()
         attr.addAttr(node=self.main_ctl,
                      attrName='displayType',
                      attrType='enum',
                      enum=['normal', 'template', 'reference'])
         #--- connect the meshes
         for i in cmds.ls(type='mesh'):
             if cmds.objExists(i):
                 attr.setAttr(node=i,
                              attribute=['overrideEnabled'],
                              value=1,
                              lock=True)
                 attr.connectAttr(node=[self.main_ctl, i],
                                  attribute=[
                                      'displayType',
                                      'drawOverride.overrideDisplayType'
                                  ])
         attr.setAttr(node=self.main_ctl,
                      attribute=['displayType'],
                      value=2)
コード例 #31
0
def connectIrisPupil():
    #连接 Iris Pupil连个属性并删除形状节点 使用方法选择两个眼睛控制器 然后执行命令
    sls = mc.ls(sl=True)
    size = len(sls)
    if size==0:
        print "No ctrl selected!"
        return
    for idx,tCtl in enumerate(sls):
        lr = "L" if re.search("L$",tCtl)!=None else "R"
        sCtl = lr+"_eyeBall_ctrl"
        sAtrs = ["iris","pupil"]
        tAtrs = ["IrisControl","PupilControl"]
        for n,atr in enumerate(sAtrs):
            sAtr = sCtl+"."+atr
            tAtr = tCtl+"."+tAtrs[n]
            sValue = mc.getAttr( sAtr )
            tValue = mc.getAttr( tAtr )
            pmaNode = mc.createNode("plusMinusAverage",name=tCtl+atr+"_pma")
            mc.connectAttr(sAtr,pmaNode+".input1D[0]")
            mc.setAttr(".input1D[1]",tValue-sValue)
            mc.connectAttr(".output1D",tAtr)
        sAtrs = ["sx","sy"]
        tAtrs = ["iris_scalX","iris_scalY"]
        for n,atr in enumerate(sAtrs):
            sAtr = sCtl+"."+atr
            tAtr = tCtl+"."+tAtrs[n]
            if mc.objExists(tAtr):
                attributesCls.setDrivenKey(tAtr,dv=[1,0],v=[0,-10],cd=sAtr,itt="linear",ott="linear",ift=["constant","constant"])
        mc.transformLimits(sCtl,sx=[-1,1],esx=[0,1])
        mc.transformLimits(sCtl,sy=[-1,1],esy=[0,1])
        #Delete shapes
        sps = mc.listRelatives(tCtl,s=True)
        if sps!=None and sps!=[]:
            for shp in sps:
                mc.setAttr("%s.intermediateObject"%shp,1)
            #mc.delete( sps )
        eyeballJnt = lr+"_eyeBall_jnt"
        mc.delete( mc.pointConstraint(eyeballJnt,tCtl) )
        #mc.parent(tCtl,eyeballJnt)
#import rig_ch.facialSystem.replaceEyeball as rpe
#reload(rpe)
#rpe.eyebalRder("Anim")
#rpe.eyebalRder("Render")
#rpe.connectIrisPupil()
コード例 #32
0
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.setAttr(self.moduleGrp + ".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
     cmds.setAttr(self.moduleGrp + ".nJoints", 1)
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName + "_JointLoc1", r=0.5)
     self.connectShapeSize(shapeSizeCH)
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     # Edit GUIDE:
     cmds.setAttr(self.moduleGrp + ".rx", -90)
     cmds.setAttr(self.moduleGrp + ".ry", -90)
     cmds.setAttr(self.moduleGrp + "_RadiusCtrl.tx", 4)
コード例 #33
0
ファイル: transformData.py プロジェクト: sniler/maya-ml-rivet
def getAttrDict(controlList, attrList=['tx', 'ty', 'tz']):
    controlsDict = dict()
    for control, attribute, in itertools.product(controlList, attrList):
        if not cmds.getAttr('{}.{}'.format(control, attribute), k=1):
            continue
        flags = {'q': 1}
        flags[attribute] = 1
        limits = cmds.transformLimits(control, **flags)
        currDict = controlsDict.setdefault(control, {})
        currDict[attribute] = limits
    return controlsDict
コード例 #34
0
ファイル: initrigset.py プロジェクト: jonntd/mayadev-1
 def rigEachPart( self, index, side ):
     outputTransform = []
     
     inverseAim = False
     globalMult = 1
     if side.find( 'R' ) != -1:
         inverseAim = True
         globalMult = -1
         
     aimObjectOptions = { 'axis':0, 'inverseAim':inverseAim, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
     
     fingerInitCtlNameList = self.fingerInitCtlData.getEachFingerList( index, side )
     
     firstFingerInitCtl = fingerInitCtlNameList[0]
     secondFingerInitCtl = fingerInitCtlNameList[1]
     betweenFingerInitCtls = fingerInitCtlNameList[2:-1]
     endFingerInitCtl = fingerInitCtlNameList[-1]
     
     aimObject0= rigbase.makeAimObject( secondFingerInitCtl, firstFingerInitCtl, **aimObjectOptions )[0]
     outputTransform.append( aimObject0 )
     aimObject1 = rigbase.makeAimObject( endFingerInitCtl, secondFingerInitCtl, **aimObjectOptions )[0]
     aimObject1 = cmds.rename( aimObject1, aimObject1.replace( 'AimObj', 'AimGrp' ) )
     
     rigbase.betweenRigInAimObject( betweenFingerInitCtls, aimObject1, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
     
     for fingerInitCtl in betweenFingerInitCtls:
         rigbase.AttrEdit( fingerInitCtl ).lockAttrs( 'tz' )
         if side.find( 'L' ) != -1:
             cmds.transformLimits( fingerInitCtl, ty= [0.01,1], ety=[True, False] )
         else:
             cmds.transformLimits( fingerInitCtl, ty= [-1,0.01], ety=[False, True] )
     betweenFingerInitCtls.append( endFingerInitCtl )
         
     aimObjectParent = secondFingerInitCtl
     for fingerInitCtl in betweenFingerInitCtls:
         aimObject = rigbase.makeAimObject( fingerInitCtl, aimObjectParent, **aimObjectOptions )[0]
         aimObjectParent = fingerInitCtl
         outputTransform.append( aimObject )
     
     outputTransform.append( endFingerInitCtl )
     return outputTransform
コード例 #35
0
def lockAndScaleJoyStick(thingToLock):

	print minValueToInject

	intFieldMin = cmds.intField(minCtrlValue, query=True, value=True)#get user input
	
	intFieldMax = cmds.intSliderGrp(maxCtrlValue, query=True, value=True)#get user input

	cmds.transformLimits(thingToLock, tx=[( -(intFieldMax)), intFieldMax], etx=[1, 1])

	cmds.transformLimits(thingToLock, ty=[( -(intFieldMax)), intFieldMax], ety=[1, 1])


	# parent("joyStickCtrlTmp", "JoystickBoxTmp")

	scaleToX("JoystickBoxTmp", intFieldMax)
	scaleToY("JoystickBoxTmp", intFieldMax)

	scaleToX("joyStickCtrlTmp", intFieldMax)
	scaleToY("joyStickCtrlTmp", intFieldMax)

	sel("joyStickCtrlTmp")
	selAdd("JoystickBoxTmp")

	freeze()

	parent("joyStickCtrlTmp", "JoystickBoxTmp")

	floatFieldMax = float(intFieldMax)

	scaleRatioMax = floatFieldMax / (floatFieldMax*floatFieldMax)

	scaleAll("JoystickBoxTmp", scaleRatioMax)

	#freeze()
	lockAllButTxAndTy("joyStickCtrlTmp")

	cmds.rename("joyStickCtrlTmp", "Controler")

	cmds.rename("JoystickBoxTmp", "Joystick")
コード例 #36
0
ファイル: dpFinger.py プロジェクト: renaudll/dpAutoRigSystem
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
     cmds.setAttr(self.moduleGrp+".nJoints", 1)
     
     cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
     cmds.setAttr(self.jGuide1+".template", 1)
     cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
     
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.2)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint+".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd+".template", 1)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     cmds.parent(self.jGuideEnd, self.jGuide1)
     ctrls.directConnect(self.cvJointLoc, self.jGuide1, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     ctrls.directConnect(self.cvEndJoint, self.jGuideEnd, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     
     # change the number of falanges to 3:
     self.changeJointNumber(3)
     
     # create a base cvLoc to start the finger joints:
     self.cvBaseJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointLoc0", r=0.2)
     self.connectShapeSize(shapeSizeCH)
     cmds.setAttr(self.cvBaseJoint+".translateZ", -1)
     cmds.parent(self.cvBaseJoint, self.moduleGrp)
     
     # transform cvLocs in order to put as a good finger guide:
     cmds.setAttr(self.moduleGrp+".rotateX", 90)
     cmds.setAttr(self.moduleGrp+".rotateZ", 90)
コード例 #37
0
ファイル: puppet.py プロジェクト: jonntd/Public
 def __setup_main_control(self):
     #--- this method setups the main control
     if not cmds.objExists(self.main_ctl + '.globalScale'):
         attr = attribute.Attribute()
         attr.addAttr(node= self.main_ctl, 
                      attrName = 'globalScale', 
                      attrType = 'double', 
                      min = 0, 
                      default = 1)
         #--- connect the scale attributes of the main control with the gs
         for axis in 'xyz':
             attr.connectAttr(node = [self.main_ctl, self.main_ctl], 
                              attribute = ['globalScale', 's' + axis])
         #--- limit the scale minimum to 0.01
         cmds.transformLimits(self.main_ctl, 
                              scaleX = (0.01,1),
                              scaleY = (0.01,1),
                              scaleZ = (0.01,1),
                              enableScaleX = (1,0),
                              enableScaleY = (1,0),
                              enableScaleZ = (1,0))
         #--- lock the scale attributes of the main control
         attr.lockAttr(node = self.main_ctl, 
                       attribute = ['s'])
     if not cmds.objExists(self.main_ctl + '.displayType'):
         attr = attribute.Attribute()
         attr.addAttr(node= self.main_ctl, 
                      attrName = 'displayType',
                      attrType = 'enum', 
                      enum = ['normal', 'template', 'reference'])
         #--- connect the meshes
         for i in cmds.ls(type='mesh'):
             if cmds.objExists(i):
                 attr.setAttr(node=i, attribute=['overrideEnabled'], value=1, lock=True)
                 attr.connectAttr(node=[self.main_ctl, i], 
                                  attribute=['displayType',
                                            'drawOverride.overrideDisplayType'])
         attr.setAttr(node=self.main_ctl, attribute=['displayType'], value=2)
コード例 #38
0
def setTranslateLimits(ctrl, tx=True, ty=True, tz=True):
    """
	"""
    if tx:
        mc.transformLimits(ctrl, tx=(-1.0, 1.0), etx=(1, 1))
    if ty:
        mc.transformLimits(ctrl, ty=(-1.0, 1.0), ety=(1, 1))
    if tz:
        mc.transformLimits(ctrl, tz=(-1.0, 1.0), etz=(1, 1))
コード例 #39
0
def getTransformLimits(primaryJoints, defaultAngle=90):
    """
    get transform Limits for uniform sampling
    :param primaryJoints: list(str), primary joint list
    :return:dict, joints transform limits
    """
    transformLimits = {}

    for joint in primaryJoints:
        transformLimits[joint] = {}
        transformLimits[joint]['.rx'] = []
        transformLimits[joint]['.ry'] = []
        transformLimits[joint]['.rz'] = []

        # rotate X
        attrList = cmds.transformLimits(joint, q=1, erx=1)
        for i in range(len(attrList)):
            if attrList[i]:
                transformLimits[joint]['.rx'].append(
                    cmds.transformLimits(joint, q=1, rx=1)[i])
            else:
                if not i:
                    transformLimits[joint]['.rx'].append(-defaultAngle)
                else:
                    transformLimits[joint]['.rx'].append(defaultAngle)

        # rotate Y
        attrList = cmds.transformLimits(joint, q=1, ery=1)
        for i in range(len(attrList)):
            if attrList[i]:
                transformLimits[joint]['.ry'].append(
                    cmds.transformLimits(joint, q=1, ry=1)[i])
            else:
                if not i:
                    transformLimits[joint]['.ry'].append(-defaultAngle)
                else:
                    transformLimits[joint]['.ry'].append(defaultAngle)

        # rotate Z
        attrList = cmds.transformLimits(joint, q=1, erz=1)
        for i in range(len(attrList)):
            if attrList[i]:
                transformLimits[joint]['.rz'].append(
                    cmds.transformLimits(joint, q=1, rz=1)[i])
            else:
                if not i:
                    transformLimits[joint]['.rz'].append(-defaultAngle)
                else:
                    transformLimits[joint]['.rz'].append(defaultAngle)

    return transformLimits
コード例 #40
0
def VerticalSlider(*args):

    #General Info
    Name = cmds.textFieldGrp(NameGRP, q=True, text=True) + 'VSlider'
    Size = cmds.intSliderGrp(SizeSlider, q=True, v=5)
    print Size
    Color = 16

    #InnerForm
    Circulo = cmds.circle(n=Name)

    #Top
    cmds.select(str(Circulo[0]) + '.cv[0:2]')
    cmds.scale(1, 1e-05, 1, r=True, p=(0, 0.945903, 0))

    #Buttom
    cmds.select(str(Circulo[0]) + '.cv[4:6]')
    cmds.scale(1, 1e-05, 1, r=True, p=(0, -0.945903, 0))

    #Left
    cmds.select(str(Circulo[0]) + '.cv[6:7]', str(Circulo[0]) + '.cv[0]')
    cmds.scale(1e-05, 1, 1, r=True, p=(0.945903, 0, 0))

    #Right
    cmds.select(str(Circulo[0]) + '.cv[2:4]')
    cmds.scale(1e-05, 1, 1, r=True, p=(-0.945903, 0, 0))

    #Color
    cmds.setAttr('%s.overrideEnabled' % (Circulo[0]), 1)
    cmds.setAttr('%s.overrideColor' % (Circulo[0]), Color)

    #MoverController

    cmds.select(cl=True)

    CirculoMover = cmds.duplicate(Circulo[0], n='%s_Mover' % (Circulo[0]))
    CirculoMoverGrupo = cmds.group(CirculoMover,
                                   n='%s_GRP' % (CirculoMover[0]))

    CirculoGrupo = cmds.group(Circulo, n='%s_GRP' % (Circulo[0]))

    #CorrectScale
    cmds.xform('%s' % (CirculoMoverGrupo), s=(1.2, Size + 1.2, 1.2), r=True)

    #Organizing and limit Info

    cmds.parent(CirculoGrupo, CirculoMover)
    cmds.select(Circulo[0])
    cmds.transformLimits(tx=(0, 0), etx=(1, 1))
    cmds.transformLimits(ty=(-Size, Size), ety=(1, 1))
    cmds.transformLimits(tz=(0, 0), etz=(1, 1))
コード例 #41
0
ファイル: RangeToolUI.py プロジェクト: darkuress/arFace
 def locadCtl(self, *args):
     """
     """
     ctls = cmds.ls(sl=True, fl =1, type = 'transform')
     
     tx = cmds.transformLimits(ctls[-1], tx = True, q = True)
     ty = cmds.transformLimits(ctls[-1], ty = True, q = True)
     tz = cmds.transformLimits(ctls[-1], tz = True, q = True)
     rx = cmds.transformLimits(ctls[-1], rx = True, q = True)
     ry = cmds.transformLimits(ctls[-1], ry = True, q = True)
     rz = cmds.transformLimits(ctls[-1], rz = True, q = True)
     
     cmds.floatField(self.txMinFloatField, e = True, v = tx[0])
     cmds.floatField(self.txMaxFloatField, e = True, v = tx[1])
     cmds.floatField(self.tyMinFloatField, e = True, v = ty[0])
     cmds.floatField(self.tyMaxFloatField, e = True, v = ty[1])
     cmds.floatField(self.tzMinFloatField, e = True, v = tz[0])
     cmds.floatField(self.tzMaxFloatField, e = True, v = tz[1])
     cmds.floatField(self.rxMinFloatField, e = True, v = rx[0])
     cmds.floatField(self.rxMaxFloatField, e = True, v = rx[1])
     cmds.floatField(self.ryMinFloatField, e = True, v = ry[0])
     cmds.floatField(self.ryMaxFloatField, e = True, v = ry[1])
     cmds.floatField(self.rzMinFloatField, e = True, v = rz[0])
     cmds.floatField(self.rzMaxFloatField, e = True, v = rz[1])
コード例 #42
0
def makeRotateInfoForOneJoint(joint):
    #- create sets
    TempCircle = mc.circle(r=1, ch=False)
    TempLine = mc.curve(d=1, p=((-1, 1, 0), (-1, -1, 0), (1, -1, 0), (1, 1, 0), (-1, 1, 0)))

    BaseLoc = mc.spaceLocator(p=(0,0,0), name='%s_RIF_Baseloc'%joint.rsplit('_', 2)[0])[0]
    AimLoc = mc.spaceLocator(p=(0,0,0), name='%s_RIF_aimLoc'%joint.rsplit('_', 2)[0])[0]

    grp = mc.group(TempCircle, TempLine, BaseLoc, AimLoc, name='%s_RIF_G'%joint.rsplit('_', 2)[0])

    #- set Temp Curve Template
    for temp in (TempCircle, TempLine):
        shape = mc.listRelatives(temp, s=True, path=True)
        mc.setAttr('%s.ove'%shape[0], 1)
        mc.setAttr('%s.ovdt'%shape[0], 1)

    #- lock attributes
    for attr in mc.listAttr(BaseLoc, k=True):
        if attr in ('translateX', 'translateY'):
            continue
        mc.setAttr('%s.%s'%(BaseLoc, attr), l=True, k=False)

    #- limit Translate
    mc.transformLimits(BaseLoc, tx=(-1, 1), ty=(-1, 1), etx=(True, True), ety=(True, True))
    mc.pointConstraint(AimLoc, BaseLoc, skip='z')


    #- add Atributes
    for attr in ('x', 'y', 'ypxp', 'ypxn', 'ynxp', 'ynxn', 'up', 'down', 'left', 'right'):
        mc.addAttr(grp, sn=attr, k=True)

    #- comp connections
    #- 1
    mc.connectAttr('%s.tx'%BaseLoc, '%s.x'%grp)
    mc.connectAttr('%s.ty'%BaseLoc, '%s.y'%grp)

    #- 2
    Values = ('ypxp', 0.707,0.707), ('ypxn', -0.707,0.707), ('ynxp', 0.707,-0.707), ('ynxn', -0.707,-0.707)
    for Attr, x, y in Values:
        node = mc.createNode('multDoubleLinear')
        mc.setDrivenKeyframe('%s.i1'%node, cd='%s.tx'%BaseLoc, dv=0, v=0, itt='linear', ott='linear')
        mc.setDrivenKeyframe('%s.i1'%node, cd='%s.tx'%BaseLoc, dv=x, v=1, itt='linear', ott='linear')
        mc.setDrivenKeyframe('%s.i2'%node, cd='%s.ty'%BaseLoc, dv=0, v=0, itt='linear', ott='linear')
        mc.setDrivenKeyframe('%s.i2'%node, cd='%s.ty'%BaseLoc, dv=y, v=1, itt='linear', ott='linear')
        mc.connectAttr('%s.o'%node, '%s.%s'%(grp, Attr))

    #- 3
    # to line 71

    #- match Position
    mc.delete(mc.parentConstraint(joint, grp))
    JntChildren = mc.listRelatives(joint, c=True, path=True, type='joint')
    if not JntChildren:return
    mc.delete(mc.aimConstraint(JntChildren, grp, aim=(0,0,1), u=(0,1,0)))
    mc.delete(mc.pointConstraint(JntChildren, AimLoc))
    mc.parentConstraint(joint, AimLoc, mo=True)

    #- match Scale
    startPosi = mc.xform(grp, q=True, ws=True, rp=True)
    endPosi = mc.xform(AimLoc , q=True, ws=True, rp=True)
    Dis = math.sqrt((startPosi[0] - endPosi[0]) ** 2 + (startPosi[1] - endPosi[1]) ** 2 + (startPosi[2] - endPosi[2]) ** 2)
    mc.setAttr(grp + '.sx', Dis)
    mc.setAttr(grp + '.sy', Dis)
    mc.setAttr(grp + '.sz', Dis)


    #- connect line 52
    Expstrings = '\
    $Ah = %s.ty;\n\
    $Aw = %s.tx;\n\
    $C = %s;\n\
    %s.%s = clamp(0, 180,  90 - acos($Ah / $C) * 180 / 3.14159265359);\n\
    %s.%s = clamp(-180, 0, 90 - acos($Ah / $C) * 180 / 3.14159265359);\n\
    %s.%s = clamp(0, 180,  90 - acos($Aw / $C) * 180 / 3.14159265359);\n\
    %s.%s = clamp(-180, 0, 90 - acos($Aw / $C) * 180 / 3.14159265359);\n\
    '%(BaseLoc, BaseLoc, mc.getAttr('%s.tz'%AimLoc),  grp, 'up', grp, 'down', grp, 'left', grp, 'right')
    mc.expression(s=Expstrings)
    #---------------------------------------------------------------------------------------



    # connect attbutes to prefs_grp
    if not mc.objExists('prefs_grp'):return
    typ = joint.rsplit('_', 2)[0]
    mc.addAttr('prefs_grp', sn=typ, k=True)
    mc.setAttr('prefs_grp.' + typ, l=True)
    for Attr in mc.listAttr(grp, ud=True):
        mc.addAttr('prefs_grp', sn=typ + Attr, k=True)
        mc.connectAttr('%s.%s'%(grp, Attr), 'prefs_grp.%s%s'%(typ , Attr))

    return grp, AimLoc
コード例 #43
0
def setMinMax(*args):
    selObjList = cmds.ls(sl=True)
    selAttrList = cmds.channelBox('mainChannelBox',
                                  q=True,
                                  selectedMainAttributes=True)
    minVal = cmds.floatField('minFloatFld', q=True, v=True)
    maxVal = cmds.floatField('maxFloatFld', q=True, v=True)
    minChkOpt = cmds.checkBox('minChkBox', q=True, v=True)
    maxChkOpt = cmds.checkBox('maxChkBox', q=True, v=True)

    for obj in selObjList:
        userDefAttrs = cmds.listAttr(obj, ud=True)
        for attr in selAttrList:
            # If exists user define attribute do following.
            if userDefAttrs and attr in userDefAttrs:
                if minChkOpt:
                    cmds.addAttr('%s.%s' % (obj, attr),
                                 e=True,
                                 hasMinValue=True,
                                 min=minVal)
                elif not minChkOpt:
                    cmds.addAttr('%s.%s' % (obj, attr),
                                 e=True,
                                 hasMinValue=False)
                if maxChkOpt:
                    cmds.addAttr('%s.%s' % (obj, attr),
                                 e=True,
                                 hasMaxValue=True,
                                 max=maxVal)
                elif not maxChkOpt:
                    cmds.addAttr('%s.%s' % (obj, attr),
                                 e=True,
                                 hasMaxValue=False)

            # If there is no user define attribute do following.
            else:
                if attr == 'tx':
                    cmds.transformLimits(obj,
                                         tx=(minVal, maxVal),
                                         etx=(minChkOpt, maxChkOpt))
                elif attr == 'ty':
                    cmds.transformLimits(obj,
                                         ty=(minVal, maxVal),
                                         ety=(minChkOpt, maxChkOpt))
                elif attr == 'tz':
                    cmds.transformLimits(obj,
                                         tz=(minVal, maxVal),
                                         etz=(minChkOpt, maxChkOpt))
                elif attr == 'rx':
                    cmds.transformLimits(obj,
                                         rx=(minVal, maxVal),
                                         erx=(minChkOpt, maxChkOpt))
                elif attr == 'ry':
                    cmds.transformLimits(obj,
                                         ry=(minVal, maxVal),
                                         ery=(minChkOpt, maxChkOpt))
                elif attr == 'rz':
                    cmds.transformLimits(obj,
                                         rz=(minVal, maxVal),
                                         erz=(minChkOpt, maxChkOpt))
                elif attr == 'sx':
                    cmds.transformLimits(obj,
                                         sx=(minVal, maxVal),
                                         esx=(minChkOpt, maxChkOpt))
                elif attr == 'sy':
                    cmds.transformLimits(obj,
                                         sy=(minVal, maxVal),
                                         esy=(minChkOpt, maxChkOpt))
                elif attr == 'sz':
                    cmds.transformLimits(obj,
                                         sz=(minVal, maxVal),
                                         esz=(minChkOpt, maxChkOpt))
コード例 #44
0
def setTranslateLimits(ctrl, tx=True, ty=True, tz=True):
    """
    """
    if (tx): cmds.transformLimits(ctrl, tx=(-1.0, 1.0), etx=(1, 1))
    if (ty): cmds.transformLimits(ctrl, ty=(-1.0, 1.0), ety=(1, 1))
    if (tz):   cmds.transformLimits(ctrl, tz=(-1.0, 1.0), etz=(1, 1))
コード例 #45
0
ファイル: RangeToolUI.py プロジェクト: darkuress/arFace
    def ctlSetLimits(self, *args):
        """
        """
        ctls = cmds.ls(sl=1, fl =1, type = 'transform')

        posTx = cmds.floatField(self.txMaxFloatField, q = True, v = True)
        negTx = cmds.floatField(self.txMinFloatField, q = True, v = True) 
        posTy = cmds.floatField(self.tyMaxFloatField, q = True, v = True) 
        negTy = cmds.floatField(self.tyMinFloatField, q = True, v = True) 
        posTz = cmds.floatField(self.tzMaxFloatField, q = True, v = True) 
        negTz = cmds.floatField(self.tzMinFloatField, q = True, v = True)
        posRx = cmds.floatField(self.rxMaxFloatField, q = True, v = True) 
        negRx = cmds.floatField(self.rxMinFloatField, q = True, v = True) 
        posRy = cmds.floatField(self.ryMaxFloatField, q = True, v = True) 
        negRy = cmds.floatField(self.ryMinFloatField, q = True, v = True) 
        posRz = cmds.floatField(self.rzMaxFloatField, q = True, v = True) 
        negRz = cmds.floatField(self.rzMinFloatField, q = True, v = True)
        
        for c in ctls:
            #set translate limits 
            if cmds.getAttr(c +'.translateX', lock =1) == False:
                cmds.transformLimits(c, translationX = (negTx, posTx), etx = (1,1)) 
            if cmds.getAttr(c +'.translateY', lock =1) == False:
                cmds.transformLimits(c, translationY = (negTy, posTy), ety =(1,1))
            if cmds.getAttr(c +'.translateZ', lock =1) == False:
                cmds.transformLimits(c, translationZ = (negTz, posTz), etz =(1,1))
            
            #set rotate limits
            if cmds.getAttr(c +'.rotateX', lock =1) == False:
                cmds.transformLimits(c, rotationX = (negRx, posRx), erx =(1,1))
            if cmds.getAttr(c +'.rotateX', lock =1) == False:
                cmds.transformLimits(c, rotationY = (negRy, posRy), ery =(1,1))        
            if cmds.getAttr(c +'.rotateX', lock =1) == False:
                cmds.transformLimits(c, rotationZ = (negRz, posRz), erz =(1,1))
コード例 #46
0
def setup_reverse_foot(ball_jnt):
    """
    makes the reverse foot

    :param ball_jnt: name of the ball joint
    :type: str
    """
    #gets the children of the ball joint
    all_children = cmds.listRelatives(ball_jnt, allDescendents=True)
    toes = []
    rev_jnts = {}
    for child in all_children:
        #seperate the reverse foot joints from the toes
        if child.find('__REVERSE__') != -1:
            if child.find('heel') != -1:
                rev_jnts['heel'] = child
            elif child.find('bankIn') != -1:
                rev_jnts['bankIn'] = child
            elif child.find('bankOut') != -1:
                rev_jnts['bankOut'] = child
            elif child.find('toe') != -1:
                rev_jnts['toe'] = child
        else:
            toes.append(child)

    #get the ankle jnt
    ankle_jnt = cmds.listRelatives(ball_jnt, parent=True)[0]

    #add ankle and ball to the rev_jnts dict
    rev_jnts['ankle'] = ankle_jnt
    rev_jnts['ball'] = ball_jnt

    #for each rev jnt make the empty group at the correct position
    rev_grps = {}
    for item in rev_jnts:
        #get the group name
        grp_name_temp = rev_jnts[item].replace('__REVERSE__', '')
        grp_name = grp_name_temp.replace(NamingConventionEnums.JOINT_SUFFIX,
                                         NamingConventionEnums.GROUP_SUFFIX)
        #make the group
        cmds.group(empty=True, name=grp_name)
        gu.place_on(grp_name, rev_jnts[item])
        cmds.makeIdentity(grp_name,
                          apply=True,
                          translate=True,
                          rotate=True,
                          scale=True,
                          normal=False,
                          preserveNormals=1)
        #adds the group to the new dict to set up the hierarchy
        rev_grps[item] = grp_name

    #deletes the extra rev joints
    for item in rev_jnts:
        if rev_jnts[item].find('__REVERSE__') != -1 and cmds.objExists(
                rev_jnts[item]):
            cmds.delete(rev_jnts[item])

    #grabs the ik control and the actual ik to setup hierarchy
    ik_cc = ankle_jnt.replace(
        NamingConventionEnums.JOINT_SUFFIX,
        '_IK' + NamingConventionEnums.CONTROL_CURVE_SUFFIX)
    ik_handle = ankle_jnt.replace(NamingConventionEnums.JOINT_SUFFIX, '_RPIK')

    #setup the hierarchy
    cmds.parent(ik_handle, rev_grps['ankle'])
    cmds.parent(rev_grps['ankle'], rev_grps['ball'])
    cmds.parent(rev_grps['ball'], rev_grps['toe'])
    cmds.parent(rev_grps['toe'], rev_grps['heel'])
    cmds.parent(rev_grps['heel'], rev_grps['bankOut'])
    cmds.parent(rev_grps['bankOut'], rev_grps['bankIn'])
    rev_grp = cmds.group(rev_grps['bankIn'],
                         name=rev_grps['bankIn'].replace('bankIn', 'revFoot'))
    cmds.parent(rev_grp, ik_cc)

    #get the foot controller with the rev controls on it and parent it to the ankle
    side = ball_jnt.split('_', 1)[0]
    foot_cc = side + '_foot' + NamingConventionEnums.CONTROL_CURVE_SUFFIX
    foot_cc_grp = cmds.listRelatives(foot_cc, parent=True)[0]

    #dupelicate the ankle joint and parent the dupe and ball under the old ankle
    dupe = cmds.duplicate(ankle_jnt, renameChildren=True)
    to_delete = cmds.listRelatives(dupe[0], allDescendents=True)
    cmds.delete(to_delete)
    new_name = dupe[0].replace(NamingConventionEnums.JOINT_SUFFIX,
                               NamingConventionEnums.BIND_JOINT_SUFFIX)
    new_name = new_name.replace('1', '')
    ankle_dupe = cmds.rename(dupe[0], new_name)
    #parent the ball under the new ankle and the new ankle under the original
    cmds.parent(ankle_dupe, ankle_jnt)
    cmds.parent(ball_jnt, ankle_dupe)
    cmds.parent(foot_cc_grp, ankle_dupe)

    #find the fk ankle
    fk_ankle = ankle_jnt.replace(NamingConventionEnums.JOINT_SUFFIX,
                                 '_FK' + NamingConventionEnums.JOINT_SUFFIX)

    #get the reverse node from the ikfk switch
    rev_node = ankle_jnt + '_REV'

    #get the ball controller and make a buffer group for it
    ball_cc = ball_jnt.replace(
        NamingConventionEnums.JOINT_SUFFIX,
        '_FK' + NamingConventionEnums.CONTROL_CURVE_SUFFIX)
    gu.unlock_all_channels(ball_cc)
    ball_cc_grp = gu.create_buffer(ball_cc)
    for channel in NamingConventionEnums.LOCK_CHANNLES['ball']:
        gu.lock_channels(ball_cc, channel)

    #makes the single chain ik solver on the foot so the ball follows properly
    cmds.select(ball_jnt, replace=True)
    cmds.select(ankle_dupe, add=True)
    ik_names = cmds.ikHandle(solver='ikSCsolver')
    #rename the ikhandle and the effector
    base = ball_jnt.rsplit('_', 1)[0]
    ik_handle = cmds.rename(ik_names[0], base + '_SCIK')
    cmds.rename(ik_names[1], base + '_Effector')
    #parent the constrain the ik handle to follow the proper objs depending on ik or fk
    const_name = ik_handle + NamingConventionEnums.CONSTRAIN_SUFFIX
    gu.parent_const([fk_ankle, rev_grps['ball']],
                    ik_handle,
                    const_name,
                    maintain_offset=True)
    #connect the weights of the two constraints to the ik fk switch
    cmds.connectAttr(foot_cc + '.ikFkSwitch',
                     const_name + '.' + rev_grps['ball'] + 'W1')
    cmds.connectAttr(rev_node + '.outputX', const_name + '.' + fk_ankle + 'W0')

    #constrain the ball control to the ball jnt
    gu.orient_const(ball_cc,
                    ball_jnt,
                    ball_jnt + NamingConventionEnums.CONSTRAIN_SUFFIX,
                    maintain_offset=True)
    ball_grp_const = ball_cc_grp + NamingConventionEnums.CONSTRAIN_SUFFIX
    gu.parent_const([fk_ankle, rev_grps['toe']],
                    ball_cc_grp,
                    ball_grp_const,
                    maintain_offset=True)
    #connect the weights of the ball grp's two constraints to the ik fk switch
    cmds.connectAttr(foot_cc + '.ikFkSwitch',
                     ball_grp_const + '.' + rev_grps['toe'] + 'W1')
    cmds.connectAttr(rev_node + '.outputX',
                     ball_grp_const + '.' + fk_ankle + 'W0')

    #connect all of the rev attrs from the foot control to the objs
    #create a new plusMinusAverage node so i dont have have to connect ikfk switch
    # into all 3 channels on the multiplyDivide nodes everytime
    pass_node = cmds.shadingNode('plusMinusAverage',
                                 asUtility=True,
                                 name=foot_cc + '_Pass_PMA')
    cmds.connectAttr(foot_cc + '.ikFkSwitch',
                     pass_node + '.input3D[0].input3Dx')
    cmds.connectAttr(foot_cc + '.ikFkSwitch',
                     pass_node + '.input3D[0].input3Dy')
    cmds.connectAttr(foot_cc + '.ikFkSwitch',
                     pass_node + '.input3D[0].input3Dz')

    #make first mult and connect the ikfk pass node to it
    mult01 = cmds.shadingNode('multiplyDivide',
                              asUtility=True,
                              name=foot_cc + '_onOff_MULT')
    cmds.connectAttr(pass_node + '.output3D', mult01 + '.input2')
    #connect the rev controls to the mult now and the mult to the group
    #ball roll
    cmds.connectAttr(foot_cc + '.ballRoll', mult01 + '.input1X')
    cmds.connectAttr(mult01 + '.outputX',
                     rev_grps['ball'] + '.' + MayaCommandEnums.ROTATION_X)
    #toe roll
    cmds.connectAttr(foot_cc + '.toeRoll', mult01 + '.input1Y')
    cmds.connectAttr(mult01 + '.outputY',
                     rev_grps['toe'] + '.' + MayaCommandEnums.ROTATION_X)
    #heel roll
    cmds.connectAttr(foot_cc + '.heelRoll', mult01 + '.input1Z')
    cmds.connectAttr(mult01 + '.outputZ',
                     rev_grps['heel'] + '.' + MayaCommandEnums.ROTATION_X)

    #make a new mult node
    mult02 = cmds.shadingNode('multiplyDivide',
                              asUtility=True,
                              name=foot_cc + '_onOff_MULT')
    cmds.connectAttr(pass_node + '.output3D', mult02 + '.input2')

    #toe pivot
    cmds.connectAttr(foot_cc + '.toePivot', mult02 + '.input1X')
    cmds.connectAttr(mult02 + '.outputX',
                     rev_grps['toe'] + '.' + MayaCommandEnums.ROTATION_Y)
    #heel pivot
    cmds.connectAttr(foot_cc + '.heelPivot', mult02 + '.input1Y')
    cmds.connectAttr(mult02 + '.outputY',
                     rev_grps['heel'] + '.' + MayaCommandEnums.ROTATION_Y)
    #bank
    cmds.connectAttr(foot_cc + '.bank', mult02 + '.input1Z')
    cmds.connectAttr(mult02 + '.outputZ',
                     rev_grps['bankIn'] + '.' + MayaCommandEnums.ROTATION_Z)
    cmds.connectAttr(mult02 + '.outputZ',
                     rev_grps['bankOut'] + '.' + MayaCommandEnums.ROTATION_Z)
    #lock the transforms on the bank so it works and the right side is locked inverse

    if foot_cc.startswith(NamingConventionEnums.RIGHT):
        cmds.transformLimits(rev_grps['bankIn'],
                             enableRotationZ=(False, True),
                             rotationZ=(0, 0))
        cmds.transformLimits(rev_grps['bankOut'],
                             enableRotationZ=(True, False),
                             rotationZ=(0, 0))
    else:
        cmds.transformLimits(rev_grps['bankIn'],
                             enableRotationZ=(True, False),
                             rotationZ=(0, 0))
        cmds.transformLimits(rev_grps['bankOut'],
                             enableRotationZ=(False, True),
                             rotationZ=(0, 0))

    #parent the foot controls and iks to the rig hierarchy
    cmds.parent(ball_cc_grp, NamingConventionEnums.RIG_HIERARCHY[8])
    cmds.parent(ik_handle, NamingConventionEnums.RIG_HIERARCHY[9])

    #rename the ball to bind suffix
    bind_name = ball_jnt.replace(NamingConventionEnums.JOINT_SUFFIX,
                                 NamingConventionEnums.BIND_JOINT_SUFFIX)
    cmds.rename(ball_jnt, bind_name)
コード例 #47
0
ファイル: dpHead.py プロジェクト: utsdab/usr
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.setAttr(self.moduleGrp + ".moduleNamespace", self.moduleGrp[: self.moduleGrp.rfind(":")], type="string")
     # create cvJointLoc and cvLocators:
     self.cvNeckLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName + "_neck", r=0.5)
     self.connectShapeSize(shapeSizeCH)
     self.cvHeadLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_head", r=0.4)
     self.connectShapeSize(shapeSizeCH)
     self.cvJawLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_jaw", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvChinLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_chin", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvLLipLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_lLip", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     self.cvRLipLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_rLip", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     # create jointGuides:
     self.jGuideNeck = cmds.joint(name=self.guideName + "_JGuideNeck", radius=0.001)
     self.jGuideHead = cmds.joint(name=self.guideName + "_JGuideHead", radius=0.001)
     self.jGuideJaw = cmds.joint(name=self.guideName + "_JGuideJaw", radius=0.001)
     self.jGuideChin = cmds.joint(name=self.guideName + "_JGuideChin", radius=0.001)
     # set jointGuides as templates:
     cmds.setAttr(self.jGuideNeck + ".template", 1)
     cmds.setAttr(self.jGuideHead + ".template", 1)
     cmds.setAttr(self.jGuideJaw + ".template", 1)
     cmds.setAttr(self.jGuideChin + ".template", 1)
     cmds.parent(self.jGuideNeck, self.moduleGrp, relative=True)
     # create cvEnd:
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvChinLoc)
     cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName + "_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd + ".template", 1)
     cmds.parent(self.jGuideEnd, self.jGuideChin)
     # make parents between cvLocs:
     cmds.parent(self.cvNeckLoc, self.moduleGrp)
     cmds.parent(self.cvHeadLoc, self.cvNeckLoc)
     cmds.parent(self.cvJawLoc, self.cvHeadLoc)
     cmds.parent(self.cvChinLoc, self.cvJawLoc)
     cmds.parent(self.cvLLipLoc, self.cvJawLoc)
     cmds.parent(self.cvRLipLoc, self.cvJawLoc)
     # connect cvLocs in jointGuides:
     ctrls.directConnect(self.cvNeckLoc, self.jGuideNeck, ["tx", "ty", "tz", "rx", "ry", "rz"])
     ctrls.directConnect(self.cvHeadLoc, self.jGuideHead, ["tx", "ty", "tz", "rx", "ry", "rz"])
     ctrls.directConnect(self.cvJawLoc, self.jGuideJaw, ["tx", "ty", "tz", "rx", "ry", "rz"])
     ctrls.directConnect(self.cvChinLoc, self.jGuideChin, ["tx", "ty", "tz", "rx", "ry", "rz"])
     ctrls.directConnect(self.cvEndJoint, self.jGuideEnd, ["tx", "ty", "tz", "rx", "ry", "rz"])
     # limit, lock and hide cvEnd:
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ["tx", "ty", "rx", "ry", "rz", "sx", "sy", "sz"])
     # transform cvLocs in order to put as a good head guide:
     cmds.setAttr(self.cvNeckLoc + ".rotateY", -10)
     cmds.setAttr(self.cvHeadLoc + ".translateZ", 2)
     cmds.setAttr(self.cvHeadLoc + ".rotateY", 5)
     cmds.setAttr(self.cvJawLoc + ".translateX", -0.5)
     cmds.setAttr(self.cvJawLoc + ".translateZ", 1.25)
     cmds.setAttr(self.cvJawLoc + ".rotateY", -95)
     cmds.setAttr(self.cvChinLoc + ".translateZ", 0.25)
     cmds.setAttr(self.moduleGrp + ".rotateX", -90)
     cmds.setAttr(self.moduleGrp + ".rotateY", 90)
     # lip cvLocs:
     cmds.setAttr(self.cvLLipLoc + ".translateY", -0.5)
     cmds.setAttr(self.cvLLipLoc + ".translateZ", 1)
     self.lipMD = cmds.createNode("multiplyDivide", name=self.guideName + "_lip_MD")
     cmds.connectAttr(self.cvLLipLoc + ".translateX", self.lipMD + ".input1X", force=True)
     cmds.connectAttr(self.cvLLipLoc + ".translateY", self.lipMD + ".input1Y", force=True)
     cmds.connectAttr(self.cvLLipLoc + ".translateZ", self.lipMD + ".input1Z", force=True)
     cmds.connectAttr(self.lipMD + ".outputX", self.cvRLipLoc + ".translateX", force=True)
     cmds.connectAttr(self.lipMD + ".outputY", self.cvRLipLoc + ".translateY", force=True)
     cmds.connectAttr(self.lipMD + ".outputZ", self.cvRLipLoc + ".translateZ", force=True)
     cmds.setAttr(self.lipMD + ".input2Y", -1)
コード例 #48
0
ファイル: dpFoot.py プロジェクト: nilouco/dpAutoRigSystem
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.setAttr(self.moduleGrp + ".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     # create cvJointLoc and cvLocators:
     self.cvFootLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName + "_foot", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFALoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_RfA", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFBLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_RfB", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFCLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_RfC", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFDLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_RfD", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFELoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_RfE", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     # create jointGuides:
     self.jGuideFoot = cmds.joint(name=self.guideName + "_JGuideFoot", radius=0.001)
     self.jGuideRFE = cmds.joint(name=self.guideName + "_JGuideRfE", radius=0.001)
     cmds.select(clear=True)
     self.jGuideRFA = cmds.joint(name=self.guideName + "_JGuideRfA", radius=0.001)
     self.jGuideRFD = cmds.joint(name=self.guideName + "_JGuideRfD", radius=0.001)
     self.jGuideRFB = cmds.joint(name=self.guideName + "_JGuideRfB", radius=0.001)
     self.jGuideRFC = cmds.joint(name=self.guideName + "_JGuideRfC", radius=0.001)
     self.jGuideRFAC = cmds.joint(name=self.guideName + "_JGuideRfAC", radius=0.001)
     # set jointGuides as templates:
     cmds.setAttr(self.jGuideFoot + ".template", 1)
     cmds.setAttr(self.jGuideRFA + ".template", 1)
     cmds.setAttr(self.jGuideRFB + ".template", 1)
     cmds.setAttr(self.jGuideRFC + ".template", 1)
     cmds.setAttr(self.jGuideRFD + ".template", 1)
     cmds.setAttr(self.jGuideRFE + ".template", 1)
     cmds.parent(self.jGuideFoot, self.jGuideRFA, self.moduleGrp, relative=True)
     # create cvEnd:
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvRFELoc)
     cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName + "_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd + ".template", 1)
     cmds.parent(self.jGuideEnd, self.jGuideRFE)
     # make parents between cvLocs:
     cmds.parent(self.cvFootLoc, self.cvRFALoc, self.cvRFBLoc, self.cvRFCLoc, self.cvRFDLoc, self.moduleGrp)
     cmds.parent(self.cvRFELoc, self.cvFootLoc)
     # connect cvLocs in jointGuides:
     ctrls.directConnect(self.cvFootLoc, self.jGuideFoot, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     cmds.parentConstraint(self.cvRFALoc, self.jGuideRFA, maintainOffset=False,
                           name=self.jGuideRFA + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFBLoc, self.jGuideRFB, maintainOffset=False,
                           name=self.jGuideRFB + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFCLoc, self.jGuideRFC, maintainOffset=False,
                           name=self.jGuideRFC + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFDLoc, self.jGuideRFD, maintainOffset=False,
                           name=self.jGuideRFD + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFELoc, self.jGuideRFE, maintainOffset=False,
                           name=self.jGuideRFE + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFALoc, self.jGuideRFAC, maintainOffset=False,
                           name=self.jGuideRFAC + "_ParentConstraint")
     ctrls.directConnect(self.cvEndJoint, self.jGuideEnd, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     # limit, lock and hide cvEnd:
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     # transform cvLocs in order to put as a good foot guide:
     cmds.setAttr(self.cvFootLoc + ".translateZ", 2)
     cmds.setAttr(self.cvFootLoc + ".rotateY", -90)
     cmds.setAttr(self.cvRFELoc + ".translateX", -1)
     cmds.setAttr(self.cvRFELoc + ".translateZ", 2.5)
     cmds.setAttr(self.cvRFCLoc + ".translateX", 1)
     cmds.setAttr(self.cvRFALoc + ".translateX", -0.6)
     cmds.setAttr(self.cvRFALoc + ".translateY", -1)
     cmds.setAttr(self.cvRFBLoc + ".translateX", -0.6)
     cmds.setAttr(self.cvRFBLoc + ".translateY", 1)
     cmds.setAttr(self.cvRFDLoc + ".translateX", -3.5)
     cmds.setAttr(self.moduleGrp + ".rotateX", -90)
     cmds.setAttr(self.moduleGrp + ".rotateY", 90)
コード例 #49
0
def applyLimits(applyLimits):

    translateXMaxLimit = cmds.checkBox(setLimitsTranslateXMax,
                                       editable=True,
                                       query=True,
                                       value=True)
    translateXMinLimit = cmds.checkBox(setLimitsTranslateXMin,
                                       editable=True,
                                       query=True,
                                       value=True)
    translateYMaxLimit = cmds.checkBox(setLimitsTranslateYMax,
                                       editable=True,
                                       query=True,
                                       value=True)
    translateYMinLimit = cmds.checkBox(setLimitsTranslateYMin,
                                       editable=True,
                                       query=True,
                                       value=True)
    translateZMaxLimit = cmds.checkBox(setLimitsTranslateZMax,
                                       editable=True,
                                       query=True,
                                       value=True)
    translateZMinLimit = cmds.checkBox(setLimitsTranslateZMin,
                                       editable=True,
                                       query=True,
                                       value=True)

    translateXMaxFieldValue = cmds.floatField(translateXMaxField,
                                              editable=True,
                                              query=True,
                                              value=True)
    translateXMinFieldValue = cmds.floatField(translateXMinField,
                                              editable=True,
                                              query=True,
                                              value=True)

    translateYMaxFieldValue = cmds.floatField(translateYMaxField,
                                              editable=True,
                                              query=True,
                                              value=True)
    translateYMinFieldValue = cmds.floatField(translateYMinField,
                                              editable=True,
                                              query=True,
                                              value=True)

    translateZMaxFieldValue = cmds.floatField(translateZMaxField,
                                              editable=True,
                                              query=True,
                                              value=True)
    translateZMinFieldValue = cmds.floatField(translateZMinField,
                                              editable=True,
                                              query=True,
                                              value=True)

    rotateXMaxLimit = cmds.checkBox(setLimitsRotateXMax,
                                    editable=True,
                                    query=True,
                                    value=True)
    rotateXMinLimit = cmds.checkBox(setLimitsRotateXMin,
                                    editable=True,
                                    query=True,
                                    value=True)
    rotateYMaxLimit = cmds.checkBox(setLimitsRotateYMax,
                                    editable=True,
                                    query=True,
                                    value=True)
    rotateYMinLimit = cmds.checkBox(setLimitsRotateYMin,
                                    editable=True,
                                    query=True,
                                    value=True)
    rotateZMaxLimit = cmds.checkBox(setLimitsRotateZMax,
                                    editable=True,
                                    query=True,
                                    value=True)
    rotateZMinLimit = cmds.checkBox(setLimitsRotateZMin,
                                    editable=True,
                                    query=True,
                                    value=True)

    rotateXMaxFieldValue = cmds.floatField(rotateXMaxField,
                                           editable=True,
                                           query=True,
                                           value=True)
    rotateXMinFieldValue = cmds.floatField(rotateXMinField,
                                           editable=True,
                                           query=True,
                                           value=True)

    rotateYMaxFieldValue = cmds.floatField(rotateYMaxField,
                                           editable=True,
                                           query=True,
                                           value=True)
    rotateYMinFieldValue = cmds.floatField(rotateYMinField,
                                           editable=True,
                                           query=True,
                                           value=True)

    rotateZMaxFieldValue = cmds.floatField(rotateZMaxField,
                                           editable=True,
                                           query=True,
                                           value=True)
    rotateZMinFieldValue = cmds.floatField(rotateZMinField,
                                           editable=True,
                                           query=True,
                                           value=True)

    scaleXMaxLimit = cmds.checkBox(setLimitsScaleXMax,
                                   editable=True,
                                   query=True,
                                   value=True)
    scaleXMinLimit = cmds.checkBox(setLimitsScaleXMin,
                                   editable=True,
                                   query=True,
                                   value=True)
    scaleYMaxLimit = cmds.checkBox(setLimitsScaleYMax,
                                   editable=True,
                                   query=True,
                                   value=True)
    scaleYMinLimit = cmds.checkBox(setLimitsScaleYMin,
                                   editable=True,
                                   query=True,
                                   value=True)
    scaleZMaxLimit = cmds.checkBox(setLimitsScaleZMax,
                                   editable=True,
                                   query=True,
                                   value=True)
    scaleZMinLimit = cmds.checkBox(setLimitsScaleZMin,
                                   editable=True,
                                   query=True,
                                   value=True)

    scaleXMaxFieldValue = cmds.floatField(scaleXMaxField,
                                          editable=True,
                                          query=True,
                                          value=True)
    scaleXMinFieldValue = cmds.floatField(scaleXMinField,
                                          editable=True,
                                          query=True,
                                          value=True)

    scaleYMaxFieldValue = cmds.floatField(scaleYMaxField,
                                          editable=True,
                                          query=True,
                                          value=True)
    scaleYMinFieldValue = cmds.floatField(scaleYMinField,
                                          editable=True,
                                          query=True,
                                          value=True)

    scaleZMaxFieldValue = cmds.floatField(scaleZMaxField,
                                          editable=True,
                                          query=True,
                                          value=True)
    scaleZMinFieldValue = cmds.floatField(scaleZMinField,
                                          editable=True,
                                          query=True,
                                          value=True)

    lockTranslateXValue = cmds.checkBox(lockTranslateX,
                                        editable=True,
                                        query=True,
                                        value=True)
    lockTranslateYValue = cmds.checkBox(lockTranslateY,
                                        editable=True,
                                        query=True,
                                        value=True)
    lockTranslateZValue = cmds.checkBox(lockTranslateZ,
                                        editable=True,
                                        query=True,
                                        value=True)

    lockRotateXValue = cmds.checkBox(lockRotateX,
                                     editable=True,
                                     query=True,
                                     value=True)
    lockRotateYValue = cmds.checkBox(lockRotateY,
                                     editable=True,
                                     query=True,
                                     value=True)
    lockRotateZValue = cmds.checkBox(lockRotateZ,
                                     editable=True,
                                     query=True,
                                     value=True)

    lockScaleXValue = cmds.checkBox(lockScaleX,
                                    editable=True,
                                    query=True,
                                    value=True)
    lockScaleYValue = cmds.checkBox(lockScaleY,
                                    editable=True,
                                    query=True,
                                    value=True)
    lockScaleZValue = cmds.checkBox(lockScaleZ,
                                    editable=True,
                                    query=True,
                                    value=True)

    selection = cmds.ls(selection=True)
    i = 0
    for eachObject in selection:
        transformPosition = cmds.xform(eachObject,
                                       query=True,
                                       translation=True)
        print('applyLimits(), the transformPositionValues for ' +
              str(eachObject) + ' are: ' + str(transformPosition))

        cmds.transformLimits(
            selection[i],
            enableTranslationX=[translateXMinLimit, translateXMaxLimit],
            tx=(transformPosition[0] + translateXMinFieldValue,
                transformPosition[0] + translateXMaxFieldValue))
        cmds.transformLimits(
            selection[i],
            enableTranslationY=[translateYMinLimit, translateYMaxLimit],
            ty=(transformPosition[1] + translateYMinFieldValue,
                transformPosition[1] + translateYMaxFieldValue))
        cmds.transformLimits(
            selection[i],
            enableTranslationZ=[translateZMinLimit, translateZMaxLimit],
            tz=(transformPosition[2] + translateZMinFieldValue,
                transformPosition[2] + translateZMaxFieldValue))

        cmds.transformLimits(
            selection[i],
            enableRotationX=[rotateXMinLimit, rotateXMaxLimit],
            rx=(rotateXMinFieldValue, rotateXMaxFieldValue))
        cmds.transformLimits(
            selection[i],
            enableRotationY=[rotateYMinLimit, rotateYMaxLimit],
            ry=(rotateYMinFieldValue, rotateYMaxFieldValue))
        cmds.transformLimits(
            selection[i],
            enableRotationZ=[rotateZMinLimit, rotateZMaxLimit],
            rz=(rotateZMinFieldValue, rotateZMaxFieldValue))

        cmds.transformLimits(selection[i],
                             enableScaleX=[scaleXMinLimit, scaleXMaxLimit],
                             sx=(scaleXMinFieldValue, scaleXMaxFieldValue))
        cmds.transformLimits(selection[i],
                             enableScaleY=[scaleYMinLimit, scaleYMaxLimit],
                             sy=(scaleYMinFieldValue, scaleYMaxFieldValue))
        cmds.transformLimits(selection[i],
                             enableScaleZ=[scaleZMinLimit, scaleZMaxLimit],
                             sz=(scaleZMinFieldValue, scaleZMaxFieldValue))

        print('the lockTranslateXValue is: ' + str(not lockTranslateXValue))

        cmds.setAttr(str(selection[i]) + '.translateX',
                     lock=lockTranslateXValue,
                     keyable=not lockTranslateXValue)
        cmds.setAttr(str(selection[i]) + '.translateY',
                     lock=lockTranslateYValue,
                     keyable=not lockTranslateYValue)
        cmds.setAttr(str(selection[i]) + '.translateZ',
                     lock=lockTranslateZValue,
                     keyable=not lockTranslateZValue)

        cmds.setAttr(str(selection[i]) + '.rotateX',
                     lock=lockRotateXValue,
                     keyable=not lockRotateXValue)
        cmds.setAttr(str(selection[i]) + '.rotateY',
                     lock=lockRotateYValue,
                     keyable=not lockRotateYValue)
        cmds.setAttr(str(selection[i]) + '.rotateZ',
                     lock=lockRotateZValue,
                     keyable=not lockRotateZValue)

        cmds.setAttr(str(selection[i]) + '.scaleX',
                     lock=lockScaleXValue,
                     keyable=not lockScaleXValue)
        cmds.setAttr(str(selection[i]) + '.scaleY',
                     lock=lockScaleYValue,
                     keyable=not lockScaleYValue)
        cmds.setAttr(str(selection[i]) + '.scaleZ',
                     lock=lockScaleZValue,
                     keyable=not lockScaleZValue)

        i = i + 1
コード例 #50
0
    def createGuide(self, *args):
        Base.StartClass.createGuide(self)
        # Custom GUIDE:
        cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
        cmds.addAttr(self.moduleGrp, longName="geo", dataType='string')
        cmds.addAttr(self.moduleGrp,
                     longName="startFrame",
                     attributeType='long',
                     defaultValue=1)
        cmds.addAttr(self.moduleGrp,
                     longName="showControls",
                     attributeType='bool')
        cmds.addAttr(self.moduleGrp, longName="steering", attributeType='bool')
        cmds.setAttr(self.moduleGrp + ".flip", 0)
        cmds.setAttr(self.moduleGrp + ".showControls", 1)
        cmds.setAttr(self.moduleGrp + ".steering", 0)

        cmds.setAttr(self.moduleGrp + ".moduleNamespace",
                     self.moduleGrp[:self.moduleGrp.rfind(":")],
                     type='string')

        self.cvCenterLoc, shapeSizeCH = self.ctrls.cvJointLoc(
            ctrlName=self.guideName + "_CenterLoc",
            r=0.6,
            d=1,
            rot=(90, 0, 90),
            guide=True)
        self.connectShapeSize(shapeSizeCH)
        self.jGuideCenter = cmds.joint(name=self.guideName + "_JGuideCenter",
                                       radius=0.001)
        cmds.setAttr(self.jGuideCenter + ".template", 1)
        cmds.parent(self.jGuideCenter, self.moduleGrp, relative=True)

        self.cvFrontLoc = self.ctrls.cvControl("id_059_AimLoc",
                                               ctrlName=self.guideName +
                                               "_FrontLoc",
                                               r=0.3,
                                               d=1,
                                               rot=(0, 0, 90))
        self.ctrls.colorShape([self.cvFrontLoc], "blue")
        shapeSizeCH = self.ctrls.shapeSizeSetup(self.cvFrontLoc)
        self.connectShapeSize(shapeSizeCH)
        cmds.parent(self.cvFrontLoc, self.cvCenterLoc)
        cmds.setAttr(self.cvFrontLoc + ".tx", 1.3)
        self.jGuideFront = cmds.joint(name=self.guideName + "_JGuideFront",
                                      radius=0.001)
        cmds.setAttr(self.jGuideFront + ".template", 1)
        cmds.transformLimits(self.cvFrontLoc,
                             translationX=(1, 1),
                             enableTranslationX=(True, False))
        radiusCtrl = self.moduleGrp + "_RadiusCtrl"
        cvFrontLocPosNode = cmds.createNode("plusMinusAverage",
                                            name=self.cvFrontLoc + "_Pos_PMA")
        cmds.setAttr(cvFrontLocPosNode + ".input1D[0]", -0.5)
        cmds.connectAttr(radiusCtrl + ".translateX",
                         cvFrontLocPosNode + ".input1D[1]")
        cmds.connectAttr(cvFrontLocPosNode + ".output1D",
                         self.cvFrontLoc + ".tx")
        self.ctrls.setLockHide(
            [self.cvCenterLoc, self.cvFrontLoc],
            ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

        self.cvInsideLoc, shapeSizeCH = self.ctrls.cvLocator(
            ctrlName=self.guideName + "_InsideLoc", r=0.2, d=1, guide=True)
        self.connectShapeSize(shapeSizeCH)
        cmds.parent(self.cvInsideLoc, self.cvCenterLoc)
        cmds.setAttr(self.cvInsideLoc + ".tz", 0.3)
        self.jGuideInside = cmds.joint(name=self.guideName + "_JGuideInside",
                                       radius=0.001)
        cmds.setAttr(self.jGuideInside + ".template", 1)
        cmds.transformLimits(self.cvInsideLoc, tz=(0.01, 1), etz=(True, False))
        inverseRadius = cmds.createNode("multiplyDivide",
                                        name=self.moduleGrp + "_Radius_Inv_MD")
        cmds.setAttr(inverseRadius + ".input2X", -1)
        cmds.connectAttr(radiusCtrl + ".translateX",
                         inverseRadius + ".input1X")
        cmds.connectAttr(inverseRadius + ".outputX",
                         self.cvInsideLoc + ".translateY")
        self.ctrls.setLockHide(
            [self.cvInsideLoc],
            ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

        self.cvOutsideLoc, shapeSizeCH = self.ctrls.cvLocator(
            ctrlName=self.guideName + "_OutsideLoc", r=0.2, d=1, guide=True)
        self.connectShapeSize(shapeSizeCH)
        cmds.parent(self.cvOutsideLoc, self.cvCenterLoc)
        cmds.setAttr(self.cvOutsideLoc + ".tz", -0.3)
        self.jGuideOutside = cmds.joint(name=self.guideName + "_JGuideOutside",
                                        radius=0.001)
        cmds.setAttr(self.jGuideOutside + ".template", 1)
        cmds.transformLimits(self.cvOutsideLoc,
                             tz=(-1, 0.01),
                             etz=(False, True))
        cmds.connectAttr(inverseRadius + ".outputX",
                         self.cvOutsideLoc + ".translateY")
        self.ctrls.setLockHide(
            [self.cvOutsideLoc],
            ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

        cmds.parent(self.cvCenterLoc, self.moduleGrp)
        cmds.parent(self.jGuideFront, self.jGuideInside, self.jGuideOutside,
                    self.jGuideCenter)
        cmds.parentConstraint(self.cvCenterLoc,
                              self.jGuideCenter,
                              maintainOffset=False,
                              name=self.jGuideCenter + "_ParentConstraint")
        cmds.parentConstraint(self.cvFrontLoc,
                              self.jGuideFront,
                              maintainOffset=False,
                              name=self.jGuideFront + "_ParentConstraint")
        cmds.parentConstraint(self.cvInsideLoc,
                              self.jGuideInside,
                              maintainOffset=False,
                              name=self.cvInsideLoc + "_ParentConstraint")
        cmds.parentConstraint(self.cvOutsideLoc,
                              self.jGuideOutside,
                              maintainOffset=False,
                              name=self.cvOutsideLoc + "_ParentConstraint")
コード例 #51
0
ファイル: Func.py プロジェクト: darkuress/arFace
 def createLidCtl(self, miNum):
     """
     create sub controller for the control panel
     """
        
     for updn in self.lrUplow:
         ctlP = updn + "Ctrl0"
         kids = cmds.listRelatives(ctlP, ad=True, type ='transform')   
         if kids:
             cmds.delete(kids)
                 
         cntCtlP = cmds.duplicate(ctlP, po =True, n = updn + 'CntCtlP')
         cmds.parent(cntCtlP[0],ctlP)
         cntCtl = cmds.circle(n = updn + "Center", ch=False, o =True, nr =(0, 0, 1), r = 0.1)
         cntCtl[0]
         cmds.parent(cntCtl[0], cntCtlP[0])
         cmds.setAttr(cntCtl[0] + ".overrideEnabled", 1)
         cmds.setAttr(cntCtl[0] + "Shape.overrideEnabled", 1)
         cmds.setAttr(cntCtl[0] + "Shape.overrideColor", 9)
         cmds.setAttr(cntCtl[0] + '.translate', 0,0,0)
         cmds.transformLimits(cntCtl, tx =(-1, 1), etx=(True, True))
         cmds.transformLimits(cntCtl, ty =(-1, 1), ety=(True, True))
     
         inCornerP = cmds.duplicate(cntCtlP , n = updn + 'InCornerP', rc =True)
         cmds.setAttr(inCornerP[0] +'.tx', -1)
         inTemp = cmds.listRelatives(inCornerP[0], c=True, type ='transform') 
         inCorner = cmds.rename(inTemp[0], updn + 'InCorner')
         cmds.setAttr(inCorner +'.scale', .8, .8, .8)
         cmds.transformLimits(inCorner, tx =(-.25, .25), etx=(True, True))
         cmds.transformLimits(inCorner, ty =(-1,  1), ety=(True, True))
                 
         outCornerP = cmds.duplicate(cntCtlP , n = updn + 'OutCornerP', rc=True)
         cmds.setAttr(outCornerP[0] +'.tx', 1)
         outTemp = cmds.listRelatives(outCornerP[0], c=True, type ='transform') 
         outCorner = cmds.rename(outTemp[0], updn + 'OutCorner') 
         cmds.setAttr(outCorner +'.scale', .8, .8, .8) 
         cmds.transformLimits(outCorner, tx =(-.25, .25), etx=(True, True))
         cmds.transformLimits(outCorner, ty =(-1, 1), ety=(True, True))
         
         attTemp = ['scaleX','scaleY','scaleZ', 'rotateX','rotateY','rotateZ', 'tz', 'visibility' ]  
         for x in attTemp:
             cmds.setAttr(cntCtl[0] +"."+ x, lock = True, keyable = False, channelBox =False)
             cmds.setAttr(inCorner +"."+ x, lock = True, keyable = False, channelBox =False) 
             cmds.setAttr(outCorner+"."+ x, lock = True, keyable = False, channelBox =False) 
     
         for i in range(0, miNum):
             detailCtl = cmds.spaceLocator(n = updn  + 'Detail' + str(i+1).zfill(2))
             detailCtlP = cmds.group(em =True, n = updn  + 'Detail'+ str(i+1).zfill(2) + 'P')
             cmds.parent(detailCtl[0], detailCtlP)
             cmds.parent(detailCtlP, ctlP)
             cmds.setAttr(detailCtl[0] +".overrideEnabled", 1)
             cmds.setAttr(detailCtl[0] +"Shape.overrideEnabled", 1)
             cmds.setAttr(detailCtl[0]+"Shape.overrideColor", 20)
             increment = 2.0 /(miNum-1)
             cmds.setAttr(detailCtlP + ".tx", increment*i - 1.0)
             cmds.setAttr(detailCtlP + ".ty", 0)
             cmds.setAttr(detailCtlP + ".tz", 0)
             cmds.xform(detailCtl, r =True, s =(0.1, 0.1, 0.1))
             cmds.transformLimits(detailCtl , tx =(-.25, .25), etx=(True, True))
             cmds.transformLimits(detailCtl , ty =(-.5, .5), ety=(True, True))
             for y in attTemp:
                 cmds.setAttr(detailCtl[0] +"."+ y, lock = True, keyable = False, channelBox =False)
コード例 #52
0
    def build(self):
        
        FKIKCtl       = '%s_legFrontFkIk_ctl_%s' % (self.locus,self.count)
        IKCtl         = '%s_legFrontIk_ctl_%s' % (self.locus,self.count)
        footBallPivot = '%s_footPivotBallLegFrontIk_org_%s' % (self.locus,self.count)
        footRoll      = '%s_footRollLegFrontIk_org_%s' % (self.locus,self.count)
        ballIkCtl     = '%s_legFrontBallIk_ctl_%s' % (self.locus,self.count)
        
        # add attrs
        cmds.addAttr(FKIKCtl,ln='feetControls',at='double',min=0,max=1,dv=1)
        cmds.setAttr('%s.feetControls' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='swivel',at='double',dv=0)
        cmds.setAttr('%s.swivel' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeRoll',at='double',dv=0)
        cmds.setAttr('%s.toeRoll' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeSwivel',at='double',dv=0)
        cmds.setAttr('%s.toeSwivel' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeTwist',at='double',dv=0)
        cmds.setAttr('%s.toeTwist' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='heelBank',at='double',dv=0)
        cmds.setAttr('%s.heelBank' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='heelSwivel',at='double',dv=0)
        cmds.setAttr('%s.heelSwivel' % FKIKCtl,e=True,k=True)
        
        negate = 1
        if self.locus == 'L':
            negate = -1
        elif self.locus == 'C':
            # fix the outer and inner foot bind joints if the foot is centered
            cmds.rename('L_%sInnerfoot_bnd_%s' % (self.namespace,self.count),'C_%sInnerfoot_bnd_%s' % (self.namespace,self.count))
            cmds.rename('R_%sOuterfoot_bnd_%s' % (self.namespace,self.count),'C_%sOuterfoot_bnd_%s' % (self.namespace,self.count))
        
        # constrain to the rig
        cmds.connectAttr('C_main_loc_0Shape.worldPosition','%s_%s_mod_%s.translate' % (self.locus,self.namespace,self.count))
        cmds.orientConstraint('C_main_loc_0','%s_%s_mod_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.parentConstraint('%s_%sFoot_bnd_%s' % (self.locus,self.namespace,self.count),'%s_%sFKIK_org_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.parentConstraint('C_chest_bnd_0','%s_%sCtl_org_%s' % (self.locus,self.namespace,self.count),mo=True)
        
        # connect fkikctl attrs to ik foot ctl attrs
        cmds.connectAttr('%s.swivel' % FKIKCtl,'%s.swivel' % IKCtl)
        cmds.setAttr('%s.swivel' % IKCtl,l=True,k=False)
        cmds.setAttr('%s.toe' % IKCtl,l=True,k=False)
        cmds.setAttr('%s.rollAngle' % IKCtl,l=True,k=False)
        
        # add control to IK feet controls to hide other controls
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legFrontToeIk_ctl_%sShape.v' % (self.locus,self.count))
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legFrontHeelIk_ctl_%sShape.v' % (self.locus,self.count))
        
        # add follow to ik feet controls
        cmds.addAttr(IKCtl,ln='follow',at='double',min=0,max=1,dv=0)
        cmds.setAttr('%s.follow' % IKCtl,e=True,k=True)
        
        pConst = cmds.parentConstraint('%s_%sIK_org_%s' % (self.locus,self.namespace,self.count),'C_root_bnd_0','%s_legFrontIk_org_%s' % (self.locus,self.count),mo=True)[0]
        rev    = cmds.createNode('reverse')
        
        cmds.connectAttr('%s.follow' % IKCtl,'%s.C_root_bnd_0W1' % pConst)
        cmds.connectAttr('%s.follow' % IKCtl,'%s.inputX' % rev)
        cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sIK_org_%sW0' % (pConst,self.locus,self.namespace,self.count))
        cmds.setAttr('%s.interpType' % pConst, 2)
        
        # reconnect foot roll
        cmds.parent(footBallPivot, '%s_legFrontBallIk_cth_%s' % (self.locus,self.count))
        cmds.setAttr('%s.roll' % IKCtl,l=True,cb=False,k=False)
        cmds.connectAttr('%s.swivel' % IKCtl,'%s_legFrontToeIk_cth_%s.ry' % (self.locus,self.count))
    
        # add foot bank
        off = cmds.group(em=True,n='%s_%sFootBankInIk_off_%s' % (self.locus,self.namespace,self.count))
        inn = cmds.group(em=True,n='%s_%sFootBankInIk_org_%s' % (self.locus,self.namespace,self.count))
        cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),inn,mo=False))
        cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),off,mo=False))
        
        out = cmds.group(em=True,n='%s_%sFootBankOutIk_org_%s' % (self.locus,self.namespace,self.count))
        cmds.delete(cmds.parentConstraint('%s_%sOuterfoot_bnd_%s' % (self.locus,self.namespace,self.count),out,mo=False))
        
        cmds.parent(off,IKCtl)
        cmds.parent(inn,off)
        cmds.parent(out,inn)
        cmds.parent(footRoll,out)
        
        cmds.setAttr('%s.rz' % ballIkCtl,l=False,k=True)
        cmds.transformLimits(ballIkCtl,erz=[0,0])
        
        cond = cmds.createNode('condition')
        mult = cmds.createNode('multiplyDivide')
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
        if self.locus == 'R': cmds.setAttr('%s.operation' % cond,2)
        else: cmds.setAttr('%s.operation' % cond,4)
        cmds.setAttr('%s.colorIfFalseR' % cond,0)
        cmds.setAttr('%s.input2X' % mult,negate)
        cmds.connectAttr('%s.outColorR' % cond,'%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.rx' % out)
        
        cond = cmds.createNode('condition')
        mult = cmds.createNode('multiplyDivide')
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
        if self.locus == 'R': cmds.setAttr('%s.operation' % cond,4)
        else: cmds.setAttr('%s.operation' % cond,2)
        cmds.setAttr('%s.colorIfFalseR' % cond,0)
        cmds.setAttr('%s.input2X' % mult,negate)
        cmds.connectAttr('%s.outColorR' % cond,'%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.rx' % inn)
        
#         dup = cmds.duplicate(ballIkCtl,po=True,n='%s_legBallIk_dmy_%s' % (self.locus,self.count))[0]
#         cmds.parent(footBallPivot,dup)
#         cmds.connectAttr('%s.rx' % ballIkCtl,'%s.rx' % dup)
        
        # reorient the toes and midfoot controls
#         toe     = cmds.circle(ch=False)[0]
#         midfoot = cmds.circle(ch=False)[0]
#         new     = [toe,midfoot]
#         old     = ['%s_%sToesFk_ctl_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootFk_ctl_%s' % (self.locus,self.namespace,self.count)]
#          
#         i = 0
#         while True:
#             if i == len(new): break
#              
#             a   = new[i]
#             b   = old[i]
#             p   = cmds.listRelatives(b,p=True)[0]
#             gp  = cmds.listRelatives(p,p=True)[0]
#             pos = cmds.xform(b,q=True,ws=True,t=True)
#             cmds.move(pos[0],pos[1],pos[2],a,ws=True)
#             cmds.parent(b,a)
#             cmds.parent(p,w=True)
#             cmds.setAttr('%s.rotate' % p,0,0,0)
#             cmds.parent(p,gp)
#             cmds.parent(a,p)
#             shpA = cmds.listRelatives(a,s=True)[0]
#             cmds.setAttr('%s.overrideEnabled' % shpA,1)
#             shpB = cmds.listRelatives(b,s=True)[0]
#             plg = cmds.listConnections('%s.v' % shpB,s=True,d=False,p=True)
#             if plg:
#                 cmds.disconnectAttr(plg[0],'%s.v' % shpB)
#                 cmds.connectAttr(plg[0],'%s.v' % shpA)
#             cmds.setAttr('%s.v' % shpB,0)
#             cmds.setAttr('%s.v' % a,l=True,k=False)
#             cmds.connectAttr('%s.sx' % a, '%s.sz' % b)
#             cmds.connectAttr('%s.sy' % a, '%s.sy' % b)
#             cmds.connectAttr('%s.sz' % a, '%s.sx' % b)
#             cmds.rename(b,string.replace(b,'_ctl_','_dmy_'))
#             cmds.rename(shpA,'%sShape' % b)
#             cmds.rename(a,b)
#             i = i + 1
        
        # rerig foot roll to incorporate the toe joint
        cmds.delete('%s_%sToesEnd_bnd_%s' % (self.locus,self.namespace,self.count))
        cmds.parent('%s_%sToe_bnd_%s' % (self.locus,self.namespace,self.count),'%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count))
        # create toes IK joint
        toesIKJoint = cmds.joint(n='%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count))
        pos         = cmds.xform('%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
        cmds.move(pos[0],pos[1],pos[2],toesIKJoint,ws=True)
        cmds.parent(toesIKJoint,'%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.makeIdentity(toesIKJoint,a=True,r=True,jo=True)
        cmds.parent('%s_%sToeIk_jnt_%s' % (self.locus,self.namespace,self.count),toesIKJoint)
        # new rotational groups
        org = cmds.group(em=True,n='%s_%sToesPivotBallLegIK_org_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(org,'%s_legFrontBallIk_cth_%s' % (self.locus,self.count),r=True)
        cmds.move(pos[0],pos[1],pos[2],org,ws=True)
        cmds.parent(footBallPivot,org)
        # toe ik handles
        cmds.delete('%s_liftToeLegFrontToeIk_org_%s' % (self.locus,self.count))
        midfootIK = cmds.ikHandle(n='%s_legFrontMidfootIk_hdl_%s' % (self.locus,self.count),sj='%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),ee=toesIKJoint)[0]
        toeIK     = cmds.ikHandle(n='%s_legFrontToeIk_hdl_%s' % (self.locus,self.count),sj=toesIKJoint,ee='%s_%sToeIk_jnt_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.setAttr('%s.v' % midfootIK,0)
        cmds.setAttr('%s.v' % toeIK,0)
        
        # connect roll
        clamp = cmds.createNode('clamp')
        mult  = cmds.createNode('multiplyDivide')
        cmds.setAttr('%s.maxR' % clamp,99999)
        cmds.setAttr('%s.input2X' % mult,0.25)
        #cmds.connectAttr('%s.rx' % ballIkCtl,'%s.input1X' % mult)
        #cmds.connectAttr('%s.outputX' % mult,'%s.inputR' % clamp)
        #cmds.connectAttr('%s.outputR' % clamp,'%s.rx' % footBallPivot)
        cmds.connectAttr('%s.rx' % ballIkCtl,'%s.inputR' % clamp)
        cmds.connectAttr('%s.outputR' % clamp,'%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.rx' % footBallPivot)
        cmds.connectAttr('%s.outputR' % clamp,'%s.rx' % org)
        clamp = cmds.createNode('clamp')
        #avg   = cmds.createNode('plusMinusAverage')
        plug  = cmds.listConnections('%s_rollLegFrontHeelIk_org_%s.rx' % (self.locus,self.count),s=True,d=False,p=True)[0]
        cmds.setAttr('%s.minR' % clamp,-99999)
        cmds.connectAttr('%s.rx' % ballIkCtl,'%s.inputR' % clamp)
        cmds.disconnectAttr(plug,'%s_rollLegFrontHeelIk_org_%s.rx' % (self.locus,self.count))
        cmds.connectAttr('%s.outputR' % clamp,'%s_rollLegFrontHeelIk_org_%s.rx' % (self.locus,self.count))
        cmds.connectAttr('%s.heelBank' % FKIKCtl,'%s.rz' % footBallPivot)
        cmds.connectAttr('%s.heelBank' % FKIKCtl,'%s.rz' % org)
        #cmds.setAttr('%s.input1D[0]' % avg,cmds.getAttr('%s.ry' % footBallPivot))
        #cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s.input1D[1]' % avg)
        #cmds.connectAttr('%s.output1D' % avg, '%s.ry' % footBallPivot)
        children = cmds.listRelatives(footBallPivot,c=True)
        cmds.parent(children,w=True)
        cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s.ry' % footBallPivot)
        cmds.parent(children,footBallPivot)
        cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s.ry' % org)
        # create 'fk' controls
        toesctl = cmds.circle(ch=False,n='%s_%sToesIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
        toescth = cmds.group(n='%s_%sToesIk_cth_%s' % (self.locus,self.namespace,self.count))
        toesctg = cmds.group(n='%s_%sToesIk_ctg_%s' % (self.locus,self.namespace,self.count))
        toesdummyoff = cmds.group(n='%s_%sToesIkDummy_off_%s' % (self.locus,self.namespace,self.count),em=True)
        toesdummyorg = cmds.group(n='%s_%sToesIkDummy_org_%s' % (self.locus,self.namespace,self.count))
        #cmds.move(pos[0],pos[1],pos[2],toesctg,ws=True)
        #cmds.move(pos[0],pos[1],pos[2],toesdummyorg,ws=True)
        cmds.delete(cmds.parentConstraint('%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),toesctg,mo=False))
        cmds.delete(cmds.parentConstraint('%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),toesdummyorg,mo=False))
        
        pos = cmds.xform('%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
        footctl = cmds.circle(ch=False,n='%s_%sMidfootIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
        footcth = cmds.group(n='%s_%sMidfootIk_cth_%s' % (self.locus,self.namespace,self.count))
        footctg = cmds.group(n='%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count))
        footdummyoff  = cmds.group(n='%s_%sMidfootIkDummy_off_%s' % (self.locus,self.namespace,self.count),em=True)
        footdummyorg  = cmds.group(n='%s_%sMidfootIkDummy_org_%s' % (self.locus,self.namespace,self.count))
        footdummymain = cmds.group(n='%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count))
        #cmds.move(pos[0],pos[1],pos[2],footctg,ws=True)
        #cmds.move(pos[0],pos[1],pos[2],footdummyorg,ws=True)
        cmds.delete(cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),footctg,mo=False))
        #cmds.delete(cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),footdummyorg,mo=False))
        cmds.delete(cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),footdummymain,mo=False))
        
        cmds.setAttr('%s.tx' % toesctl,l=True,k=False)
        cmds.setAttr('%s.ty' % toesctl,l=True,k=False)
        cmds.setAttr('%s.tz' % toesctl,l=True,k=False)
        cmds.setAttr('%s.sx' % toesctl,l=True,k=False)
        cmds.setAttr('%s.sy' % toesctl,l=True,k=False)
        cmds.setAttr('%s.sz' % toesctl,l=True,k=False)
        cmds.setAttr('%s.v' % toesctl,l=True,k=False)
        cmds.setAttr('%s.tx' % footctl,l=True,k=False)
        cmds.setAttr('%s.ty' % footctl,l=True,k=False)
        cmds.setAttr('%s.tz' % footctl,l=True,k=False)
        cmds.setAttr('%s.sx' % footctl,l=True,k=False)
        cmds.setAttr('%s.sy' % footctl,l=True,k=False)
        cmds.setAttr('%s.sz' % footctl,l=True,k=False)
        cmds.setAttr('%s.v' % footctl,l=True,k=False)
        
        cmds.parent(toesctg,footctl)
        cmds.parent(toesdummyorg,footdummyoff)
        #cmds.parent(footdummyorg,footdummymain)
        cmds.parent(footctg,'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent(footdummymain,'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent(toeIK,toesdummyoff)
        cmds.parent(midfootIK,footdummyoff)
        
        #####################################
        #####################################
        #####################################
        #####################################
        cmds.connectAttr('%s.rotate' % toesctl,'%s.rotate' % toesdummyoff)
        cmds.connectAttr('%s.rotate' % footctl,'%s.rotate' % footdummyoff)
        #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toescth)
        #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footcth)
        #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toesdummyorg)
        #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footdummyorg)
        cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % toescth)
        cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % footcth)
        cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % toesdummyorg)
        cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % footdummyorg)
        cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toescth)
        cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footcth)
        cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toesdummyorg)
        cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footdummyorg)
        #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toescth)
        #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footcth)
        #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toesdummyorg)
        #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footdummyorg)
        cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % toescth)
        cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % footcth)
        cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % toesdummyorg)
        cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % footdummyorg)
        
        cmds.parentConstraint('%s_%sFootIk_jnt_%s' % (self.locus,self.namespace,self.count),footctg,mo=True)
        cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),toesctg,mo=True)
        # connect shape visibility
        shp = cmds.listRelatives(toesctl,s=True)[0]
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s.v' % shp)
        shp = cmds.listRelatives(footctl,s=True)[0]
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s.v' % shp)
        # move original fk controls
        cmds.parent('%s_%sMidfootFk_ctj_%s' % (self.locus,self.namespace,self.count),'%s_%sFootFk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.parent('%s_%sToesFk_ctj_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootFk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.delete('%s_to%sMidfootFk_jth_%s' % (self.locus,self.namespace,self.count),'%s_to%sFootFk_jth_%s' % (self.locus,self.namespace,self.count))
        # constrain bind joints
        for constraint in cmds.listConnections('%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count),s=True,d=False):
            if cmds.objectType(constraint,isAType='constraint'):
                cmds.delete(constraint)
                break
        pConst = cmds.parentConstraint('%s_%sMidfootFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count))[0]
        rev    = cmds.createNode('reverse')
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.inputX' % rev)
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sMidfootIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sMidfootFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
        
        for constraint in cmds.listConnections('%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count),s=True,d=False):
            if cmds.objectType(constraint,isAType='constraint'):
                cmds.delete(constraint)
                break
        pConst = cmds.parentConstraint('%s_%sToesFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sToesIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sToesFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
        
        ### ^
        ### ^
        ### ^
        ###
        # replace the ik control with split translational/rotational controls
#         cmds.delete('%s_%sFootIk_orc_%s' % (self.locus,self.namespace,self.count))
#         ctg = cmds.duplicate('%s_%sFootFk_cth_%s' % (self.locus,self.namespace,self.count),n='%s_%sFootIk_ctg_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         cth = cmds.duplicate('%s_%sFootFk_cth_%s' % (self.locus,self.namespace,self.count),n='%s_%sFootIk_cth_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         ctl = cmds.duplicate('%s_%sFootFk_ctl_%s' % (self.locus,self.namespace,self.count),n='%s_%sFootIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
#         cmds.delete(cmds.listRelatives(ctl,type='joint',f=True))
#         cmds.parent(ctl,cth)
#         cmds.parent(cth,ctg)
#         cmds.parent(ctg,IKCtl)
#         cmds.makeIdentity(ctg,a=True,r=True)
#         cmds.parent('%s_%sFootBankInIk_org_%s' % (self.locus,self.namespace,self.count),ctl)
        
        # create dummy ik leg to constrain the foot rotation controls
#         shoulder = cmds.duplicate('%s_%sShoulderIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sShoulderIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         elbow    = cmds.duplicate('%s_%sElbowIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sElbowIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         foot     = cmds.duplicate('%s_%sFootIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sFootIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         cmds.parent(foot,elbow)
#         cmds.parent(elbow,shoulder)
#         handle = cmds.ikHandle(sj=shoulder,ee=foot,sol='ikRPsolver')[0]
#         cmds.parent(handle,IKCtl)
#         cmds.setAttr('%s.v' % handle,0)
#         cmds.poleVectorConstraint('%s_poleLegFront_ctl_%s' % (self.locus,self.count),handle)
        
        # setup the global orientation blending of the ik foot rotational control
#         pConst = cmds.parentConstraint(foot,IKCtl,ctg,st=['x','y','z'],mo=True)[0]
#         rev    = cmds.createNode('reverse')
#         cmds.connectAttr('%s.Global' % ctl,'%s.%sW1' % (pConst,IKCtl))
#         cmds.connectAttr('%s.Global' % ctl,'%s.inputX' % rev)
#         cmds.connectAttr('%s.outputX' % rev,'%s.%sW0' % (pConst,foot))
#         cmds.setAttr('%s.interpType' % pConst,2)
#         cmds.setAttr('%s.Global' % ctl,1)
        
        # lower the foot roll controls to the ground plane
        cmds.setAttr('%s_rollLegFrontBallIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontBallIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontBallIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.parent('%s_rollLegFrontBallIk_org_%s' % (self.locus,self.count),w=True)
        cmds.parent('%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count),w=True)
        cmds.parent('%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count),w=True)
        #cmds.parent('%s_liftToeLegFrontToeIk_org_%s' % (self.locus,self.count),w=True)
        cmds.setAttr('%s_rollLegFrontHeelIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontHeelIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontHeelIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontToeIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontToeIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegFrontToeIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.parent(toeIK,w=True)
        cmds.move(0,0,0,'%s_rollLegFrontHeelIk_org_%s' % (self.locus,self.count),ws=True,x=False,y=True,z=False)
        cmds.move(0,0,0,'%s_rollLegFrontToeIk_org_%s' % (self.locus,self.count),ws=True,x=False,y=True,z=False)
        cmds.parent('%s_rollLegFrontBallIk_org_%s' % (self.locus,self.count),'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent('%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count),'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent('%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count),'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent(toeIK,toesdummyoff)
        #cmds.parent('%s_liftToeLegFrontToeIk_org_%s' % (self.locus,self.count),'%s_legFrontToeIk_ctl_%s' % (self.locus,self.count))
        
        # lock attributes
        for attr in ['sx','sy','sz']:
            cmds.setAttr('%s_%sShoulderFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sElbowFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sFootFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            #cmds.setAttr('%s_%sFootIk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sMidfootFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sToesFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
        
        # reconstrain pole vector
        cmds.delete('%s_legFrontFkIk_prc_%s' % (self.locus,self.count))
        cmds.delete('%s_poleLegFront_prc_%s' % (self.locus,self.count))
        pConst = cmds.parentConstraint(IKCtl,'%s_poleLegFrontStatic_tgt_%s' % (self.locus,self.count),'%s_poleLegFront_org_%s' % (self.locus,self.count),mo=True)[0]
        rev    = cmds.createNode('reverse')
        cmds.connectAttr('%s_poleLegFront_ctl_%s.follow' % (self.locus,self.count),'%s.%sW0' % (pConst,IKCtl))
        cmds.connectAttr('%s_poleLegFront_ctl_%s.follow' % (self.locus,self.count),'%s.inputX' % rev)
        cmds.connectAttr('%s.outputX' % rev,'%s.%s_poleLegFrontStatic_tgt_%sW1' % (pConst,self.locus,self.count))
        cmds.setAttr('%s.interpType' % pConst,2)
        
        # add extra wrist IK control
        ctl = cmds.circle(ch=False,n='%s_%sWristIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
        cth = cmds.group(n='%s_%sWristIk_cth_%s' % (self.locus,self.namespace,self.count))
        ctg = cmds.group(n='%s_%sWristIk_ctg_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(ctg,footBallPivot,r=True)
        cmds.parent('%s_legFrontIk_hdl_%s' % (self.locus,self.count),ctl)
         
        cmds.setAttr('%s.tx' % ctl,l=True,k=False)
        cmds.setAttr('%s.ty' % ctl,l=True,k=False)
        cmds.setAttr('%s.tz' % ctl,l=True,k=False)
        cmds.setAttr('%s.sx' % ctl,l=True,k=False)
        cmds.setAttr('%s.sy' % ctl,l=True,k=False)
        cmds.setAttr('%s.sz' % ctl,l=True,k=False)
        cmds.setAttr('%s.v' % ctl,l=True,k=False)
        
        cmds.setAttr('%s.legAim' % IKCtl,0)
        
コード例 #53
0
from sgMaya import sgCmds, sgModel
import pymel.core
from maya import cmds

slider     = sgCmds.makeController( sgModel.Controller.move2Points, 0.5 )
sliderBase = sgCmds.createSliderBase('x')
slider.setParent( sliderBase )

cmds.transformLimits( slider.name(), tx=[0,1], etx=[1,0] )
cmds.transformLimits( slider.name(), ty=[0,1], ety=[1,0] )

keyAttrs =  cmds.listAttr( slider.name(), k=1, sn=1 )
keyAttrs += cmds.listAttr( slider.name(), cb=1, sn=1 )

for keyAttr in keyAttrs:
    if keyAttr in ['tx','ty'] : continue
    cmds.setAttr( slider.attr( keyAttr ).name(), e=1, lock=1, k=0 )
    cmds.setAttr( slider.attr( keyAttr ).name(), e=1, cb=0 )

sliderBaseParent = sgCmds.makeParent( sliderBase )
pymel.core.select( sliderBaseParent )
コード例 #54
0
ファイル: tools.py プロジェクト: jonntd/Public
def limit(limitTransforms=[{'node': None, 'attr': None, 'min': None, 'max': None}]):
    """
    @type  limitTransforms: dictionary in a list
    @param limitTransforms: specify a dictionary in a list which includes
                            the object name, one attribute, the min and the
                            max keys storing the defined limitation values.
                            (ie: [{'node': 'C_bla_CTL',
                                   'attr': 'tx',
                                   'min': -2,
                                   'max': 2}])
    """
    assert limitTransforms, "limit: Please specify valid keys and values!"

    for d in limitTransforms:
        assert isinstance(limitTransforms, list), ("limit: Please specify a list!")
        node = None
        attr = None
        mini = None
        maxi = None
        for i in d.items():
            if i[0] == 'node':
                node = i[1]
            elif i[0] == 'attr':
                attr = i[1]
            elif i[0] == 'min':
                mini = i[1]
            elif i[0] == 'max':
                maxi = i[1]
            else:
                raise Exception("limit: Please define 'node','attr',"
                                "'min','max' as keys!")

        if not node[1]:
            if attr[1]:
                raise Exception("limit: Please specify a node!")
        else:
            if not attr[1]:
                raise Exception("limit: Please specify attribute!")
            if not isinstance(attr[1], str):
                raise Exception("limit: Please specify only one"
                                " valid attribute per dictionary!")

        if node:
            #--- enable the transforms
            enableMin = False
            enableMax = False

            if mini is not None:
                enableMin = True
            if maxi is not None:
                enableMax = True

            #--- specify default limitation values
            if attr.startswith('t'):
                if mini is None:
                    mini = -1
                if maxi is None:
                    maxi = 1
            elif attr.startswith('r'):
                if mini is None:
                    mini = -45
                if maxi is None:
                    maxi = 45
            if attr.startswith('s'):
                if mini is None:
                    mini = -1
                if maxi is None:
                    maxi = 1

            #--- set translation
            if attr == 'tx':
                cmds.transformLimits(node, etx=(enableMin, enableMax), tx=(mini, maxi))
            elif attr == 'ty':
                cmds.transformLimits(node, ety=(enableMin, enableMax), ty=(mini, maxi))
            elif attr == 'tz':
                cmds.transformLimits(node, etz=(enableMin, enableMax), tz=(mini, maxi))

            #--- set rotation
            if attr == 'rx':
                cmds.transformLimits(node, erx=(enableMin, enableMax), rx=(mini, maxi))
            elif attr == 'ry':
                cmds.transformLimits(node, ery=(enableMin, enableMax), ry=(mini, maxi))
            elif attr == 'rz':
                cmds.transformLimits(node, erz=(enableMin, enableMax), rz=(mini, maxi))

            #--- set scale
            if attr == 'sx':
                cmds.transformLimits(node, esx=(enableMin, enableMax), sx=(mini, maxi))
            elif attr == 'sy':
                cmds.transformLimits(node, esy=(enableMin, enableMax), sy=(mini, maxi))
            elif attr == 'sz':
                cmds.transformLimits(node, esz=(enableMin, enableMax), sz=(mini, maxi))
コード例 #55
0
    def build(self):
        
        FKIKCtl       = '%s_legFkIk_ctl_%s' % (self.locus,self.count)
        IKCtl         = '%s_legIk_ctl_%s' % (self.locus,self.count)
        footBallPivot = '%s_footPivotBallLegBackIk_org_%s' % (self.locus,self.count)
        footRoll      = '%s_footRollLegBackIk_org_%s' % (self.locus,self.count)
        ballIkCtl     = '%s_legBallIk_ctl_%s' % (self.locus,self.count)
        legikhandle   = '%s_legIk_hdl_%s' % (self.locus,self.count)
        
        cmds.rename('%s_footPivotBallLegIk_org_%s' % (self.locus,self.count),footBallPivot)
        cmds.rename('%s_footRollLegIk_org_%s' % (self.locus,self.count),footRoll)
        
        cmds.ikHandle(legikhandle,e=True,sol='ikSpringSolver')
        
        # add attrs
        cmds.addAttr(FKIKCtl,ln='feetControls',at='double',min=0,max=1,dv=1)
        cmds.setAttr('%s.feetControls' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='swivel',at='double',dv=0)
        cmds.setAttr('%s.swivel' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeRoll',at='double',dv=0)
        cmds.setAttr('%s.toeRoll' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeSwivel',at='double',dv=0)
        cmds.setAttr('%s.toeSwivel' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='toeTwist',at='double',dv=0)
        cmds.setAttr('%s.toeTwist' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='heelBank',at='double',dv=0)
        cmds.setAttr('%s.heelBank' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='heelSwivel',at='double',dv=0)
        cmds.setAttr('%s.heelSwivel' % FKIKCtl,e=True,k=True)
        cmds.addAttr(FKIKCtl,ln='kneeWeighting',at='double',min=0,max=1,dv=0.5)
        cmds.setAttr('%s.kneeWeighting' % FKIKCtl,e=True,k=True)
        
        negate = 1
        if self.locus == 'L': 
            negate = -1
        elif self.locus == 'C':
            # fix the outer and inner foot bind joints if the foot is centered
            cmds.rename('L_%sInnerfoot_bnd_%s' % (self.namespace,self.count),'C_%sInnerfoot_bnd_%s' % (self.namespace,self.count))
            cmds.rename('R_%sOuterfoot_bnd_%s' % (self.namespace,self.count),'C_%sOuterfoot_bnd_%s' % (self.namespace,self.count))
        
        # constrain to the rig
        cmds.connectAttr('C_main_loc_0Shape.worldPosition','%s_%s_mod_%s.translate' % (self.locus,self.namespace,self.count))
        cmds.orientConstraint('C_main_loc_0','%s_%s_mod_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.parentConstraint('%s_%sAnkle_bnd_%s' % (self.locus,self.namespace,self.count),'%s_%sFKIK_org_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.parentConstraint('C_root_bnd_0','%s_%sCtl_org_%s' % (self.locus,self.namespace,self.count),mo=True)
        hiprootloc = cmds.spaceLocator(n='%s_hipRootFollow_loc_%s' % (self.locus,self.count))[0]
        cmds.parent(hiprootloc,'%s_%sHip_bnd_%s' % (self.locus,self.namespace,self.count),r=True)
        cmds.parent(hiprootloc,'C_root_bnd_0')
        cmds.setAttr('%s.v' % hiprootloc,0)
        
        cmds.orientConstraint(hiprootloc,'%s_%sAim_org_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.pointConstraint(hiprootloc,'%s_%sHipIk_jth_%s' % (self.locus,self.namespace,self.count),mo=True)
        cmds.setAttr('%s_%sHipIk_org_%s.inheritsTransform' % (self.locus,self.namespace,self.count),0)
                              
        ankle = cmds.duplicate('%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sAnkleIk_tmp_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        cmds.parent(ankle,w=True)
        
        posA = cmds.xform('%s_%sKnee_bnd_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
        posB = cmds.xform('comp_%s%s:R_knee_ctl_0' % (self.namespace,self.count),q=True,ws=True,t=True)
        
        if round(posA[0]) != round(posB[0]*negate) or round(posA[1]) != round(posB[1]) or round(posA[2]) != round(posB[2]): 
        
            # reposition the pole vector control - this messes up the joint orientations
            cmds.delete('%s_poleLeg_prc_%s' % (self.locus,self.count))
            pos    = cmds.xform('comp_%s%s:R_poleVector_loc_0' % (self.namespace,self.count),q=True,ws=True,t=True)
            cmds.move(pos[0]*negate,pos[1],pos[2],'%s_poleLegStatic_tgt_%s' % (self.locus,self.count),ws=True)
            cmds.move(pos[0]*negate,pos[1],pos[2],'%s_poleLeg_org_%s' % (self.locus,self.count),ws=True)
            pConst = cmds.parentConstraint(IKCtl,'%s_poleLegStatic_tgt_%s' % (self.locus,self.count),'%s_poleLeg_org_%s' % (self.locus,self.count),mo=True)[0]
            rev    = cmds.createNode('reverse')
            cmds.connectAttr('%s_poleLeg_ctl_%s.follow' % (self.locus,self.count),'%s.%sW0' % (pConst,IKCtl))
            cmds.connectAttr('%s_poleLeg_ctl_%s.follow' % (self.locus,self.count),'%s.inputX' % rev)
            cmds.connectAttr('%s.outputX' % rev,'%s.%s_poleLegStatic_tgt_%sW1' % (pConst,self.locus,self.count))
            cmds.setAttr('%s.interpType' % pConst,2)
        
        # re create IK chain to set correct the messed up orientations
        cmds.select(cl=True)
        hock  = cmds.joint(n='%s_%sHockIk_tmp_%s' % (self.locus,self.namespace,self.count))
        knee  = cmds.joint(n='%s_%sKneeIk_tmp_%s' % (self.locus,self.namespace,self.count))
        
        cmds.parent(knee,'%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),r=True)
        cmds.setAttr('%s.rx' % knee,180)
        cmds.parent(knee,'%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(hock,'%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),r=True)
        cmds.setAttr('%s.rx' % hock,180)
        cmds.parent(hock,knee)
        cmds.parent(ankle,hock)
        
        plug = cmds.listConnections('%s_%sKneeIk_jnt_%s.tx' % (self.locus,self.namespace,self.count),s=True,d=False,p=True)[0]
        cmds.connectAttr(plug,'%s.tx' % knee)
        plug = cmds.listConnections('%s_%sHockIk_jnt_%s.tx' % (self.locus,self.namespace,self.count),s=True,d=False,p=True)[0]
        cmds.connectAttr(plug,'%s.tx' % hock)
        
        cmds.delete(legikhandle)
        cmds.parent('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),w=True)
        cmds.parent('%s_fKAlignedLegIk_org_%s' % (self.locus,self.count),w=True)
        cmds.parent('%s_poleLeg_ann_%s' % (self.locus,self.count),w=True,r=True)
        cmds.delete('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count))
        
        cmds.makeIdentity('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),a=True,r=True)
        cmds.joint('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),e=True,spa=True,ch=True)
        legikhandle = cmds.ikHandle(sj='%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),ee=ankle,sol='ikSpringSolver')[0]
        cmds.poleVectorConstraint('%s_poleLeg_ctl_%s' % (self.locus,self.count),legikhandle)
        
        cmds.parent('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),ankle)
        cmds.parent('%s_fKAlignedLegIk_org_%s' % (self.locus,self.count),ankle)
        cmds.parent(legikhandle,footBallPivot)
        
        handle = cmds.ikHandle(sj=ankle,ee='%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),sol='ikSCsolver')[0]
        cmds.parent(handle,footBallPivot)
        cmds.setAttr('%s.v' % handle,0)
        
        # rename tmp joints and reconstrain bind joints
        cmds.rename(knee,'%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.rename(hock,'%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count))
        cmds.rename(ankle,'%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sKnee_bnd_%s' % (self.locus,self.namespace,self.count),mo=False)[0]
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sKneeIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint('%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sHock_bnd_%s' % (self.locus,self.namespace,self.count),mo=False)[0]
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sHockIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint('%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sAnkle_bnd_%s' % (self.locus,self.namespace,self.count),mo=False)[0]
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sAnkleIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        
        # fix the fk chain orientations
        knee  = '%s_%sKneeFk_ctj_%s' % (self.locus,self.namespace,self.count)
        hock  = '%s_%sHockFk_ctj_%s' % (self.locus,self.namespace,self.count)
        ankle = '%s_%sAnkleFk_ctj_%s' % (self.locus,self.namespace,self.count)
        cmds.parent(knee,w=True)
        cmds.parent(hock,w=True)
        cmds.parent(ankle,w=True)
        
        cmds.delete(cmds.aimConstraint(hock,knee,wut='object',wuo='comp_%s%s:%s_poleVector_loc_0' % (self.namespace,self.count,self.locus),aim=[negate,0,0],u=[0,negate,0]))
        cmds.delete(cmds.aimConstraint(ankle,hock,wut='object',wuo='comp_%s%s:%s_poleVector_loc_0' % (self.namespace,self.count,self.locus),aim=[negate,0,0],u=[0,negate,0]))
        
        cmds.parent(ankle,'%s_%sHockFk_ctl_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(hock,'%s_%sKneeFk_ctl_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(knee,'%s_%sHipFk_jnt_%s' % (self.locus,self.namespace,self.count))
        
        # connect fkikctl attrs to ik foot ctl attrs
        cmds.connectAttr('%s.swivel' % FKIKCtl,'%s.swivel' % IKCtl)
        cmds.setAttr('%s.swivel' % IKCtl,l=True,k=False)
        cmds.setAttr('%s.toe' % IKCtl,l=True,k=False)
        cmds.setAttr('%s.rollAngle' % IKCtl,l=True,k=False)
        
        # add control to IK feet controls to hide other controls
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legToeIk_ctl_%sShape.v' % (self.locus,self.count))
        cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legHeelIk_ctl_%sShape.v' % (self.locus,self.count))
        
        # add follow to ik feet controls
        cmds.addAttr(IKCtl,ln='follow',at='double',min=0,max=1,dv=0)
        cmds.setAttr('%s.follow' % IKCtl,e=True,k=True)
        
        pConst = cmds.parentConstraint('%s_%sIK_org_%s' % (self.locus,self.namespace,self.count),'C_root_bnd_0','%s_legIk_org_%s' % (self.locus,self.count),mo=True)[0]
        rev    = cmds.createNode('reverse')
        
        cmds.connectAttr('%s.follow' % IKCtl,'%s.C_root_bnd_0W1' % pConst)
        cmds.connectAttr('%s.follow' % IKCtl,'%s.inputX' % rev)
        cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sIK_org_%sW0' % (pConst,self.locus,self.namespace,self.count))
        cmds.setAttr('%s.interpType' % pConst, 2)
        
        # reconnect foot roll
#         cmds.parent(footBallPivot, '%s_legBallIk_cth_%s' % (self.locus,self.count))
#         cmds.setAttr('%s.roll' % IKCtl,l=True,cb=False,k=False)
#         cmds.connectAttr('%s.swivel' % IKCtl,'%s_legToeIk_cth_%s.ry' % (self.locus,self.count))
#         cmds.disconnectAttr('%s.swivel' % IKCtl,'%s_poleAimLeg_amc_%s.offsetX' % (self.locus,self.count))
        
        # add foot bank
        off = cmds.group(em=True,n='%s_%sFootBankInIk_off_%s' % (self.locus,self.namespace,self.count))
        inn = cmds.group(em=True,n='%s_%sFootBankInIk_org_%s' % (self.locus,self.namespace,self.count))
        cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),inn,mo=False))
        cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),off,mo=False))
        
        out = cmds.group(em=True,n='%s_%sFootBankOutIk_org_%s' % (self.locus,self.namespace,self.count))
        cmds.delete(cmds.parentConstraint('%s_%sOuterfoot_bnd_%s' % (self.locus,self.namespace,self.count),out,mo=False))
        
        cmds.parent(off,IKCtl)
        cmds.parent(inn,off)
        cmds.parent(out,inn)
        cmds.parent(footRoll,out)
        
        cmds.setAttr('%s.rz' % ballIkCtl,l=False,k=True)
        cmds.transformLimits(ballIkCtl,erz=[0,0])
        
        cond = cmds.createNode('condition')
        mult = cmds.createNode('multiplyDivide')
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
        if self.locus == 'R': cmds.setAttr('%s.operation' % cond,2)
        else: cmds.setAttr('%s.operation' % cond,4)
        cmds.setAttr('%s.colorIfFalseR' % cond,0)
        cmds.setAttr('%s.input2X' % mult,negate)
        cmds.connectAttr('%s.outColorR' % cond,'%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.rx' % out)
        
        cond = cmds.createNode('condition')
        mult = cmds.createNode('multiplyDivide')
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
        cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
        if self.locus == 'R': cmds.setAttr('%s.operation' % cond,4)
        else: cmds.setAttr('%s.operation' % cond,2)
        cmds.setAttr('%s.colorIfFalseR' % cond,0)
        cmds.setAttr('%s.input2X' % mult,negate)
        cmds.connectAttr('%s.outColorR' % cond,'%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.rx' % inn)
        
        dup = cmds.duplicate(ballIkCtl,po=True,n='%s_legBallIk_dmy_%s' % (self.locus,self.count))[0]
        cmds.parent(footBallPivot,dup)
        cmds.connectAttr('%s.rx' % ballIkCtl,'%s.rx' % dup)
        
        # reorient the toes and midfoot controls
#         toe    = cmds.circle(ch=False)[0]
#         midfoot = cmds.circle(ch=False)[0]
#         new     = [toe,midfoot]
#         old     = ['%s_%sToesFk_ctl_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootFk_ctl_%s' % (self.locus,self.namespace,self.count)]
#          
#         i = 0
#         while True:
#             if i == len(new): break
#              
#             a   = new[i]
#             b   = old[i]
#             p   = cmds.listRelatives(b,p=True)[0]
#             gp  = cmds.listRelatives(p,p=True)[0]
#             pos = cmds.xform(b,q=True,ws=True,t=True)
#             cmds.move(pos[0],pos[1],pos[2],a,ws=True)
#             cmds.parent(b,a)
#             cmds.parent(p,w=True)
#             cmds.setAttr('%s.rotate' % p,0,0,0)
#             cmds.parent(p,gp)
#             cmds.parent(a,p)
#             shpA = cmds.listRelatives(a,s=True)[0]
#             cmds.setAttr('%s.overrideEnabled' % shpA,1)
#             shpB = cmds.listRelatives(b,s=True)[0]
#             plg = cmds.listConnections('%s.v' % shpB,s=True,d=False,p=True)
#             if plg:
#                 cmds.disconnectAttr(plg[0],'%s.v' % shpB)
#                 cmds.connectAttr(plg[0],'%s.v' % shpA)
#             cmds.setAttr('%s.v' % shpB,0)
#             cmds.setAttr('%s.v' % a,l=True,k=False)
#             cmds.connectAttr('%s.sx' % a, '%s.sz' % b)
#             cmds.connectAttr('%s.sy' % a, '%s.sy' % b)
#             cmds.connectAttr('%s.sz' % a, '%s.sx' % b)
#             cmds.rename(b,string.replace(b,'_ctl_','_dmy_'))
#             cmds.rename(shpA,'%sShape' % b)
#             cmds.rename(a,b)
#             i = i + 1
            
        # rerig foot roll to incorporate the toe joint
#         cmds.delete('%s_%sToesEnd_bnd_%s' % (self.locus,self.namespace,self.count))
#         cmds.parent('%s_legToe_bnd_%s' % (self.locus,self.count),'%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count))
#         # create toes IK joint
#         toesIKJoint = cmds.joint(n='%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count))
#         pos         = cmds.xform('%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
#         cmds.move(pos[0],pos[1],pos[2],toesIKJoint,ws=True)
#         cmds.parent(toesIKJoint,'%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count))
#         cmds.makeIdentity(toesIKJoint,a=True,r=True,jo=True)
#         cmds.parent('%s_legToeIk_jnt_%s' % (self.locus,self.count),toesIKJoint)
#         # new rotational groups
#         org = cmds.group(em=True,n='%s_%sToesPivotBallLegIK_org_%s' % (self.locus,self.namespace,self.count))
#         cmds.parent(org,'%s_legBallIk_cth_%s' % (self.locus,self.count),r=True)
#         cmds.move(pos[0],pos[1],pos[2],org,ws=True)
#         cmds.parent(footBallPivot,org)
#         # toe ik handles
#         #cmds.delete('%s_liftToeLegToeIk_org_%s' % (self.locus,self.count))
#         toesIK = cmds.ikHandle(sj='%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),ee=toesIKJoint)[0]
#         toeIK  = cmds.ikHandle(sj=toesIKJoint,ee='%s_legToeIk_jnt_%s' % (self.locus,self.count))[0]
#         cmds.setAttr('%s.v' % toesIK,0)
#         cmds.setAttr('%s.v' % toeIK,0)
        
        # connect roll
#         clamp = cmds.createNode('clamp')
#         mult  = cmds.createNode('multiplyDivide')
#         cmds.setAttr('%s.maxR' % clamp,99999)
#         cmds.setAttr('%s.input2X' % mult,0.25)
#         cmds.connectAttr('%s.rx' % ballIkCtl,'%s.inputR' % clamp)
#         cmds.connectAttr('%s.outputR' % clamp,'%s.input1X' % mult)
#         cmds.connectAttr('%s.outputX' % mult,'%s_%sToesPivotBallLegIK_org_%s.rx' % (self.locus,self.namespace,self.count))
#         cmds.connectAttr('%s.outputR' % clamp,'%s.rx' % footBallPivot)
#         clamp = cmds.createNode('clamp')
#         #avg   = cmds.createNode('plusMinusAverage')
#         plug  = cmds.listConnections('%s_rollLegHeelIk_org_%s.rx' % (self.locus,self.count),s=True,d=False,p=True)[0]
#         cmds.setAttr('%s.minR' % clamp,-99999)
#         cmds.connectAttr('%s.rx' % ballIkCtl,'%s.inputR' % clamp)
#         cmds.disconnectAttr(plug,'%s_rollLegHeelIk_org_%s.rx' % (self.locus,self.count))
#         cmds.connectAttr('%s.outputR' % clamp,'%s_rollLegHeelIk_org_%s.rx' % (self.locus,self.count))
#         cmds.connectAttr('%s.heelBank' % FKIKCtl,'%s.rz' % footBallPivot)
#         cmds.connectAttr('%s.heelBank' % FKIKCtl,'%s_%sToesPivotBallLegIK_org_%s.rz' % (self.locus,self.namespace,self.count))
#         #cmds.setAttr('%s.input1D[0]' % avg,cmds.getAttr('%s.ry' % footBallPivot))
#         #cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s.input1D[1]' % avg)
#         #cmds.connectAttr('%s.output1D' % avg, '%s.ry' % footBallPivot)
#         children = cmds.listRelatives(footBallPivot,c=True)
#         cmds.parent(children,w=True)
#         cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s.ry' % footBallPivot)
#         cmds.parent(children,footBallPivot)
#         cmds.connectAttr('%s.heelSwivel' % FKIKCtl,'%s_%sToesPivotBallLegIK_org_%s.ry' % (self.locus,self.namespace,self.count))
#         # create 'fk' controls
#         toesctl = cmds.circle(ch=False,n='%s_%sToesIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
#         toescth = cmds.group(n='%s_%sToesIk_cth_%s' % (self.locus,self.namespace,self.count))
#         toesctg = cmds.group(n='%s_%sToesIk_ctg_%s' % (self.locus,self.namespace,self.count))
#         toesdummyoff = cmds.group(n='%s_%sToesIkDummy_off_%s' % (self.locus,self.namespace,self.count),em=True)
#         toesdummyorg = cmds.group(n='%s_%sToesIkDummy_org_%s' % (self.locus,self.namespace,self.count))
#         #cmds.move(pos[0],pos[1],pos[2],toesctg,ws=True)
#         #cmds.move(pos[0],pos[1],pos[2],toesdummyorg,ws=True)
#         cmds.delete(cmds.parentConstraint('%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),toesctg,mo=False))
#         cmds.delete(cmds.parentConstraint('%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),toesdummyorg,mo=False))
#         
#         pos = cmds.xform('%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
#         footctl = cmds.circle(ch=False,n='%s_%sMidfootIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
#         footcth = cmds.group(n='%s_%sMidfootIk_cth_%s' % (self.locus,self.namespace,self.count))
#         footctg = cmds.group(n='%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count))
#         footdummyoff  = cmds.group(n='%s_%sMidfootIkDummy_off_%s' % (self.locus,self.namespace,self.count),em=True)
#         footdummyorg  = cmds.group(n='%s_%sMidfootIkDummy_org_%s' % (self.locus,self.namespace,self.count))
#         footdummymain = cmds.group(n='%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count))
#         #cmds.move(pos[0],pos[1],pos[2],footctg,ws=True)
#         #cmds.move(pos[0],pos[1],pos[2],footdummyorg,ws=True)
#         cmds.delete(cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),footctg,mo=False))
#         cmds.delete(cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),footdummymain,mo=False))
#         
#         cmds.setAttr('%s.tx' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.ty' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.tz' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.sx' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.sy' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.sz' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.v' % toesctl,l=True,k=False)
#         cmds.setAttr('%s.tx' % footctl,l=True,k=False)
#         cmds.setAttr('%s.ty' % footctl,l=True,k=False)
#         cmds.setAttr('%s.tz' % footctl,l=True,k=False)
#         cmds.setAttr('%s.sx' % footctl,l=True,k=False)
#         cmds.setAttr('%s.sy' % footctl,l=True,k=False)
#         cmds.setAttr('%s.sz' % footctl,l=True,k=False)
#         cmds.setAttr('%s.v' % footctl,l=True,k=False)
#         
#         cmds.parent(toesctg,footctl)
#         cmds.parent(toesdummyorg,footdummyoff)
#         #cmds.parent(footdummyorg,footdummymain)
#         cmds.parent(footctg,'%s_legToeIk_ctl_%s' % (self.locus,self.count))
#         cmds.parent(footdummymain,'%s_legToeIk_ctl_%s' % (self.locus,self.count))
#         cmds.parent(toeIK,toesdummyoff)
#         cmds.parent(toesIK,footdummyoff)
#         
#         #####################################
#         #####################################
#         #####################################
#         #####################################
#         cmds.connectAttr('%s.rotate' % toesctl,'%s.rotate' % toesdummyoff)
#         cmds.connectAttr('%s.rotate' % footctl,'%s.rotate' % footdummyoff)
#         #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toescth)
#         #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footcth)
#         #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toesdummyorg)
#         #cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footdummyorg)
#         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % toescth)
#         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % footcth)
#         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % toesdummyorg)
#         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rz' % footdummyorg)
#         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toescth)
#         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footcth)
#         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toesdummyorg)
#         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footdummyorg)
#         #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toescth)
#         #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footcth)
#         #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toesdummyorg)
#         #cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footdummyorg)
#         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % toescth)
#         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % footcth)
#         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % toesdummyorg)
#         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rx' % footdummyorg)
# #         cmds.parent(toesctg,footctl)
# #         cmds.parent(toesdummyorg,footdummyoff)
# #         cmds.parent(footctg,'%s_legToeIk_ctl_%s' % (self.locus,self.count))
# #         cmds.parent(footdummyorg,'%s_legToeIk_ctl_%s' % (self.locus,self.count))
# #         cmds.parent(toeIK,toesdummyoff)
# #         cmds.parent(toesIK,footdummyoff)
# #         cmds.connectAttr('%s.rotate' % toesctl,'%s.rotate' % toesdummyoff)
# #         cmds.connectAttr('%s.rotate' % footctl,'%s.rotate' % footdummyoff)
# #         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toescth)
# #         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footcth)
# #         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % toesdummyorg)
# #         cmds.connectAttr('%s.toeRoll' % FKIKCtl,'%s.rx' % footdummyorg)
# #         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toescth)
# #         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footcth)
# #         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % toesdummyorg)
# #         cmds.connectAttr('%s.toeSwivel' % FKIKCtl,'%s.ry' % footdummyorg)
# #         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toescth)
# #         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footcth)
# #         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % toesdummyorg)
# #         cmds.connectAttr('%s.toeTwist' % FKIKCtl,'%s.rz' % footdummyorg)
#         
#         cmds.parentConstraint('%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),footctg,mo=True)
#         cmds.parentConstraint('%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),toesctg,mo=True)
#         # connect shape visibility
#         shp = cmds.listRelatives(toesctl,s=True)[0]
#         cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s.v' % shp)
#         shp = cmds.listRelatives(footctl,s=True)[0]
#         cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s.v' % shp)
#         # move original fk controls
#         cmds.parent('%s_%sMidfootFk_ctj_%s' % (self.locus,self.namespace,self.count),'%s_%sAnkleFk_jnt_%s' % (self.locus,self.namespace,self.count))
#         cmds.parent('%s_%sToesFk_ctj_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootFk_jnt_%s' % (self.locus,self.namespace,self.count))
#         cmds.delete('%s_to%sMidfootFk_jth_%s' % (self.locus,self.namespace,self.count),'%s_to%sAnkleFk_jth_%s' % (self.locus,self.namespace,self.count))
#         # constrain bind joints
#         for constraint in cmds.listConnections('%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count),s=True,d=False):
#             if cmds.objectType(constraint,isAType='constraint'):
#                 cmds.delete(constraint)
#                 break
#         pConst = cmds.parentConstraint('%s_%sMidfootFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfootIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sMidfoot_bnd_%s' % (self.locus,self.namespace,self.count))[0]
#         rev    = cmds.createNode('reverse')
#         cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.inputX' % rev)
#         cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sMidfootIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
#         cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sMidfootFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
#         
#         for constraint in cmds.listConnections('%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count),s=True,d=False):
#             if cmds.objectType(constraint,isAType='constraint'):
#                 cmds.delete(constraint)
#                 break
#         pConst = cmds.parentConstraint('%s_%sToesFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sToesIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sToes_bnd_%s' % (self.locus,self.namespace,self.count))[0]
#         cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_%sToesIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
#         cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sToesFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
        
        # replace the ik control with split translational/rotational controls
#         ctg = cmds.duplicate('%s_%sAnkleFk_cth_%s' % (self.locus,self.namespace,self.count),n='%s_%sAnkleIk_ctg_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         cth = cmds.duplicate('%s_%sAnkleFk_cth_%s' % (self.locus,self.namespace,self.count),n='%s_%sAnkleIk_cth_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         ctl = cmds.duplicate('%s_%sAnkleFk_ctl_%s' % (self.locus,self.namespace,self.count),n='%s_%sAnkleIk_ctl_%s' % (self.locus,self.namespace,self.count))[0]
#         cmds.delete(cmds.listRelatives(ctl,type='joint',f=True))
#         cmds.parent(ctl,cth)
#         cmds.parent(cth,ctg)
#         cmds.parent(ctg,IKCtl)
#         cmds.makeIdentity(ctg,a=True,r=True)
#         cmds.parent('%s_%sFootBankInIk_org_%s' % (self.locus,self.namespace,self.count),ctl)
        
        # create dummy ik leg to constrain the ankle rotation controls
#         hip   = cmds.duplicate('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sHipIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         knee  = cmds.duplicate('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sKneeIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         hock  = cmds.duplicate('%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sHockIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         ankle = cmds.duplicate('%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_%sAnkleIk_dmy_%s' % (self.locus,self.namespace,self.count),po=True)[0]
#         cmds.parent(ankle,hock)
#         cmds.parent(hock,knee)
#         cmds.parent(knee,hip)
#         dummyikhandle = cmds.ikHandle(sj=hip,ee=ankle,sol='ikSpringSolver')[0]
#         cmds.parent(dummyikhandle,IKCtl)
#         cmds.poleVectorConstraint('%s_poleLeg_ctl_%s' % (self.locus,self.count),dummyikhandle)
        
        # setup the global orientation blending of the ik ankle rotational control
#         pConst = cmds.parentConstraint(ankle,IKCtl,ctg,st=['x','y','z'],mo=True)[0]
#         rev    = cmds.createNode('reverse')
#         cmds.connectAttr('%s.Global' % ctl,'%s.%sW1' % (pConst,IKCtl))
#         cmds.connectAttr('%s.Global' % ctl,'%s.inputX' % rev)
#         cmds.connectAttr('%s.outputX' % rev,'%s.%sW0' % (pConst,ankle))
#         cmds.setAttr('%s.interpType' % pConst,2)
#         cmds.setAttr('%s.Global' % ctl,1)
        
        # lower the foot roll controls to the ground plane
        cmds.setAttr('%s_rollLegBallIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegBallIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegBallIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.parent('%s_rollLegBallIk_org_%s' % (self.locus,self.count),w=True)
        #cmds.parent('%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count),w=True)
        #cmds.parent('%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count),w=True)
        cmds.setAttr('%s_rollLegHeelIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegHeelIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegHeelIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegToeIk_org_%s.tx' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegToeIk_org_%s.ty' % (self.locus,self.count),l=False,k=True)
        cmds.setAttr('%s_rollLegToeIk_org_%s.tz' % (self.locus,self.count),l=False,k=True)
        cmds.parent('%s_legToeIk_hdl_%s' % (self.locus,self.count),w=True)
        cmds.move(0,0,0,'%s_rollLegHeelIk_org_%s' % (self.locus,self.count),ws=True,x=False,y=True,z=False)
        cmds.move(0,0,0,'%s_rollLegToeIk_org_%s' % (self.locus,self.count),ws=True,x=False,y=True,z=False)
        cmds.parent('%s_rollLegBallIk_org_%s' % (self.locus,self.count),'%s_legToeIk_ctl_%s' % (self.locus,self.count))
        cmds.parent('%s_legToeIk_hdl_%s' % (self.locus,self.count),'%s_liftToeLegToeIk_org_%s' % (self.locus,self.count))
        #cmds.parent('%s_%sMidfootIk_ctg_%s' % (self.locus,self.namespace,self.count),'%s_legToeIk_ctl_%s' % (self.locus,self.count))
        #cmds.parent('%s_%sFootIkDummy_org_%s' % (self.locus,self.namespace,self.count),'%s_legToeIk_ctl_%s' % (self.locus,self.count))
        
        # fix the IK partial stretching
        if not cmds.listConnections('%s_%sAnkleIk_jnt_%s.tx' % (self.locus,self.namespace,self.count),s=True,d=False):
            mult = cmds.createNode('multiplyDivide')
            x    = cmds.getAttr('%s_%sAnkleIk_jnt_%s.tx' % (self.locus,self.namespace,self.count))
            cmds.setAttr('%s.input1X' % mult,x)
            cmds.connectAttr('%s_messureDivLegIk_mdn_%s.outputX' % (self.locus,self.count),'%s.input2X' % mult)
            cmds.connectAttr('%s.outputX' % mult,'%s_%sAnkleIk_jnt_%s.tx' % (self.locus,self.namespace,self.count))
        
        # create the secondary IK structure
        ctl = cmds.circle(n='%s_%sHipIk_ctl_%s' % (self.locus,self.namespace,self.count),d=3,s=8,ch=False,nr=[1,0,0])[0]
        cth = cmds.group(n='%s_%sHipIk_cth_%s' % (self.locus,self.namespace,self.count))
        ctg = cmds.group(n='%s_%sHipIk_ctg_%s' % (self.locus,self.namespace,self.count))
        org = cmds.group(n='%s_secondaryIk_org_%s' % (self.locus,self.count))
        loc = cmds.spaceLocator(n='%s_%sKneeIk_loc_%s' % (self.locus,self.namespace,self.count))[0]
        
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.v' % org)
        
        cmds.setAttr('%s.tx' % ctl,l=True,k=False)
        cmds.setAttr('%s.ty' % ctl,l=True,k=False)
        cmds.setAttr('%s.tz' % ctl,l=True,k=False)
        cmds.setAttr('%s.rx' % ctl,l=True,k=False)
        cmds.setAttr('%s.sx' % ctl,l=True,k=False)
        cmds.setAttr('%s.sy' % ctl,l=True,k=False)
        cmds.setAttr('%s.sz' % ctl,l=True,k=False)
        cmds.setAttr('%s.v' % ctl,l=True,k=False)
        
        # position hip control
        cmds.parent(org,'%s_%sIK_org_%s' % (self.locus,self.namespace,self.count))
        cmds.parentConstraint('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),ctg,mo=False)
        
        # position knee locator
        cmds.parent(loc,ctl,r=True)
        cmds.connectAttr('%s_%sKneeIk_jnt_%s.tx' % (self.locus,self.namespace,self.count),'%s.tx' % loc)
        cmds.setAttr('%s.v' % loc,0)
        
        # duplicate knee
        knee  = cmds.duplicate('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_secondary%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        hock  = cmds.duplicate('%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_secondary%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        ankle = cmds.duplicate('%s_%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_secondary%sAnkleIk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        
        if not cmds.listConnections('%s.drawOverride' % knee,s=True,d=False):
            cmds.connectAttr('controlJointLayer.drawInfo','%s.drawOverride' % knee)
            cmds.connectAttr('controlJointLayer.drawInfo','%s.drawOverride' % hock)
        cmds.connectAttr('%s_%sHockIk_jnt_%s.tx' % (self.locus,self.namespace,self.count),'%s.tx' % hock)
        
        cmds.parent(ankle,hock)
        cmds.parent(hock,knee)
        cmds.parent('%s_poleLeg_ann_%s' % (self.locus,self.count),knee,r=True)
        cmds.parent(knee,org)
        
        # create IK
        handle = cmds.ikHandle(sj=knee,ee=ankle,sol='ikRPsolver')[0]
        cmds.parent(handle,footBallPivot)
        cmds.poleVectorConstraint('%s_poleLeg_ctl_%s' % (self.locus,self.count),handle)[0]
        cmds.pointConstraint(loc,knee)
        cmds.setAttr('%s.v' % handle,0)
        posA = cmds.xform('%s_%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),q=True,ws=True,t=True)
        posB = cmds.xform(hock,q=True,ws=True,t=True)
        
        if round(posA[0]) != round(posB[0]) or round(posA[1]) != round(posB[1]) or round(posA[2]) != round(posB[2]):
            cmds.setAttr('%s.twist' % handle,180)
        
        # setup the IK hip twist
        hipTwistIK  = cmds.duplicate('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_twist%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        kneeTwistIK = cmds.duplicate('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_twist%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        
        cmds.parent(kneeTwistIK,hipTwistIK)
        cmds.parent(hipTwistIK,'%s_%sAim_org_%s' % (self.locus,self.namespace,self.count))
        
        handle  = cmds.ikHandle(sj=hipTwistIK,ee=kneeTwistIK,sol='ikRPsolver')[0]
        cmds.parent(handle,ctl)
        cmds.poleVectorConstraint(hiprootloc,handle)[0]
        cmds.pointConstraint(hiprootloc,hipTwistIK)
        cmds.setAttr('%s.v' % handle,0)
        
#         mult = cmds.createNode('multiplyDivide')
#         cmds.connectAttr('C_root_bnd_0.rx','%s.input1X' % mult)
#         cmds.connectAttr('%s.outputX' % mult,'%s.twist' % handle)
#         cmds.setAttr('%s.input2X' % mult,-1)
        
        twistLocAIK = cmds.spaceLocator(n='%s_%sHipIkTwistA_loc_%s' % (self.locus,self.namespace,self.count))[0]
        twistLocBIK = cmds.spaceLocator(n='%s_%sHipIkTwistB_loc_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.parent(twistLocAIK,twistLocBIK,hipTwistIK,r=True)
        pConst = cmds.pointConstraint(hipTwistIK,kneeTwistIK,twistLocAIK,mo=False)[0]
        oConst = cmds.orientConstraint(ctl,hipTwistIK,twistLocAIK,mo=False)[0]
        cmds.setAttr('%s.interpType' % oConst,2)
        cmds.setAttr('%s.%sW0' % (pConst,hipTwistIK),0.65)
        cmds.setAttr('%s.%sW1' % (pConst,kneeTwistIK),0.35)
        cmds.setAttr('%s.%sW0' % (oConst,ctl),0.35)
        cmds.setAttr('%s.%sW1' % (oConst,hipTwistIK),0.65)
        pConst = cmds.pointConstraint(hipTwistIK,kneeTwistIK,twistLocBIK,mo=False)[0]
        oConst = cmds.orientConstraint(ctl,hipTwistIK,twistLocBIK,mo=False)[0]
        cmds.setAttr('%s.interpType' % oConst,2)
        cmds.setAttr('%s.%sW0' % (pConst,hipTwistIK),0.35)
        cmds.setAttr('%s.%sW1' % (pConst,kneeTwistIK),0.65)
        cmds.setAttr('%s.%sW0' % (oConst,ctl),0.65)
        cmds.setAttr('%s.%sW1' % (oConst,hipTwistIK),0.35)
        
        # setup the FK hip twist
        hipTwistFK  = cmds.duplicate('%s_%sHipIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_twist%sHipFk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        kneeTwistFK = cmds.duplicate('%s_%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),n='%s_twist%sKneeFk_jnt_%s' % (self.locus,self.namespace,self.count),po=True)[0]
        
        cmds.parent(kneeTwistFK,hipTwistFK)
        cmds.parent(hipTwistFK,'%s_%sAim_org_%s' % (self.locus,self.namespace,self.count))
        
        handle = cmds.ikHandle(sj=hipTwistFK,ee=kneeTwistFK,sol='ikRPsolver')[0]
        cmds.parent(handle,'%s_%sHipFk_ctl_%s' % (self.locus,self.namespace,self.count))
        cmds.poleVectorConstraint('%s_%sHipFk_ctl_%s' % (self.locus,self.namespace,self.count),handle)[0]
        cmds.pointConstraint('%s_%sHipFk_ctl_%s' % (self.locus,self.namespace,self.count),hipTwistFK)
        cmds.setAttr('%s.v' % handle,0)
        
        mult = cmds.createNode('multiplyDivide')
        cmds.connectAttr('C_root_bnd_0.rx','%s.input1X' % mult)
        cmds.connectAttr('%s.outputX' % mult,'%s.twist' % handle)
        cmds.setAttr('%s.input2X' % mult,-1)
        
        twistLocAFK = cmds.spaceLocator(n='%s_%sHipFkTwistA_loc_%s' % (self.locus,self.namespace,self.count))[0]
        twistLocBFK = cmds.spaceLocator(n='%s_%sHipFkTwistB_loc_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.parent(twistLocAFK,twistLocBFK,hipTwistFK,r=True)
        pConst = cmds.pointConstraint(hipTwistFK,kneeTwistFK,twistLocAFK,mo=False)[0]
        oConst = cmds.orientConstraint('%s_%sHipFk_ctl_%s' % (self.locus,self.namespace,self.count),hipTwistFK,twistLocAFK,mo=False)[0]
        cmds.setAttr('%s.interpType' % oConst,2)
        cmds.setAttr('%s.%sW0' % (pConst,hipTwistFK),0.65)
        cmds.setAttr('%s.%sW1' % (pConst,kneeTwistFK),0.35)
        cmds.setAttr('%s.%s_%sHipFk_ctl_%sW0' % (oConst,self.locus,self.namespace,self.count),0.35)
        cmds.setAttr('%s.%sW1' % (oConst,hipTwistFK),0.65)
        pConst = cmds.pointConstraint(hipTwistFK,kneeTwistFK,twistLocBFK,mo=False)[0]
        oConst = cmds.orientConstraint('%s_%sHipFk_ctl_%s' % (self.locus,self.namespace,self.count),hipTwistFK,twistLocBFK,mo=False)[0]
        cmds.setAttr('%s.interpType' % oConst,2)
        cmds.setAttr('%s.%sW0' % (pConst,hipTwistFK),0.35)
        cmds.setAttr('%s.%sW1' % (pConst,kneeTwistFK),0.65)
        cmds.setAttr('%s.%s_%sHipFk_ctl_%sW0' % (oConst,self.locus,self.namespace,self.count),0.65)
        cmds.setAttr('%s.%sW1' % (oConst,hipTwistFK),0.35)
        
        # re-constrain the bind joints
        cmds.delete('%s_%sHip_prc_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint(hipTwistFK,hipTwistIK,'%s_%sHip_bnd_%s' % (self.locus,self.namespace,self.count),mo=True)[0]
        cmds.setAttr('%s.interpType' % pConst,2)
        cmds.connectAttr('%s_blendLegFkIk_rev_%s.outputX' % (self.locus,self.count),'%s.%sW0' % (pConst,hipTwistFK))
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%sW1' % (pConst,hipTwistIK))
        
        cmds.delete('%s_%sKnee_prc_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint('%s_%sKneeFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_secondary%sKneeIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sKnee_bnd_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.setAttr('%s.interpType' % pConst,2)
        cmds.connectAttr('%s_blendLegFkIk_rev_%s.outputX' % (self.locus,self.count),'%s.%s_%sKneeFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_secondary%sKneeIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        
        cmds.delete('%s_%sHock_prc_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint('%s_%sHockFk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_secondary%sHockIk_jnt_%s' % (self.locus,self.namespace,self.count),'%s_%sHock_bnd_%s' % (self.locus,self.namespace,self.count))[0]
        cmds.setAttr('%s.interpType' % pConst,2)
        cmds.connectAttr('%s_blendLegFkIk_rev_%s.outputX' % (self.locus,self.count),'%s.%s_%sHockFk_jnt_%sW0' % (pConst,self.locus,self.namespace,self.count))
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%s_secondary%sHockIk_jnt_%sW1' % (pConst,self.locus,self.namespace,self.count))
        
        # create the hip twist bind joints
        cmds.select(cl=True)
        jnt = cmds.joint(n='%s_%sHipA_bnd_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(jnt,'%s_%sHip_bnd_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint(twistLocAFK,twistLocAIK,jnt,mo=False)[0]
        cmds.setAttr('%s.interpType' % pConst,2)
        cmds.connectAttr('%s_blendLegFkIk_rev_%s.outputX' % (self.locus,self.count),'%s.%sW0' % (pConst,twistLocAFK))
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%sW1' % (pConst,twistLocAIK))
        
        cmds.select(cl=True)
        jnt = cmds.joint(n='%s_%sHipB_bnd_%s' % (self.locus,self.namespace,self.count))
        cmds.parent(jnt,'%s_%sHipA_bnd_%s' % (self.locus,self.namespace,self.count))
        pConst = cmds.parentConstraint(twistLocBFK,twistLocBIK,jnt,mo=False)[0]
        cmds.setAttr('%s.interpType' % pConst,2)
        cmds.connectAttr('%s_blendLegFkIk_rev_%s.outputX' % (self.locus,self.count),'%s.%sW0' % (pConst,twistLocBFK))
        cmds.connectAttr('%s.FKIKBlend' % FKIKCtl,'%s.%sW1' % (pConst,twistLocBIK))
        
        cmds.parent('%s_%sKnee_bnd_%s' % (self.locus,self.namespace,self.count),jnt)
        
        # lock attributes
        for attr in ['sx','sy','sz']:
            cmds.setAttr('%s_%sHipFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sKneeFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sHockFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sAnkleFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            #cmds.setAttr('%s_%sAnkleIk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            cmds.setAttr('%s_%sMidfootFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
            #cmds.setAttr('%s_%sToesFk_ctl_%s.%s' % (self.locus,self.namespace,self.count,attr),l=True,k=False)
        
        # create toe locator
        loc = cmds.spaceLocator(n='%s_toe_loc_%s' % (self.locus,self.count))[0]
        cmds.parent(loc,'%s_legToe_bnd_%s' % (self.locus,self.count),r=True)
        cmds.setAttr('%s.v' % loc,0)
        
        avg = cmds.createNode('plusMinusAverage')
        cmds.connectAttr('%s.kneeWeighting' % FKIKCtl,'%s.springAngleBias[0].springAngleBias_FloatValue' % legikhandle)
        cmds.connectAttr('%s.kneeWeighting' % FKIKCtl,'%s.input1D[1]' % avg)
        cmds.setAttr('%s.input1D[0]' % avg,1)
        cmds.setAttr('%s.operation' % avg,2)
        cmds.connectAttr('%s.output1D' % avg,'%s.springAngleBias[1].springAngleBias_FloatValue' % legikhandle)
        if cmds.getAttr('%s.v' % legikhandle):
            cmds.setAttr('%s.v' % legikhandle,0)
        
#         cmds.connectAttr('%s.kneeWeighting' % FKIKCtl,'%s.springAngleBias[0].springAngleBias_FloatValue' % dummyikhandle)
#         cmds.setAttr('%s.input1D[0]' % avg,1)
#         cmds.setAttr('%s.operation' % avg,2)
#         cmds.connectAttr('%s.output1D' % avg,'%s.springAngleBias[1].springAngleBias_FloatValue' % dummyikhandle)
#         cmds.setAttr('%s.v' % dummyikhandle,0)
コード例 #56
0
ファイル: control.py プロジェクト: RiggingDojoAdmin/glTools
def setTranslateLimits(ctrl,tx=[],ty=[],tz=[]):
	'''
	'''
	if(tx): mc.transformLimits(ctrl,tx=(tx[0],tx[1]),etx=(1,1))
	if(ty): mc.transformLimits(ctrl,ty=(ty[0],ty[1]),ety=(1,1))
	if(tz): mc.transformLimits(ctrl,tz=(tz[0],tz[1]),etz=(1,1))
コード例 #57
0
def mirrorControlShape(typ, source, targent, flipAxis):
    if len(typ) == 0:return
    if source not in 'LR':return
    if source == targent:return

    #- get source side controls
    all_controls     = ' '.join(mc.listRelatives(mc.ls(type='nurbsCurve'), p=True, path=True))
    matched_controls = re.findall('\S*%s_\w+_%s_\d+'%(source, typ), all_controls)

    for ctl in matched_controls:
        #- get targent control
        targentControl = re.sub('%s_'%source, '%s_'%targent, ctl)
        if not mc.objExists(targentControl):continue

        #- duplicate shape
        tempx = mc.duplicate(ctl, po=True)
        mc.parent(mc.listRelatives(ctl, s=True, path=True), tempx, s=True, add=True)

        #- make Temp
        Temp = pymel.core.PyNode(mc.duplicate(tempx, rc=True)[0])
        for a in 'trs':
            for b in 'xyz':
                attr = a + b
                mc.setAttr('%s.%s'%(Temp, attr), l=False, k=True, cb=False)

        #- close max min value controler
        mc.transformLimits(Temp.name(), etx=(0, 0),ety=(0, 0),etz=(0, 0),erx=(0, 0),ery=(0, 0),erz=(0, 0))
        mc.parent(Temp.name(), w=True)

        #- filp
        grp = mc.createNode('transform')

        sourcePosi = mc.xform(ctl, q=True, ws=True, rp=True)
        targenPosi = mc.xform(targentControl, q=True, ws=True, rp=True)

        midPoint = [(sourcePosi[0] + targenPosi[0]) / 2,
                    (sourcePosi[0] + targenPosi[0]) / 2,
                    (sourcePosi[0] + targenPosi[0]) / 2]
        mc.move(midPoint[0], midPoint[1], midPoint[2], grp, a=True)


        mc.parent(Temp.name(), grp)
        mc.setAttr('%s.s%s'%(grp, flipAxis.lower()), -1)

        #- freeze transformations
        mc.parent(Temp.name(), targentControl)
        mc.makeIdentity(Temp.name(), apply=True, t=True, r=True, s=True)

        #- get original shapes
        originalShapes = mc.listRelatives(targentControl, s=True, path=True, type='nurbsCurve')

        #- parent new shapes
        shapes = mc.listRelatives(Temp.name(), s=True, path=True, type='nurbsCurve')
        for shp in shapes:
            mc.setAttr('%s.ovc'%shp, mc.getAttr('%s.ovc'%originalShapes[0]))
        mc.delete(originalShapes)
        mc.parent(shapes, targentControl, s=True, r=True)

        for shp in shapes:
            mc.rename(shp, '%sShape'%targentControl)

        #- delete temp
        mc.delete(tempx, Temp.name(), grp)
コード例 #58
0
ファイル: dpFoot.py プロジェクト: renaudll/dpAutoRigSystem
 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.setAttr(self.moduleGrp + ".moduleNamespace",
                  self.moduleGrp[:self.moduleGrp.rfind(":")],
                  type='string')
     # create cvJointLoc and cvLocators:
     self.cvFootLoc, shapeSizeCH = ctrls.cvJointLoc(
         ctrlName=self.guideName + "_foot", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFALoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName +
                                                  "_RfA",
                                                  r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFBLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName +
                                                  "_RfB",
                                                  r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFCLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName +
                                                  "_RfC",
                                                  r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFDLoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName +
                                                  "_RfD",
                                                  r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.cvRFELoc, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName +
                                                  "_RfE",
                                                  r=0.3)
     self.connectShapeSize(shapeSizeCH)
     # create jointGuides:
     self.jGuideFoot = cmds.joint(name=self.guideName + "_JGuideFoot",
                                  radius=0.001)
     self.jGuideRFE = cmds.joint(name=self.guideName + "_JGuideRfE",
                                 radius=0.001)
     cmds.select(clear=True)
     self.jGuideRFA = cmds.joint(name=self.guideName + "_JGuideRfA",
                                 radius=0.001)
     self.jGuideRFD = cmds.joint(name=self.guideName + "_JGuideRfD",
                                 radius=0.001)
     self.jGuideRFB = cmds.joint(name=self.guideName + "_JGuideRfB",
                                 radius=0.001)
     self.jGuideRFC = cmds.joint(name=self.guideName + "_JGuideRfC",
                                 radius=0.001)
     self.jGuideRFAC = cmds.joint(name=self.guideName + "_JGuideRfAC",
                                  radius=0.001)
     # set jointGuides as templates:
     cmds.setAttr(self.jGuideFoot + ".template", 1)
     cmds.setAttr(self.jGuideRFA + ".template", 1)
     cmds.setAttr(self.jGuideRFB + ".template", 1)
     cmds.setAttr(self.jGuideRFC + ".template", 1)
     cmds.setAttr(self.jGuideRFD + ".template", 1)
     cmds.setAttr(self.jGuideRFE + ".template", 1)
     cmds.parent(self.jGuideFoot,
                 self.jGuideRFA,
                 self.moduleGrp,
                 relative=True)
     # create cvEnd:
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(
         ctrlName=self.guideName + "_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvRFELoc)
     cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName + "_JGuideEnd",
                                 radius=0.001)
     cmds.setAttr(self.jGuideEnd + ".template", 1)
     cmds.parent(self.jGuideEnd, self.jGuideRFE)
     # make parents between cvLocs:
     cmds.parent(self.cvFootLoc, self.cvRFALoc, self.cvRFBLoc,
                 self.cvRFCLoc, self.cvRFDLoc, self.moduleGrp)
     cmds.parent(self.cvRFELoc, self.cvFootLoc)
     # connect cvLocs in jointGuides:
     ctrls.directConnect(self.cvFootLoc, self.jGuideFoot,
                         ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     cmds.parentConstraint(self.cvRFALoc,
                           self.jGuideRFA,
                           maintainOffset=False,
                           name=self.jGuideRFA + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFBLoc,
                           self.jGuideRFB,
                           maintainOffset=False,
                           name=self.jGuideRFB + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFCLoc,
                           self.jGuideRFC,
                           maintainOffset=False,
                           name=self.jGuideRFC + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFDLoc,
                           self.jGuideRFD,
                           maintainOffset=False,
                           name=self.jGuideRFD + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFELoc,
                           self.jGuideRFE,
                           maintainOffset=False,
                           name=self.jGuideRFE + "_ParentConstraint")
     cmds.parentConstraint(self.cvRFALoc,
                           self.jGuideRFAC,
                           maintainOffset=False,
                           name=self.jGuideRFAC + "_ParentConstraint")
     ctrls.directConnect(self.cvEndJoint, self.jGuideEnd,
                         ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
     # limit, lock and hide cvEnd:
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint],
                       ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     # transform cvLocs in order to put as a good foot guide:
     cmds.setAttr(self.cvFootLoc + ".translateZ", 2)
     cmds.setAttr(self.cvFootLoc + ".rotateY", -90)
     cmds.setAttr(self.cvRFELoc + ".translateX", -1)
     cmds.setAttr(self.cvRFELoc + ".translateZ", 2.5)
     cmds.setAttr(self.cvRFCLoc + ".translateX", 1)
     cmds.setAttr(self.cvRFALoc + ".translateX", -0.6)
     cmds.setAttr(self.cvRFALoc + ".translateY", -1)
     cmds.setAttr(self.cvRFBLoc + ".translateX", -0.6)
     cmds.setAttr(self.cvRFBLoc + ".translateY", 1)
     cmds.setAttr(self.cvRFDLoc + ".translateX", -3.5)
     cmds.setAttr(self.moduleGrp + ".rotateX", -90)
     cmds.setAttr(self.moduleGrp + ".rotateY", 90)
コード例 #59
0
    def rigModule(self, *args):
        Base.StartClass.rigModule(self)
        # verify if the guide exists:
        if cmds.objExists(self.moduleGrp):
            try:
                hideJoints = cmds.checkBox('hideJointsCB',
                                           query=True,
                                           value=True)
            except:
                hideJoints = 1
            # declare lists to store names and attributes:
            self.steeringCtrlList = []
            # start as no having mirror:
            sideList = [""]
            # analisys the mirror module:
            self.mirrorAxis = cmds.getAttr(self.moduleGrp + ".mirrorAxis")
            if self.mirrorAxis != 'off':
                # get rigs names:
                self.mirrorNames = cmds.getAttr(self.moduleGrp + ".mirrorName")
                # get first and last letters to use as side initials (prefix):
                sideList = [
                    self.mirrorNames[0] + '_',
                    self.mirrorNames[len(self.mirrorNames) - 1] + '_'
                ]
                for s, side in enumerate(sideList):
                    duplicated = cmds.duplicate(
                        self.moduleGrp,
                        name=side + self.userGuideName + '_Guide_Base')[0]
                    allGuideList = cmds.listRelatives(duplicated,
                                                      allDescendents=True)
                    for item in allGuideList:
                        cmds.rename(item,
                                    side + self.userGuideName + "_" + item)
                    self.mirrorGrp = cmds.group(name="Guide_Base_Grp",
                                                empty=True)
                    cmds.parent(side + self.userGuideName + '_Guide_Base',
                                self.mirrorGrp,
                                absolute=True)
                    # re-rename grp:
                    cmds.rename(
                        self.mirrorGrp,
                        side + self.userGuideName + '_' + self.mirrorGrp)
                    # do a group mirror with negative scaling:
                    if s == 1:
                        if cmds.getAttr(self.moduleGrp + ".flip") == 0:
                            for axis in self.mirrorAxis:
                                gotValue = cmds.getAttr(
                                    side + self.userGuideName +
                                    "_Guide_Base.translate" + axis)
                                flipedValue = gotValue * (-2)
                                cmds.setAttr(
                                    side + self.userGuideName + '_' +
                                    self.mirrorGrp + '.translate' + axis,
                                    flipedValue)
                        else:
                            for axis in self.mirrorAxis:
                                cmds.setAttr(
                                    side + self.userGuideName + '_' +
                                    self.mirrorGrp + '.scale' + axis, -1)
                # joint labelling:
                jointLabelAdd = 1
            else:  # if not mirror:
                duplicated = cmds.duplicate(self.moduleGrp,
                                            name=self.userGuideName +
                                            '_Guide_Base')[0]
                allGuideList = cmds.listRelatives(duplicated,
                                                  allDescendents=True)
                for item in allGuideList:
                    cmds.rename(item, self.userGuideName + "_" + item)
                self.mirrorGrp = cmds.group(self.userGuideName + '_Guide_Base',
                                            name="Guide_Base_Grp",
                                            relative=True)
                #for Maya2012: self.userGuideName+'_'+self.moduleGrp+"_Grp"
                # re-rename grp:
                cmds.rename(self.mirrorGrp,
                            self.userGuideName + '_' + self.mirrorGrp)
                # joint labelling:
                jointLabelAdd = 0
            # store the number of this guide by module type
            dpAR_count = utils.findModuleLastNumber(CLASS_NAME,
                                                    "dpAR_type") + 1
            # run for all sides
            for s, side in enumerate(sideList):
                self.base = side + self.userGuideName + '_Guide_Base'

                cmds.select(clear=True)
                # declare guide:
                self.guide = side + self.userGuideName + "_Guide_JointLoc1"
                self.cvEndJoint = side + self.userGuideName + "_Guide_JointEnd"
                self.radiusGuide = side + self.userGuideName + "_Guide_Base_RadiusCtrl"
                # create a joint:
                self.jnt = cmds.joint(name=side + self.userGuideName +
                                      "_1_Jnt",
                                      scaleCompensate=False)
                cmds.addAttr(self.jnt,
                             longName='dpAR_joint',
                             attributeType='float',
                             keyable=False)
                self.endJoint = cmds.joint(name=side + self.userGuideName +
                                           "_JEnd",
                                           radius=0.5)
                # joint labelling:
                utils.setJointLabel(self.jnt, s + jointLabelAdd, 18,
                                    self.userGuideName + "_1")
                # create a control:
                self.steeringCtrl = self.ctrls.cvControl(
                    "id_065_SteeringWheel",
                    side + self.userGuideName + "_" +
                    self.langDic[self.langName]['m158_steering'] + "_Ctrl",
                    r=self.ctrlRadius,
                    d=self.curveDegree)
                self.mainCtrl = self.ctrls.cvControl(
                    "id_066_SteeringMain",
                    side + self.userGuideName + "_" +
                    self.langDic[self.langName]['c058_main'] + "_Ctrl",
                    r=self.ctrlRadius,
                    d=self.curveDegree)
                utils.originedFrom(objName=self.steeringCtrl,
                                   attrString=self.guide)
                utils.originedFrom(objName=self.mainCtrl,
                                   attrString=self.base + ";" +
                                   self.cvEndJoint + ";" + self.radiusGuide)
                self.steeringCtrlList.append(self.steeringCtrl)
                # position and orientation of joint and control:
                cmds.delete(
                    cmds.parentConstraint(self.guide,
                                          self.jnt,
                                          maintainOffset=False))
                cmds.delete(
                    cmds.parentConstraint(self.guide,
                                          self.steeringCtrl,
                                          maintainOffset=False))
                cmds.delete(
                    cmds.parentConstraint(self.cvEndJoint,
                                          self.mainCtrl,
                                          maintainOffset=False))
                cmds.delete(
                    cmds.parentConstraint(self.cvEndJoint,
                                          self.endJoint,
                                          maintainOffset=False))
                cmds.setAttr(self.endJoint + ".translateY", 1)
                # zeroOut controls:
                zeroOutCtrlGrpList = utils.zeroOut(
                    [self.steeringCtrl, self.mainCtrl])
                # hide visibility attribute:
                self.ctrls.setLockHide(
                    [self.steeringCtrl],
                    ['tx', 'ty', 'tz', 'rx', 'ry', 'sx', 'sy', 'sz', 'v'])
                # fixing flip mirror:
                if s == 1:
                    if cmds.getAttr(self.moduleGrp + ".flip") == 1:
                        cmds.setAttr(zeroOutCtrlGrpList[0] + ".scaleX", -1)
                        cmds.setAttr(zeroOutCtrlGrpList[0] + ".scaleY", -1)
                        cmds.setAttr(zeroOutCtrlGrpList[0] + ".scaleZ", -1)
                cmds.addAttr(self.steeringCtrl,
                             longName='scaleCompensate',
                             attributeType="bool",
                             keyable=False)
                cmds.setAttr(self.steeringCtrl + ".scaleCompensate",
                             1,
                             channelBox=True)
                cmds.connectAttr(self.steeringCtrl + ".scaleCompensate",
                                 self.jnt + ".segmentScaleCompensate",
                                 force=True)
                # integrating setup:
                cmds.addAttr(
                    self.steeringCtrl,
                    longName=self.langDic[self.langName]['c071_limit'],
                    defaultValue=500,
                    attributeType="float",
                    keyable=False)
                cmds.addAttr(
                    self.steeringCtrl,
                    longName=self.langDic[self.langName]['c049_intensity'],
                    min=0,
                    defaultValue=0.8,
                    attributeType="float",
                    keyable=False)
                cmds.addAttr(
                    self.steeringCtrl,
                    longName=self.langDic[self.langName]['c070_steering'],
                    attributeType="float",
                    keyable=False)
                cmds.setAttr(self.steeringCtrl + "." +
                             self.langDic[self.langName]['c071_limit'],
                             500,
                             channelBox=True)
                cmds.setAttr(self.steeringCtrl + "." +
                             self.langDic[self.langName]['c049_intensity'],
                             0.8,
                             channelBox=True)
                self.steeringUnitMD = cmds.createNode(
                    'multiplyDivide',
                    name=side + self.userGuideName + "_Unit_MD")
                self.steeringInvertMD = cmds.createNode(
                    'multiplyDivide',
                    name=side + self.userGuideName + "_Rotate_MD")
                self.steeringMD = cmds.createNode('multiplyDivide',
                                                  name=side +
                                                  self.userGuideName + "_MD")
                cmds.setAttr(self.steeringInvertMD + ".input2X", 0.1)
                cmds.setAttr(self.steeringUnitMD + ".input2X", -1)
                cmds.transformLimits(self.steeringCtrl, enableRotationZ=(1, 1))
                cmds.connectAttr(self.steeringCtrl + "." +
                                 self.langDic[self.langName]['c071_limit'],
                                 self.steeringUnitMD + ".input1X",
                                 force=True)
                cmds.connectAttr(self.steeringUnitMD + ".outputX",
                                 self.steeringCtrl +
                                 ".minRotLimit.minRotZLimit",
                                 force=True)
                cmds.connectAttr(self.steeringCtrl + "." +
                                 self.langDic[self.langName]['c071_limit'],
                                 self.steeringCtrl +
                                 ".maxRotLimit.maxRotZLimit",
                                 force=True)
                cmds.connectAttr(self.steeringCtrl + ".rotateZ",
                                 self.steeringInvertMD + ".input1X",
                                 force=True)
                cmds.connectAttr(self.steeringInvertMD + ".outputX",
                                 self.steeringMD + ".input1X",
                                 force=True)
                cmds.connectAttr(self.steeringCtrl + "." +
                                 self.langDic[self.langName]['c049_intensity'],
                                 self.steeringMD + ".input2X",
                                 force=True)
                cmds.connectAttr(self.steeringMD + ".outputX",
                                 self.steeringCtrl + "." +
                                 self.langDic[self.langName]['c070_steering'],
                                 force=True)

                # grouping:
                cmds.parent(zeroOutCtrlGrpList[0], self.mainCtrl)
                # create parentConstraint from steeringCtrl to jnt:
                cmds.parentConstraint(self.steeringCtrl,
                                      self.jnt,
                                      maintainOffset=False,
                                      name=self.jnt + "_PaC")
                # create scaleConstraint from steeringCtrl to jnt:
                cmds.scaleConstraint(self.steeringCtrl,
                                     self.jnt,
                                     maintainOffset=True,
                                     name=self.jnt + "_ScC")

                # create a masterModuleGrp to be checked if this rig exists:
                self.toCtrlHookGrp = cmds.group(
                    zeroOutCtrlGrpList[1],
                    name=side + self.userGuideName + "_Control_Grp")
                self.toScalableHookGrp = cmds.group(
                    side + self.userGuideName + "_1_Jnt",
                    name=side + self.userGuideName + "_Joint_Grp")
                self.toStaticHookGrp = cmds.group(self.toCtrlHookGrp,
                                                  self.toScalableHookGrp,
                                                  name=side +
                                                  self.userGuideName + "_Grp")
                # create a locator in order to avoid delete static group
                loc = cmds.spaceLocator(name=side + self.userGuideName +
                                        "_DO_NOT_DELETE_PLEASE_Loc")[0]
                cmds.parent(loc, self.toStaticHookGrp, absolute=True)
                cmds.setAttr(loc + ".visibility", 0)
                self.ctrls.setLockHide([loc], [
                    'tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v'
                ])
                # add hook attributes to be read when rigging integrated modules:
                utils.addHook(objName=self.toCtrlHookGrp, hookType='ctrlHook')
                utils.addHook(objName=self.toScalableHookGrp,
                              hookType='scalableHook')
                utils.addHook(objName=self.toStaticHookGrp,
                              hookType='staticHook')
                cmds.addAttr(self.toStaticHookGrp,
                             longName="dpAR_name",
                             dataType="string")
                cmds.addAttr(self.toStaticHookGrp,
                             longName="dpAR_type",
                             dataType="string")
                cmds.setAttr(self.toStaticHookGrp + ".dpAR_name",
                             self.userGuideName,
                             type="string")
                cmds.setAttr(self.toStaticHookGrp + ".dpAR_type",
                             CLASS_NAME,
                             type="string")
                # add module type counter value
                cmds.addAttr(self.toStaticHookGrp,
                             longName='dpAR_count',
                             attributeType='long',
                             keyable=False)
                cmds.setAttr(self.toStaticHookGrp + '.dpAR_count', dpAR_count)
                if hideJoints:
                    cmds.setAttr(self.toScalableHookGrp + ".visibility", 0)
                # delete duplicated group for side (mirror):
                cmds.delete(side + self.userGuideName + '_' + self.mirrorGrp)
            # finalize this rig:
            self.integratingInfo()
            cmds.select(clear=True)
        # delete UI (moduleLayout), GUIDE and moduleInstance namespace:
        self.deleteModule()
コード例 #60
0
ファイル: sqStickyLipsSetup.py プロジェクト: utsdab/config
 def sqCreateStickyLipsCtrlAttr(self, *args):
     if not cmds.objExists(self.optionCtrl):
         cmds.circle(name=self.optionCtrl, constructionHistory=False)
     cmds.addAttr(self.optionCtrl, longName='stickyLips', attributeType='bool')
     cmds.setAttr(self.optionCtrl+'.stickyLips', edit=True, keyable=True)
     
     for i in range(0, self.maxIter):
         cmds.addAttr(self.optionCtrl, longName="stickyLipsWireLocator"+str(i), attributeType='float', keyable=False)
     
     for i in range(0, self.maxIter):
         for wireNode in self.wireNodeList:
             cmds.connectAttr(self.optionCtrl+".stickyLipsWireLocator"+str(i), wireNode+".wireLocatorEnvelope["+str(i)+"]")
     
     slTextCurve = cmds.textCurves(ch=False, font="Arial|w400|h-08", text="StickyLips", name="StickyLips_Label_Txt")[0]
     if "Shape" in slTextCurve:
         slTextCurve = cmds.rename(slTextCurve, slTextCurve[:slTextCurve.find("Shape")])
     t = 0
     slCharTransformList = cmds.listRelatives(slTextCurve, children=True, type="transform")
     for charTransform in slCharTransformList:
         txValue = cmds.getAttr(charTransform+".tx")
         sLTextShapeList = cmds.listRelatives(charTransform, allDescendents=True, type="nurbsCurve")
         for i, textShape in enumerate(sLTextShapeList):
             textShape = cmds.rename(textShape, "StickyLips_Txt_"+str(t)+"Shape")
             cmds.parent(textShape, slTextCurve, shape=True, relative=True)
             cmds.move(txValue, 0, 0, textShape+".cv[:]", relative=True)
             t = t+1
         cmds.delete(charTransform)
     cmds.setAttr(slTextCurve+".translateX", -0.1)
     cmds.setAttr(slTextCurve+".translateY", 0.25)
     cmds.setAttr(slTextCurve+".scaleX", 0.1)
     cmds.setAttr(slTextCurve+".scaleY", 0.1)
     cmds.setAttr(slTextCurve+".scaleZ", 0.1)
     cmds.setAttr(slTextCurve+".template", 1)
     cmds.makeIdentity(slTextCurve, apply=True)
     
     sideNameList = ["L", "R"]
     for side in sideNameList:
         bg = cmds.circle(name=side+"_StickyLips_Bg", normal=(0,0,1), radius=1, degree=1, sections=4, constructionHistory=False)[0]
         cmds.setAttr(bg+".rotateZ", 45)
         cmds.setAttr(bg+".translateX", 0.5)
         cmds.makeIdentity(bg, apply=True)
         cmds.setAttr(bg+".scaleX", 0.85)
         cmds.setAttr(bg+".scaleY", 0.15)
         cmds.makeIdentity(bg, apply=True)
         cmds.setAttr(bg+".template", 1)
         
         self.sliderCtrl = cmds.circle(name=side+"_StickyLips_Ctrl", normal=(0,0,1), radius=0.1, degree=3, constructionHistory=False)[0]
         attrToHideList = ['ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v']
         for attr in attrToHideList:
             cmds.setAttr(self.sliderCtrl+"."+attr, edit=True, lock=True, keyable=False)
         cmds.transformLimits(self.sliderCtrl, translationX=(0,1), enableTranslationX=(1,1))
         
     distPos = 1.0 / self.maxIter
     for i in range(0, self.maxIter):
         lPosA = (i * distPos)
         lPosB = (lPosA + distPos)
         rPosB = 1 - (i * distPos)
         rPosA = (rPosB - distPos)
         if i > 0:
             lPosA = lPosA - (distPos*0.33)
             rPosA = rPosA - (distPos*0.33)
         cmds.setDrivenKeyframe(self.optionCtrl, attribute="stickyLipsWireLocator"+str(i), currentDriver=sideNameList[0]+"_StickyLips_Ctrl.translateX", driverValue=lPosA, value=0, inTangentType="linear", outTangentType="linear")
         cmds.setDrivenKeyframe(self.optionCtrl, attribute="stickyLipsWireLocator"+str(i), currentDriver=sideNameList[0]+"_StickyLips_Ctrl.translateX", driverValue=lPosB, value=1, inTangentType="linear", outTangentType="linear")
         cmds.setDrivenKeyframe(self.optionCtrl, attribute="stickyLipsWireLocator"+str(i), currentDriver=sideNameList[1]+"_StickyLips_Ctrl.translateX", driverValue=rPosA, value=0, inTangentType="linear", outTangentType="linear")
         cmds.setDrivenKeyframe(self.optionCtrl, attribute="stickyLipsWireLocator"+str(i), currentDriver=sideNameList[1]+"_StickyLips_Ctrl.translateX", driverValue=rPosB, value=1, inTangentType="linear", outTangentType="linear")
     
     lSliderGrp = cmds.group(sideNameList[0]+"_StickyLips_Ctrl", sideNameList[0]+"_StickyLips_Bg", name=sideNameList[0]+"_StickyLips_Ctrl_Grp")
     rSliderGrp = cmds.group(sideNameList[1]+"_StickyLips_Ctrl", sideNameList[1]+"_StickyLips_Bg", name=sideNameList[1]+"_StickyLips_Ctrl_Grp")
     cmds.setAttr(rSliderGrp+".rotateZ", 180)
     cmds.setAttr(rSliderGrp+".translateY", -0.25)
     sliderGrp = cmds.group(lSliderGrp, rSliderGrp, slTextCurve, name="StickyLips_Ctrl_Grp")