Beispiel #1
0
 def __init__(self,startJoint,numS,ctrlName,ctrlChoice,sx,sy,sz,color,nx=None,ny=None,nz=None,redi=None):
     JointRigInfo.__init__(self, startJoint)
     self.numS = numS
     self.ctrlChoice = ctrlChoice
     self.sx = sx
     self.sy = sy
     self.sz =sz
     self.color = color
     self.ctrlName = ctrlName
     self.ctrls = []
     self.nx = nx
     self.ny = ny
     self.nz = nz
     self.redi = redi
                   
     kmo = km.IKSpline(self.stEd[0], self.stEd[1])
     self.ikH = kmo.applyIk(self.numS)
     crv = co.CurveOperation(self.ikH[2]) 
     self.jntCtrls = crv.curveSkinCtrls(0,self.ctrlName)        
     
     for i in range(0,len(self.jntCtrls)):            
         kmg = km.ApplyConstrain(self.jntCtrls[i])
         kmg.makeOffGrp(2)
         co.MakeCtrl(self.jntCtrls[i]+'_ctrl',self.ctrlChoice,self.sx,self.sy,self.sz,self.color,1,self.jntCtrls[i],self.nx,self.ny,self.nz,self.redi)   
          
     comctrl = co.CtrlLib('dummy').addDummyShape()
     comShape = co.ShapeFinder(comctrl).shape
     comShape = cmds.rename(comShape,(self.ctrlName+'_commanAt'))
     cmds.select(comShape)
     cmds.addAttr( longName= 'stretchy', at = 'enum', en = ('off:on'), k =1)
         
     for i in range(0,len(self.jntCtrls)):
         cmds.parent(comShape,self.jntCtrls[i],add=1,s=1)
     cmds.delete(comctrl)
     
     con = km.MakeDisNode(self.ikH[2]).curveDisNode()
     cmds.connectAttr((comShape+'.stretchy'),(con+'.firstTerm'))
     conAttr = con+'.outColorR'        
     jo.jointScale(self.allJnts,'sx',conAttr)       
     
     twisterJnt = [self.jntCtrls[0],self.jntCtrls[-1]]
     twistJnt = [self.stEd[0],self.stEd[1]]
     
     for i in range(0,2):
         grp = cmds.group(em =1, n =(twistJnt[i]+'Twist_g'))
         delCon = km.ApplyConstrain(twistJnt[i],grp).pointOriCon(0)
         cmds.delete(delCon[0],delCon[1])
         cmds.parent(grp,twisterJnt[i])
     
     cmds.setAttr(self.ikH[0]+'.dTwistControlEnable',1)
     cmds.setAttr(self.ikH[0]+'.dWorldUpType',4)
     cmds.connectAttr((twistJnt[0]+'Twist_g.worldMatrix[0]'),(self.ikH[0]+'.dWorldUpMatrix'),f=1)
     cmds.connectAttr((twistJnt[1]+'Twist_g.worldMatrix[0]'),(self.ikH[0]+'.dWorldUpMatrixEnd'),f=1)
Beispiel #2
0
 def __init__(self,startJoint,numS,ctrlName,ctrlChoice,sx,sy,sz,color,nx=None,ny=None,nz=None,redi=None):
     SpineIkRig.__init__(self, startJoint, numS, ctrlName, ctrlChoice, sx, sy, sz, color, nx, ny, nz, redi)
     self.bipCtrls = ['cog','hip','waist','torso','chest']
     shapeChoise =  [5,4,1,5,1]
     shapeColor = [18,18,17,17,14]
     self.bipCtrlsG = []
     spineInctrlG = [dt.findParent(self.jntCtrls[0]).parent[0],dt.findParent(self.jntCtrls[2]).parent[0],dt.findParent(self.jntCtrls[1]).parent[0]]
     parentOrder = [0,0,2,3,1,3,0,1,0]
                   
     for i in range(0,len(self.bipCtrls)):
         co.MakeCtrl(self.bipCtrls[i]+'_ctrl',shapeChoise[i],3,3,3,shapeColor[i],1,self.bipCtrls[i],0,1,0,1)            
         self.bipCtrlsG.append(ApplyConstrain(self.bipCtrls[i]).makeOffGrp(2))
     
     
     self.bipCtrlsG.extend(spineInctrlG)        
     for i in range(0,len(self.bipCtrlsG)-1):
         cmds.parent(self.bipCtrlsG[i+1],self.bipCtrls[parentOrder[i]])
         
     hipRefPiv = ApplyConstrain(self.jntCtrls[1]).makeConGrp(2,'hipPiv')
     torsoRefPiv = ApplyConstrain(self.jntCtrls[1]).makeConGrp(2,'torsoPiv')
     ApplyConstrain(hipRefPiv,self.bipCtrlsG[-1]).parentCon(1)
     ApplyConstrain(torsoRefPiv,self.bipCtrlsG[-1]).parentCon(1)
     dt.parentIT(hipRefPiv,self.bipCtrls[1])
     dt.parentIT(torsoRefPiv,self.bipCtrls[3])
     
     for i in range(0,len(self.bipCtrlsG)):
         dt.LockHide(self.bipCtrlsG[i],1,1,1,1,1,1,1,1,1,1)
     
     dt.LockHide(self.bipCtrls[0],0,0,0,0,0,0,1,1,1,1,1)
     dt.LockHide(self.bipCtrls[1],0,0,0,0,0,0,1,1,1,1,1)
     dt.LockHide(self.bipCtrls[2],1,1,1,0,0,0,1,1,1,1,1)
     dt.LockHide(self.bipCtrls[3],0,0,0,0,0,0,1,1,1,1,1)
     dt.LockHide(self.bipCtrls[4],1,1,1,0,0,0,1,1,1,1,1)
