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.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", 13) 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=True, name=self.jGuide1+"_ParentConstraint") cmds.parentConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=True, name=self.jGuideEnd+"_ParentConstraint") cmds.scaleConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=True, name=self.jGuide1+"_ScaleConstraint") cmds.scaleConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=True, name=self.jGuideEnd+"_ScaleConstraint")
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)
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)
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: self.cvEndJoint = self.guideName + "_JointEnd" if self.currentNJoints > 1: # delete current point constraints: for n in range(2, self.currentNJoints): cmds.delete(self.guideName + "_ParentConstraint" + str(n)) # verify if the nJoints is greather or less than the current if self.enteredNJoints > self.currentNJoints: # add the new cvLocators: for n in range(self.currentNJoints + 1, self.enteredNJoints + 1): # create another N cvLocator: self.cvLocator, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_JointLoc" + str(n), r=0.3) self.connectShapeSize(shapeSizeCH) # set its nJoint value as n: cmds.setAttr(self.cvLocator + ".nJoint", n) # parent its group to the first cvJointLocator: self.cvLocGrp = cmds.group(self.cvLocator, name=self.cvLocator + "_Grp") cmds.parent(self.cvLocGrp, self.guideName + "_JointLoc" + str(n - 1), relative=True) cmds.setAttr(self.cvLocGrp + ".translateZ", 2) if n > 2: cmds.parent(self.cvLocGrp, self.guideName + "_JointLoc1", absolute=True) elif self.enteredNJoints < self.currentNJoints: # re-parent cvEndJoint: self.cvLocator = self.guideName + "_JointLoc" + str(self.enteredNJoints) cmds.parent(self.cvEndJoint, world=True) # delete difference of nJoints: for n in range(self.enteredNJoints, self.currentNJoints): # re-parent the children guides: childrenGuideBellowList = utils.getGuideChildrenList( self.guideName + "_JointLoc" + str(n + 1) + "_Grp" ) if childrenGuideBellowList: for childGuide in childrenGuideBellowList: cmds.parent(childGuide, self.cvLocator) cmds.delete(self.guideName + "_JointLoc" + str(n + 1) + "_Grp") # re-parent cvEndJoint: cmds.parent(self.cvEndJoint, self.cvLocator) cmds.setAttr(self.cvEndJoint + ".tz", 1.3) cmds.setAttr(self.cvEndJoint + ".visibility", 0) # re-create parentConstraints: if self.enteredNJoints > 1: for n in range(2, self.enteredNJoints): self.parentConst = cmds.parentConstraint( self.guideName + "_JointLoc1", self.cvEndJoint, self.guideName + "_JointLoc" + str(n) + "_Grp", name=self.guideName + "_ParentConstraint" + str(n), maintainOffset=True, )[0] nParentValue = (n - 1) / float(self.enteredNJoints - 1) cmds.setAttr(self.parentConst + ".Guide_JointLoc1W0", 1 - nParentValue) cmds.setAttr(self.parentConst + ".Guide_JointEndW1", nParentValue) ctrls.setLockHide([self.guideName + "_JointLoc" + str(n)], ["rx", "ry", "rz", "sx", "sy", "sz"]) # 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)
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)