示例#1
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="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")
示例#2
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.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")
示例#3
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)
示例#4
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 = 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)
 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)
示例#6
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 = 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
    def changeJointNumber(self, enteredNJoints, *args):
        """ Edit the number of joints in the guide.
        """
        utils.useDefaultRenderLayer()
        # get the number of joints entered by user:
        if enteredNJoints == 0:
            try:
                self.enteredNJoints = cmds.intField(self.nJointsIF, query=True, value=True)
            except:
                return
        else:
            self.enteredNJoints = enteredNJoints
        # get the number of joints existing:
        self.currentNJoints = cmds.getAttr(self.moduleGrp+".nJoints")
        # start analisys the difference between values:
        if self.enteredNJoints != self.currentNJoints:
            # unparent temporarely the Ends:
            self.cvEndJoint = self.guideName+"_JointEnd"
            cmds.parent(self.cvEndJoint, world=True)
            self.jGuideEnd = (self.guideName+"_JGuideEnd")
            cmds.parent(self.jGuideEnd, world=True)
            # verify if the nJoints is greather or less than the current
            if self.enteredNJoints > self.currentNJoints:
                for n in range(self.currentNJoints+1, self.enteredNJoints+1):
                    # create another N cvJointLoc:
                    self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc( ctrlName=self.guideName+"_JointLoc"+str(n), r=0.3 )
                    self.connectShapeSize(shapeSizeCH)
                    # set its nJoint value as n:
                    cmds.setAttr(self.cvJointLoc+".nJoint", n)
                    # parent it to the lastGuide:
                    cmds.parent(self.cvJointLoc, self.guideName+"_JointLoc"+str(n-1), relative=True)
                    cmds.setAttr(self.cvJointLoc+".translateZ", 2)
                    # create a joint to use like an arrowLine:
                    self.jGuide = cmds.joint(name=self.guideName+"_JGuide"+str(n), radius=0.001)
                    cmds.setAttr(self.jGuide+".template", 1)
                    #Prevent a intermidiate node to be added
                    cmds.parent(self.jGuide, self.guideName+"_JGuide"+str(n-1), relative=True)
                    #Do not maintain offset and ensure cv will be at the same place than the joint
                    cmds.parentConstraint(self.cvJointLoc, self.jGuide, maintainOffset=False, name=self.jGuide+"_ParentConstraint")
                    cmds.scaleConstraint(self.cvJointLoc, self.jGuide, maintainOffset=False, name=self.jGuide+"_ScaleConstraint")
            elif self.enteredNJoints < self.currentNJoints:
                # re-define cvEndJoint:
                self.cvJointLoc = self.guideName+"_JointLoc"+str(self.enteredNJoints)
                self.cvEndJoint = self.guideName+"_JointEnd"
                self.jGuide = self.guideName+"_JGuide"+str(self.enteredNJoints)
                # re-parent the children guides:
                childrenGuideBellowList = utils.getGuideChildrenList(self.cvJointLoc)
                if childrenGuideBellowList:
                    for childGuide in childrenGuideBellowList:
                        cmds.parent(childGuide, self.cvJointLoc)
                # delete difference of nJoints:
                cmds.delete(self.guideName+"_JointLoc"+str(self.enteredNJoints+1))
                cmds.delete(self.guideName+"_JGuide"+str(self.enteredNJoints+1))
            # re-parent cvEndJoint:
            pTempParent = cmds.listRelatives(self.cvEndJoint, p=True)
            cmds.parent(self.cvEndJoint, self.cvJointLoc)

            #Ensure to remove temp parent from the unparenting done on the end joint
            if pTempParent:
                cmds.delete(pTempParent)
            cmds.setAttr(self.cvEndJoint+".tz", 1.3)
            pTempParent = cmds.listRelatives(self.jGuideEnd, p=True)
            cmds.parent(self.jGuideEnd, self.jGuide, relative=True)
            if pTempParent:
                cmds.delete(pTempParent)

            cmds.setAttr(self.moduleGrp+".nJoints", self.enteredNJoints)
            self.currentNJoints = self.enteredNJoints
            # re-build the preview mirror:
            Layout.LayoutClass.createPreviewMirror(self)
        cmds.select(self.moduleGrp)
示例#10
0
 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", ctrls.dpCheckLinearUnit(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)
