Пример #1
0
    def setupIKCtrl(self, x, IKHandle):

        ############# MODIFY FOR INHERITANCE  #############
        side = self.prefixList[x]
        thisChain = self.IKChains[x]

        #create a control for the ik
        name = "%s_%s_IK_CTRL"%(side, self.limbName)
        if x==0:
            IKCtrl = rig.createControl(name, "cube", self.jAxis1, "blue")
        if x==1:
            IKCtrl = rig.createControl(name, "cube", self.jAxis1, "red")
        self.IKCtrls.append(IKCtrl)
        #strip to rotate and translate
        rig.stripToRotateTranslate(IKCtrl)

        #G.O. control
        rig.groupOrient(thisChain[2], IKCtrl, self.groupSuffix)

        #orient constraint joint 2 (wrist ankle) to control
        cmds.orientConstraint(IKCtrl, thisChain[2])

        #parent ik handle to control
        cmds.parent(IKHandle, IKCtrl)

        return IKCtrl
Пример #2
0
	def setupIKCtrl(self, x, IKHandle):

		############# MODIFY FOR INHERITANCE  #############
		side = self.prefixList[x]
		thisChain = self.IKChains[x]

		#create a control for the ik
		name = "%s_%s_IK_CTRL"%(side, self.limbName)
		if x==0:
			IKCtrl = rig.createControl(name, "cube", self.jAxis1, "blue")
		if x==1:
			IKCtrl = rig.createControl(name, "cube", self.jAxis1, "red")
		self.IKCtrls.append(IKCtrl)
		#strip to rotate and translate
		rig.stripToRotateTranslate(IKCtrl)

		#G.O. control
		group = rig.groupOrient(thisChain[2], IKCtrl, self.groupSuffix)
		##########
		cmds.setAttr("%s.rotateX"%group, (0))
		cmds.setAttr("%s.rotateY"%group, (0))
		cmds.setAttr("%s.rotateZ"%group, (0))

		#orient constraint joint 2 (wrist ankle) to control
		##########
		# cmds.orientConstraint(IKCtrl, thisChain[2], mo=True)

		#parent ik handle to control
		cmds.parent(IKHandle, IKCtrl)

		return IKCtrl
Пример #3
0
    def setupFK(self, x):
        """sets up the fk portion of this limb"""
        thisChain = self.FKChains[x]
        side = self.prefixList[x]

        ctrlList = []
        grpList = []

        for i in range(len(thisChain)-1):
            #create control for joint (octagon)
            ctrlName = (thisChain[i].rstrip(self.jointSuffix) + self.controlSuffix)

            #create control
            if x==0:
                ctrl = rig.createControl(ctrlName, "sphere", self.jAxis1, "blue")
            if x==1:
                ctrl = rig.createControl(ctrlName, "sphere", self.jAxis1, "red")
            grpName = "%s_%s"%(ctrl,self.groupSuffix)

            rig.groupOrient(thisChain[i], ctrl, self.groupSuffix)

            #connect the joints to the controls
#-----------catch this constraint with variable????
            cmds.parentConstraint(ctrl, thisChain[i])

            #deal with attrs
            rig.stripToRotateTranslate(ctrl)
            rig.lockTranslate(ctrl)
            cmds.addAttr(ctrl, at="short", ln="__EXTRA__", nn="__EXTRA__", k=True)
            cmds.setAttr("%s.__EXTRA__"%ctrl, l=True)
            cmds.addAttr(ctrl, at="float", ln="stretch", dv=1, min=0.3, max=3, k=True)
            cmds.connectAttr("%s.stretch"%ctrl, "%s.s%s"%(thisChain[i], self.jAxis1))

            ctrlList.append(ctrl)
            grpList.append(grpName)

        #parent up the controls to each other
        for j in range((len(grpList)-1), 0, -1):
            cmds.parent(grpList[j], ctrlList[j-1])

        #create lists of controls
        self.FKCtrlChains.append(ctrlList)

        #do the visibilty of the fk chain from the IK switch
        ikS = self.IKSwitches[x]
        rName = ("%s_%s_ikReverse"%(self.prefixList[x], self.limbName))
        grpTop = cmds.listRelatives(self.FKCtrlChains[x][0], p=True)[0]
        cmds.shadingNode("reverse", asUtility=True, n=( rName))
        cmds.connectAttr("%s.FKIK"%ikS, "%s.inputX"%rName)
        cmds.connectAttr("%s.outputX"%rName, "%s.visibility"%grpTop)

        #pass to bind setup
        self.setupBind(x)