Exemple #1
0
 def makeStretchyIK(self,ikdriver,TwoBIK = None):        
     #combine libstretch and here with limb scale
     parent = dt.findParent(self.startJoint).parent[0]
     ikJnt =  jo.JointOperation().jointsInfo(self.startJoint, 1)
     length = jo.JointOperation().jointLengthInfo(self.startJoint,TwoBIK)
     
     upperLimbPma = makeStretchy(ikdriver).makeLimbStretch('upperLimb', ikJnt[0], 'scaleX',ikJnt[0])
     lowerLimbPma = makeStretchy(ikdriver).makeLimbStretch('lowerLimb', ikJnt[1], 'scaleX',ikJnt[1])
           
     dis = MakeDisNode(parent,ikdriver,length,self.gCtrl).LocDisNode()
            
     cmds.connectAttr((dis+'.outColorR'), (upperLimbPma+'.input1D[1]'),f=1)
     cmds.connectAttr((dis+'.outColorR'), (lowerLimbPma+'.input1D[1]'),f=1)
     
     return dis 
 def curveSkinCtrls(self,allc,name):
     
     self.ctrlJnts = []
     dtO = dt.DailyTool()
     Crv = self.curveCvInfo()
     joO = jo.JointOperation()        
     dtO.delHis(self.curve)
                    
     for i in range(0,Crv[1]):
         dtO.cls()
         jntPV = cmds.getAttr(self.curve+'.cv[%d]' % i)
         jntP = jntPV[0]
         jnt = joO.creatCtrlJoints(jntP[0],jntP[1],jntP[2])
         self.ctrlJnts.append(jnt)
         dtO.cls()
     if allc == 0:
         cmds.delete(self.ctrlJnts[1])
         cmds.delete(self.ctrlJnts[(Crv[1]-2)])
         self.ctrlJnts.pop(1)
         self.ctrlJnts.pop(-2)
     cmds.select(self.ctrlJnts)
     sel = cmds.ls(sl=1)
     for i in range(0,len(sel)):
         a = i+1
         reJnt =cmds.rename((sel[i]),((name+'0%d') % a ) )
         self.ctrlJnts.pop(0)
         self.ctrlJnts.append(reJnt)
     cmds.select(self.ctrlJnts,self.curve)
     cmds.skinCluster(n = name+'_skin')
     
     return self.ctrlJnts
Exemple #3
0
 def makeFeetRig(self,startJoint,Ctrl,ikH,atrrs,refPiv1,refPiv2):
     self.sourceJnt  =  jo.JointOperation().jointsInfo(startJoint,1)
     
     ikHBall =  twoJointIk(self.sourceJnt[0],1)
     ikHToe =  twoJointIk(self.sourceJnt[1],1)      
     
     sdkPivG = [self.sourceJnt[1],self.sourceJnt[1],refPiv1,refPiv2]
     
     self.parentSDKG = []
     self.drivens =  []
     for i in range(0,len(atrrs)):
         self.drivens.append(ApplyConstrain(sdkPivG[i]).makeConGrp(0, atrrs[i]))
         self.parentSDKG.append(ApplyConstrain(self.drivens[i]).makeOffGrp(2, self.drivens[i]))
         
     for i in range(0,len(self.parentSDKG)-1):
         if(i == 2):
             pIndex = 3
         else:
             pIndex =  2                
         dt.parentIT(self.parentSDKG[i],self.parentSDKG[pIndex][:-2])           
     
     dt.parentIT(ikH,self.drivens[0])
     dt.parentIT(ikHBall.ikH[0],self.drivens[0])
     dt.parentIT(ikHToe.ikH[0],self.drivens[1])
     dt.parentIT(self.parentSDKG[-1],Ctrl)
     
             
     axis = 'rx'
     driverVal = [[0,0,10],[0,-10,10],[0,0,10],[0,0,10]]
     drivenVal =[[0,0,90],[0,90,-90],[0,0,90],[0,0,-90]]
     
     for i in range(0,len(self.drivens)):
         AddDriverAttr(Ctrl,atrrs[i],driverVal[i][0],driverVal[i][1],driverVal[i][2],'float')                         
         for j in range(0,3):
             cmds.setDrivenKeyframe((self.drivens[i]+'.'+axis),cd= (Ctrl+'.'+atrrs[i]),dv=(driverVal[i][j]),v=(drivenVal[i][j]))
Exemple #4
0
 def __init__(self,startJoint):
     self.startJoint = startJoint
     self.joint =  jo.JointOperation()
     dtO = dt.DailyTool()
     self.stEd = self.joint.jointsInfo(self.startJoint,0)
     self.allJnts = self.joint.jointsInfo(self.startJoint,1)
     dtO.cls()
Exemple #5
0
 def __init__(self,startJoint,endJoint,poleVec= None):
     self.startJoint =  startJoint
     self.poleVec = poleVec
     self.endJoint =  endJoint
     self.stEd = jo.JointOperation().jointsInfo(self.startJoint,1)
     self.ikH = IKRP(self.startJoint,self.stEd[self.endJoint]).applyIk()
     if self.poleVec:
         self.poleCon = ApplyConstrain(self.poleVec,self.ikH[0]).poleVecCon()
     cmds.setAttr((self.ikH[0]+'.visibility'),0)
Exemple #6
0
 def makeStetchyFK(self,attrName,scaleAxies):
     self.jnts =  jo.JointOperation().jointsInfo(self.startJoint,1)
     for i in range(0,len(self.jnts)-1):
         AddDriverAttr(self.jnts[i],attrName,0,0,10,'float')
         self.makeStretchyCore(self.jnts[i], attrName, self.jnts[i], scaleAxies)            
Exemple #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)