示例#11
0
 def changeJointNumber(self, enteredNJoints, *args):
     """ Edit the number of joints in the guide.
     """
     utils.useDefaultRenderLayer()
     # get the number of joints entered by user:
     if enteredNJoints == 0:
         try:
             self.enteredNJoints = cmds.intField(self.nJointsIF, query=True, value=True)
         except:
             return
     else:
         self.enteredNJoints = enteredNJoints
     # get the number of joints existing:
     self.currentNJoints = cmds.getAttr(self.moduleGrp+".nJoints")
     # start analisys the difference between values:
     if self.enteredNJoints != self.currentNJoints:
         # unparent temporarely the Ends:
         self.cvEndJoint = self.guideName+"_JointEnd"
         cmds.parent(self.cvEndJoint, world=True)
         self.jGuideEnd = (self.guideName+"_JGuideEnd")
         cmds.parent(self.jGuideEnd, world=True)
         # verify if the nJoints is greather or less than the current
         if self.enteredNJoints > self.currentNJoints:
             for n in range(self.currentNJoints+1, self.enteredNJoints+1):
                 # create another N cvJointLoc:
                 self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc( ctrlName=self.guideName+"_JointLoc"+str(n), r=0.2 )
                 self.connectShapeSize(shapeSizeCH)
                 # set its nJoint value as n:
                 cmds.setAttr(self.cvJointLoc+".nJoint", n)
                 # parent it to the lastGuide:
                 cmds.parent(self.cvJointLoc, self.guideName+"_JointLoc"+str(n-1), relative=True)
                 cmds.setAttr(self.cvJointLoc+".translateZ", 1)
                 cmds.setAttr(self.cvJointLoc+".rotateY", -1)
                 # create a joint to use like an arrowLine:
                 self.jGuide = cmds.joint(name=self.guideName+"_JGuide"+str(n), radius=0.001)
                 cmds.setAttr(self.jGuide+".template", 1)
                 cmds.parent(self.jGuide, self.guideName+"_JGuide"+str(n-1))
                 ctrls.directConnect(self.cvJointLoc, self.jGuide, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
         elif self.enteredNJoints < self.currentNJoints:
             # re-define cvEndJoint:
             self.cvJointLoc = self.guideName+"_JointLoc"+str(self.enteredNJoints)
             self.cvEndJoint = self.guideName+"_JointEnd"
             self.jGuide = self.guideName+"_JGuide"+str(self.enteredNJoints)
             # re-parent the children guides:
             childrenGuideBellowList = utils.getGuideChildrenList(self.cvJointLoc)
             if childrenGuideBellowList:
                 for childGuide in childrenGuideBellowList:
                     cmds.parent(childGuide, self.cvJointLoc)
             # delete difference of nJoints:
             cmds.delete(self.guideName+"_JointLoc"+str(self.enteredNJoints+1))
             cmds.delete(self.guideName+"_JGuide"+str(self.enteredNJoints+1))
         # re-parent cvEndJoint:
         cmds.parent(self.cvEndJoint, self.cvJointLoc)
         cmds.setAttr(self.cvEndJoint+".tz", 1.3)
         cmds.parent(self.jGuideEnd, self.jGuide)
         # actualise the nJoints in the moduleGrp:
         cmds.setAttr(self.moduleGrp+".nJoints", self.enteredNJoints)
         self.currentNJoints = self.enteredNJoints
         # re-build the preview mirror:
         Layout.LayoutClass.createPreviewMirror(self)
     cmds.select(self.moduleGrp)
示例#12
0
 def changeJointNumber(self, enteredNJoints, *args):
     """ Edit the number of joints in the guide.
     """
     utils.useDefaultRenderLayer()
     # get the number of joints entered by user:
     if enteredNJoints == 0:
         try:
             self.enteredNJoints = cmds.intField(self.nJointsIF, query=True, value=True)
         except:
             return
     else:
         self.enteredNJoints = enteredNJoints
     # get the number of joints existing:
     self.currentNJoints = cmds.getAttr(self.moduleGrp+".nJoints")
     # start analisys the difference between values:
     if self.enteredNJoints != self.currentNJoints:
         # check if the controls have scale changed values in order to avoid the transform groups created from maya without namespace:
         scaledCtrl = False
         scaledCtrlDic = {}
         for j in range(1, self.currentNJoints+1):
             if cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleX") != 1 or cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleY") != 1 or cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleZ") != 1:
                 scaledCtrl = True
                 # get scale values:
                 scaledX = cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleX")
                 scaledY = cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleY")
                 scaledZ = cmds.getAttr(self.guideName+"_JointLoc"+str(j)+".scaleZ")
                 # store scale values in the dictionary:
                 scaledCtrlDic[j] = [scaledX, scaledY, scaledZ]
                 # reset scales values to 1,1,1:
                 cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleX", 1)
                 cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleY", 1)
                 cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleZ", 1)
         # unparent temporarely the Ends:
         self.cvEndJoint = self.guideName+"_JointEnd"
         cmds.parent(self.cvEndJoint, world=True)
         self.jGuideEnd = (self.guideName+"_JGuideEnd")
         cmds.parent(self.jGuideEnd, world=True)
         # verify if the nJoints is greather or less than the current
         if self.enteredNJoints > self.currentNJoints:
             for n in range(self.currentNJoints+1, self.enteredNJoints+1):
                 # create another N cvJointLoc:
                 self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc( ctrlName=self.guideName+"_JointLoc"+str(n), r=0.3 )
                 self.connectShapeSize(shapeSizeCH)
                 # set its nJoint value as n:
                 cmds.setAttr(self.cvJointLoc+".nJoint", n)
                 # parent it to the lastGuide:
                 cmds.parent(self.cvJointLoc, self.guideName+"_JointLoc"+str(n-1), relative=True)
                 cmds.setAttr(self.cvJointLoc+".translateZ", 2)
                 # create a joint to use like an arrowLine:
                 self.jGuide = cmds.joint(name=self.guideName+"_JGuide"+str(n), radius=0.001)
                 cmds.setAttr(self.jGuide+".template", 1)
                 cmds.parent(self.jGuide, self.guideName+"_JGuide"+str(n-1))
                 cmds.parentConstraint(self.cvJointLoc, self.jGuide, maintainOffset=True, name=self.jGuide+"_ParentConstraint")
                 cmds.scaleConstraint(self.cvJointLoc, self.jGuide, maintainOffset=True, name=self.jGuide+"_ScaleConstraint")
         elif self.enteredNJoints < self.currentNJoints:
             # re-define cvEndJoint:
             self.cvJointLoc = self.guideName+"_JointLoc"+str(self.enteredNJoints)
             self.cvEndJoint = self.guideName+"_JointEnd"
             self.jGuide = self.guideName+"_JGuide"+str(self.enteredNJoints)
             # re-parent the children guides:
             childrenGuideBellowList = utils.getGuideChildrenList(self.cvJointLoc)
             if childrenGuideBellowList:
                 for childGuide in childrenGuideBellowList:
                     cmds.parent(childGuide, self.cvJointLoc)
             # delete difference of nJoints:
             cmds.delete(self.guideName+"_JointLoc"+str(self.enteredNJoints+1))
             cmds.delete(self.guideName+"_JGuide"+str(self.enteredNJoints+1))
         # re-parent cvEndJoint:
         cmds.parent(self.cvEndJoint, self.cvJointLoc)
         cmds.setAttr(self.cvEndJoint+".tz", 1.3)
         cmds.parent(self.jGuideEnd, self.jGuide)
         # actualise the nJoints in the moduleGrp:
         cmds.setAttr(self.moduleGrp+".nJoints", self.enteredNJoints)
         self.currentNJoints = self.enteredNJoints
         # reset changed scale values again:
         if scaledCtrl:
             for j in scaledCtrlDic:
                 if cmds.objExists(self.guideName+"_JointLoc"+str(j)):
                     cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleX", scaledCtrlDic[j][0])
                     cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleY", scaledCtrlDic[j][1])
                     cmds.setAttr(self.guideName+"_JointLoc"+str(j)+".scaleZ", scaledCtrlDic[j][2])
         # re-build the preview mirror:
         Layout.LayoutClass.createPreviewMirror(self)
     cmds.select(self.moduleGrp)