Beispiel #3
0
    def __init__(self,rigName,startJoint,poleCtrl,ctrlColor,rigParent,toeTipPivot,heelPivot, gCtrl=None):
        makeTwoJointIkFkRig.__init__(self, rigName, startJoint, poleCtrl, ctrlColor, rigParent, gCtrl)
        self.toeTipPivot =  toeTipPivot
        self.heelPivot =  heelPivot

        #clean up Extra ikCtrls and addtional shape on toeTip
        for i in range(1,len(self.ikHJnt)-1):
            cmds.delete(self.ikHJnt[i])
        
        cmds.delete(co.Curve(self.fkJnt[-1]).curve)        
        Attrs = ['toeRoll','toeTap','frontRoll','heelRoll']  
        
        feetRig().makeFeetRig(self.ikJnt[2],self.ikHJnt[0],self.ikH.ikH[0],Attrs,self.toeTipPivot,self.heelPivot)
Beispiel #4
0
 def __init__(self,startJoint,ctrlChoice,sx,sy,sz,color,nx=None,ny=None,nz=None,redi=None):
     JointRigInfo.__init__(self, startJoint)        
     self.ctrlChoice = ctrlChoice
     self.sx = sx
     self.sy = sy
     self.sz =sz
     self.color = color       
     self.nx = nx
     self.ny = ny
     self.nz = nz
     self.redi = redi
     for i in range(0,len(self.allJnts)):
         cmds.select(self.allJnts[i])
         co.MakeCtrl(self.allJnts[i]+'_ctrl',self.ctrlChoice,self.sx,self.sy,self.sz,self.color,1,self.allJnts[i],self.nx,self.ny,self.nz,self.redi)