示例#13
0
 def changeJointNumber(self, enteredNJoints, *args):
     """ Edit the number of joints in the guide.
     """
     utils.useDefaultRenderLayer()
     # get the number of joints entered by user:
     if enteredNJoints == 0:
         try:
             self.enteredNJoints = cmds.intField(self.nJointsIF, query=True, value=True)
         except:
             return
     else:
         self.enteredNJoints = enteredNJoints
     # get the number of joints existing:
     self.currentNJoints = cmds.getAttr(self.moduleGrp + ".nJoints")
     # start analisys the difference between values:
     if self.enteredNJoints != self.currentNJoints:
         # unparent temporarely the Ends:
         self.cvEndJoint = self.guideName + "_JointEnd"
         cmds.parent(self.cvEndJoint, world=True)
         self.jGuideEnd = (self.guideName + "_JGuideEnd")
         cmds.parent(self.jGuideEnd, world=True)
         # verify if the nJoints is greather or less than the current
         if self.enteredNJoints > self.currentNJoints:
             for n in range(self.currentNJoints + 1, self.enteredNJoints + 1):
                 # create another N cvJointLoc:
                 self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName + "_JointLoc" + str(n),
                                                                 r=0.2)
                 self.connectShapeSize(shapeSizeCH)
                 # set its nJoint value as n:
                 cmds.setAttr(self.cvJointLoc + ".nJoint", n)
                 # parent it to the lastGuide:
                 cmds.parent(self.cvJointLoc, self.guideName + "_JointLoc" + str(n - 1), relative=True)
                 cmds.setAttr(self.cvJointLoc + ".translateZ", 1)
                 cmds.setAttr(self.cvJointLoc + ".rotateY", -1)
                 # create a joint to use like an arrowLine:
                 self.jGuide = cmds.joint(name=self.guideName + "_JGuide" + str(n), radius=0.001)
                 cmds.setAttr(self.jGuide + ".template", 1)
                 cmds.parent(self.jGuide, self.guideName + "_JGuide" + str(n - 1))
                 ctrls.directConnect(self.cvJointLoc, self.jGuide, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
         elif self.enteredNJoints < self.currentNJoints:
             # re-define cvEndJoint:
             self.cvJointLoc = self.guideName + "_JointLoc" + str(self.enteredNJoints)
             self.cvEndJoint = self.guideName + "_JointEnd"
             self.jGuide = self.guideName + "_JGuide" + str(self.enteredNJoints)
             # re-parent the children guides:
             childrenGuideBellowList = utils.getGuideChildrenList(self.cvJointLoc)
             if childrenGuideBellowList:
                 for childGuide in childrenGuideBellowList:
                     cmds.parent(childGuide, self.cvJointLoc)
             # delete difference of nJoints:
             cmds.delete(self.guideName + "_JointLoc" + str(self.enteredNJoints + 1))
             cmds.delete(self.guideName + "_JGuide" + str(self.enteredNJoints + 1))
         # re-parent cvEndJoint:
         cmds.parent(self.cvEndJoint, self.cvJointLoc)
         cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
         cmds.parent(self.jGuideEnd, self.jGuide)
         # actualise the nJoints in the moduleGrp:
         cmds.setAttr(self.moduleGrp + ".nJoints", self.enteredNJoints)
         self.currentNJoints = self.enteredNJoints
         # re-build the preview mirror:
         Layout.LayoutClass.createPreviewMirror(self)
     cmds.select(self.moduleGrp)
示例#14
0
 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", ctrls.dpCheckLinearUnit(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)
示例#15
0
 def changeJointNumber(self, enteredNJoints, *args):
     """ Edit the number of joints in the guide.
     """
     utils.useDefaultRenderLayer()
     # get the number of joints entered by user:
     if enteredNJoints == 0:
         try:
             self.enteredNJoints = cmds.intField(self.nJointsIF,
                                                 query=True,
                                                 value=True)
         except:
             return
     else:
         self.enteredNJoints = enteredNJoints
     # get the number of joints existing:
     self.currentNJoints = cmds.getAttr(self.moduleGrp + ".nJoints")
     # start analisys the difference between values:
     if self.enteredNJoints != self.currentNJoints:
         # check if the controls have scale changed values in order to avoid the transform groups created from maya without namespace:
         scaledCtrl = False
         scaledCtrlDic = {}
         for j in range(1, self.currentNJoints + 1):
             if cmds.getAttr(self.guideName + "_JointLoc" + str(j) +
                             ".scaleX") != 1 or cmds.getAttr(
                                 self.guideName + "_JointLoc" + str(j) +
                                 ".scaleY") != 1 or cmds.getAttr(
                                     self.guideName + "_JointLoc" + str(j) +
                                     ".scaleZ") != 1:
                 scaledCtrl = True
                 # get scale values:
                 scaledX = cmds.getAttr(self.guideName + "_JointLoc" +
                                        str(j) + ".scaleX")
                 scaledY = cmds.getAttr(self.guideName + "_JointLoc" +
                                        str(j) + ".scaleY")
                 scaledZ = cmds.getAttr(self.guideName + "_JointLoc" +
                                        str(j) + ".scaleZ")
                 # store scale values in the dictionary:
                 scaledCtrlDic[j] = [scaledX, scaledY, scaledZ]
                 # reset scales values to 1,1,1:
                 cmds.setAttr(
                     self.guideName + "_JointLoc" + str(j) + ".scaleX", 1)
                 cmds.setAttr(
                     self.guideName + "_JointLoc" + str(j) + ".scaleY", 1)
                 cmds.setAttr(
                     self.guideName + "_JointLoc" + str(j) + ".scaleZ", 1)
         # unparent temporarely the Ends:
         self.cvEndJoint = self.guideName + "_JointEnd"
         cmds.parent(self.cvEndJoint, world=True)
         self.jGuideEnd = (self.guideName + "_JGuideEnd")
         cmds.parent(self.jGuideEnd, world=True)
         # verify if the nJoints is greather or less than the current
         if self.enteredNJoints > self.currentNJoints:
             for n in range(self.currentNJoints + 1,
                            self.enteredNJoints + 1):
                 # create another N cvJointLoc:
                 self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(
                     ctrlName=self.guideName + "_JointLoc" + str(n), r=0.3)
                 self.connectShapeSize(shapeSizeCH)
                 # set its nJoint value as n:
                 cmds.setAttr(self.cvJointLoc + ".nJoint", n)
                 # parent it to the lastGuide:
                 cmds.parent(self.cvJointLoc,
                             self.guideName + "_JointLoc" + str(n - 1),
                             relative=True)
                 cmds.setAttr(self.cvJointLoc + ".translateZ", 2)
                 # create a joint to use like an arrowLine:
                 self.jGuide = cmds.joint(name=self.guideName + "_JGuide" +
                                          str(n),
                                          radius=0.001)
                 cmds.setAttr(self.jGuide + ".template", 1)
                 cmds.parent(self.jGuide,
                             self.guideName + "_JGuide" + str(n - 1))
                 cmds.parentConstraint(self.cvJointLoc,
                                       self.jGuide,
                                       maintainOffset=True,
                                       name=self.jGuide +
                                       "_ParentConstraint")
                 cmds.scaleConstraint(self.cvJointLoc,
                                      self.jGuide,
                                      maintainOffset=True,
                                      name=self.jGuide + "_ScaleConstraint")
         elif self.enteredNJoints < self.currentNJoints:
             # re-define cvEndJoint:
             self.cvJointLoc = self.guideName + "_JointLoc" + str(
                 self.enteredNJoints)
             self.cvEndJoint = self.guideName + "_JointEnd"
             self.jGuide = self.guideName + "_JGuide" + str(
                 self.enteredNJoints)
             # re-parent the children guides:
             childrenGuideBellowList = utils.getGuideChildrenList(
                 self.cvJointLoc)
             if childrenGuideBellowList:
                 for childGuide in childrenGuideBellowList:
                     cmds.parent(childGuide, self.cvJointLoc)
             # delete difference of nJoints:
             cmds.delete(self.guideName + "_JointLoc" +
                         str(self.enteredNJoints + 1))
             cmds.delete(self.guideName + "_JGuide" +
                         str(self.enteredNJoints + 1))
         # re-parent cvEndJoint:
         cmds.parent(self.cvEndJoint, self.cvJointLoc)
         cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
         cmds.parent(self.jGuideEnd, self.jGuide)
         # actualise the nJoints in the moduleGrp:
         cmds.setAttr(self.moduleGrp + ".nJoints", self.enteredNJoints)
         self.currentNJoints = self.enteredNJoints
         # reset changed scale values again:
         if scaledCtrl:
             for j in scaledCtrlDic:
                 if cmds.objExists(self.guideName + "_JointLoc" + str(j)):
                     cmds.setAttr(
                         self.guideName + "_JointLoc" + str(j) + ".scaleX",
                         scaledCtrlDic[j][0])
                     cmds.setAttr(
                         self.guideName + "_JointLoc" + str(j) + ".scaleY",
                         scaledCtrlDic[j][1])
                     cmds.setAttr(
                         self.guideName + "_JointLoc" + str(j) + ".scaleZ",
                         scaledCtrlDic[j][2])
         # re-build the preview mirror:
         Layout.LayoutClass.createPreviewMirror(self)
     cmds.select(self.moduleGrp)