Beispiel #5
0
    def makePlacer(self, name, scale):
        cmds.select(cl=1)
        ctrls = ['Placer', 'mover1', 'mover2']
        grps = km.rigHouseKeeping(name).makeAllHouseKeepingGroup(0)

        cmds.setAttr((grps[1] + '.visibility'), 0)
        cmds.setAttr((grps[2] + '.overrideEnabled'), 1)
        cmds.setAttr((grps[2] + '.overrideDisplayType'), 2)

        parent = grps[0]

        for i in range(0, len(ctrls)):
            ctrl = co.MakeCtrl(ctrls[i],
                               1,
                               scale,
                               scale,
                               scale,
                               5,
                               sp=None,
                               spJnt=None,
                               nx=0,
                               ny=1,
                               nz=0,
                               redi=10,
                               startConCtrl=None,
                               endConCtrl=None)
            if i == 0:
                attar = km.AddDriverAttr(ctrl.ctrl, 'RigScale', 1, 0.1, 10,
                                         'float')
                axies = ['.scaleX', '.scaleY', '.scaleZ']
                for j in range(0, 3):
                    cmds.connectAttr((attar.name + '.' + attar.attrName),
                                     (ctrl.ctrl + axies[j]),
                                     f=1)

            dt.parentIT(ctrl.ctrl, parent)
            scale = scale - 0.3
            parent = ctrl.ctrl
            dt.LockHide(ctrl.ctrl, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
Beispiel #6
0
 def __init__(self,startJoint,hierarchy,ctrlChoice,sx,sy,sz,color,nx=None,ny=None,nz=None,redi=None):
     JointRigInfo.__init__(self, startJoint)        
     self.ctrlChoice = ctrlChoice
     self.sx = sx
     self.sy = sy
     self.sz =sz
     self.color = color       
     self.nx = nx
     self.ny = ny
     self.nz = nz
     self.redi = redi
     self.hierarchy =  hierarchy            
     count = 0 
     
     print self.sx ,self.sy,self.sz
     
     if self.hierarchy == 0:
         count = (len(self.allJnts)-1)
         
     print count
     
     for i in range(0,len(self.allJnts)-count):
         cmds.select(self.allJnts[i])
         co.MakeCtrl(self.allJnts[i]+'_ctrl',self.ctrlChoice,self.sx,self.sy,self.sz,self.color,1,self.allJnts[i],self.nx,self.ny,self.nz,self.redi)
Beispiel #7
0
    def __init__(self,rigName,startJoint,poleCtrl,ctrlColor,rigParent, gCtrl=None):
        self.startJont  =  startJoint
        self.poleCtrl =  poleCtrl        
        self.ikFkCon = []
        self.ctrlColor = ctrlColor
        self.gCtrl =  gCtrl
        self.rigName =  rigName
        self.rigParent  = rigParent
        
        
        self.sourceJnt  =  jo.JointOperation().jointsInfo(self.startJont,1)
        self.topG =  ApplyConstrain(self.startJont).makeOffGrp(2,(self.startJont+'Rig'))
        
        # making IkHendle Ctrl
        self.ikHJnt =  jo.JointOperation().makeDuplicateJointChaines(self.sourceJnt[2],self.sourceJnt[2],'_Ikctrl')
        
        #adding attributes 
        cmds.select(self.ikHJnt[0])
        AddDriverAttr(self.ikHJnt[0],'upperLimb',0,-10,10,'float')
        AddDriverAttr(self.ikHJnt[0],'lowerLimb',0,-10,10,'float')
        cmds.addAttr(ln= 'ikFK',at = 'enum',en = 'Ik:fk',k=1)
        AddDriverAttr(self.ikHJnt[0],'stretchy',None,None,None,'bool')
            
        co.MakeCtrl(self.ikHJnt[0]+'_ctrl',2,0.5,0.5,0.5,ctrlColor,1,self.ikHJnt[0])
        self.ikHJntG = ApplyConstrain(self.ikHJnt[0]).makeOffGrp(2)
        
               
        #make ikFk Chain and connect it to ikHandle
        self.ikJnt =  jo.JointOperation().makeDuplicateJointChaines(self.startJont,self.startJont, '_ik')
        self.ikJntG = ApplyConstrain(self.ikJnt[0]).makeOffGrp(2)
        self.fkJnt = jo.JointOperation().makeDuplicateJointChaines(self.startJont,self.startJont, '_fk')
        self.fkJntG = ApplyConstrain(self.fkJnt[0]).makeOffGrp(2)
        cmds.parent(self.ikJntG,self.topG)
        cmds.parent(self.fkJntG,self.topG)
        
        self.rev =  cmds.createNode('reverse',n = (self.startJont+'ikFk_rev'))
        cmds.connectAttr((self.ikHJnt[0]+'.ikFK'),(self.rev+'.inputX'))
                 
        for i in range(0,len(self.sourceJnt)):
            self.ikCon = ApplyConstrain(self.ikJnt[i],self.sourceJnt[i]).parentCon(0)
            self.fkCon = ApplyConstrain(self.fkJnt[i],self.sourceJnt[i]).parentCon(0)
            conW =  cmds.parentConstraint(self.ikCon,q=1 ,wal=1)
            cmds.connectAttr((self.rev+'.outputX'),(self.ikCon[0]+'.'+conW[0]))
            cmds.connectAttr((self.ikHJnt[0]+'.ikFK'),(self.ikCon[0]+'.'+conW[1]))
               
        #make FK rig
        
        FkCtrlRig(self.fkJnt[0],1,1,1,1,1,self.ctrlColor,1,0,0,2)
        cmds.connectAttr((self.ikHJnt[0]+'.ikFK'),(self.fkJntG+'.visibility'))
                   
        
        ApplyConstrain(self.ikHJnt[0], self.ikJnt[2]).orientCon(0)        
        co.MakeCtrl(self.poleCtrl+'_ctrl',2,0.5,0.5,0.5,ctrlColor,1,self.poleCtrl)
        self.refLine = co.MakeCtrl(self.ikJnt[1]+'Ref_ctrl',6,1,1,1,13,startConCtrl=self.ikJnt[1],endConCtrl=self.poleCtrl)
       
          
          
            
        self.ikH =  twoJointIk(self.ikJnt[0],2,self.poleCtrl)
        cmds.parent(self.ikH.ikH[0],self.ikHJnt[0])
        self.poleCtrlG = ApplyConstrain(self.poleCtrl).makeOffGrp(2)
        ApplyConstrain(self.ikJntG,self.poleCtrlG ).pointCon(1)
        ApplyConstrain(self.ikHJnt[0],self.poleCtrlG ).pointCon(1)
        cmds.connectAttr((self.rev+'.outputX'),(self.ikJntG+'.visibility'))
        cmds.connectAttr((self.rev+'.outputX'),(self.ikHJntG+'.visibility'))
        cmds.connectAttr((self.rev+'.outputX'),(self.poleCtrlG+'.visibility'))
        cmds.connectAttr((self.rev+'.outputX'),(self.refLine.name+'.visibility'))
        

        #make fkJoint stretchy makeStetchyFK(self,attrName,scaleAxies)
        makeStretchy(self.fkJnt[0]).makeStetchyFK('stretch','scaleX')
        makeStretchy(self.ikJnt[0],self.gCtrl).makeStretchyIK(self.ikHJnt[0],2)
       
        
        #Housekeeping Groups
        rigCG = [self.topG,self.ikHJntG,self.poleCtrlG]
        rigPG = [self.rigParent,self.rigParent,self.rigParent]
        rigG = [rigCG,rigPG]
        kinematicsG = [(self.ikJntG+'_disNode_g'),self.refLine.hkG]
        helperG = [self.refLine.ctrl]
        rigHouseKeeping(self.rigName).rigParent(rigG, kinematicsG, helperG)