def rigModule(self, *args): Base.StartClass.rigModule(self) # verify if the guide exists: if cmds.objExists(self.moduleGrp): try: hideJoints = cmds.checkBox("hideJointsCB", query=True, value=True) except: hideJoints = 1 # declare lists to store names and attributes: self.hipsAList, self.chestAList, self.volumeVariationAttrList = [], [], [] # start as no having mirror: sideList = [""] # analisys the mirror module: self.mirrorAxis = cmds.getAttr(self.moduleGrp + ".mirrorAxis") if self.mirrorAxis != "off": # get rigs names: self.mirrorNames = cmds.getAttr(self.moduleGrp + ".mirrorName") # get first and last letters to use as side initials (prefix): sideList = [self.mirrorNames[0] + "_", self.mirrorNames[len(self.mirrorNames) - 1] + "_"] for s, side in enumerate(sideList): duplicated = cmds.duplicate(self.moduleGrp, name=side + self.userGuideName + "_Guide_Base")[0] allGuideList = cmds.listRelatives(duplicated, allDescendents=True) for item in allGuideList: cmds.rename(item, side + self.userGuideName + "_" + item) self.mirrorGrp = cmds.group(name="Guide_Base_Grp", empty=True) cmds.parent(side + self.userGuideName + "_Guide_Base", self.mirrorGrp, absolute=True) # re-rename grp: cmds.rename(self.mirrorGrp, side + self.userGuideName + "_" + self.mirrorGrp) # do a group mirror with negative scaling: if s == 1: for axis in self.mirrorAxis: cmds.setAttr(side + self.userGuideName + "_" + self.mirrorGrp + ".scale" + axis, -1) else: # if not mirror: duplicated = cmds.duplicate(self.moduleGrp, name=self.userGuideName + "_Guide_Base")[0] allGuideList = cmds.listRelatives(duplicated, allDescendents=True) for item in allGuideList: cmds.rename(item, self.userGuideName + "_" + item) self.mirrorGrp = cmds.group(self.userGuideName + "_Guide_Base", name="Guide_Base_Grp", relative=True) # re-rename grp: cmds.rename(self.mirrorGrp, self.userGuideName + "_" + self.mirrorGrp) # store the number of this guide by module type dpAR_count = utils.findModuleLastNumber(CLASS_NAME, "dpAR_type") + 1 # run for all sides for s, side in enumerate(sideList): self.base = side + self.userGuideName + "_Guide_Base" # get the number of joints to be created: self.nJoints = cmds.getAttr(self.base + ".nJoints") # create controls: self.hipsA = ctrls.cvBox( ctrlName=side + self.userGuideName + "_" + self.langDic[self.langName]["c_hips"] + "A_Ctrl", r=self.ctrlRadius, h=(self.ctrlRadius * 0.25), ) self.hipsB = cmds.circle( name=side + self.userGuideName + "_" + self.langDic[self.langName]["c_hips"] + "B_Ctrl", ch=False, o=True, nr=(0, 1, 0), d=1, s=8, radius=self.ctrlRadius, )[0] self.chestA = ctrls.cvBox( ctrlName=side + self.userGuideName + "_" + self.langDic[self.langName]["c_chest"] + "A_Ctrl", r=self.ctrlRadius, h=(self.ctrlRadius * 0.25), ) self.chestB = cmds.circle( name=side + self.userGuideName + "_" + self.langDic[self.langName]["c_chest"] + "B_Ctrl", ch=False, o=True, nr=(0, 1, 0), d=1, s=8, radius=self.ctrlRadius, )[0] cmds.addAttr( self.hipsA, longName=side + self.userGuideName + "_" + self.langDic[self.langName]["c_volumeVariation"], attributeType="float", defaultValue=1, keyable=True, ) ctrls.setLockHide([self.hipsA, self.hipsB, self.chestA, self.chestB], ["v"], l=False) self.hipsAList.append(self.hipsA) self.chestAList.append(self.chestA) self.volumeVariationAttrList.append( side + self.userGuideName + "_" + self.langDic[self.langName]["c_volumeVariation"] ) # organize hierarchy: cmds.parent(self.hipsB, self.hipsA) cmds.parent(self.chestB, self.chestA) cmds.parent(self.chestA, self.hipsA) cmds.rotate(-90, 0, 0, self.hipsA) cmds.makeIdentity(self.hipsA, apply=True, rotate=True) # position of controls: bottomLocGuide = side + self.userGuideName + "_Guide_JointLoc1" topLocGuide = side + self.userGuideName + "_Guide_JointLoc" + str(self.nJoints) # snap controls to guideLocators: tempDel = cmds.parentConstraint(bottomLocGuide, self.hipsA, maintainOffset=False) cmds.delete(tempDel) tempDel = cmds.parentConstraint(topLocGuide, self.chestA, maintainOffset=False) cmds.delete(tempDel) # zeroOut transformations: utils.zeroOut([self.hipsA, self.chestA]) # modify the pivots of chest controls: upPivotPos = cmds.xform( side + self.userGuideName + "_Guide_JointLoc" + str(self.nJoints - 1), query=True, worldSpace=True, translation=True, ) cmds.move( upPivotPos[0], upPivotPos[1], upPivotPos[2], self.chestA + ".scalePivot", self.chestA + ".rotatePivot", ) # , self.chestB+".scalePivot", self.chestB+".rotatePivot") # add originedFrom attributes to hipsA, hipsB and chestB: utils.originedFrom(objName=self.hipsA, attrString=self.base) utils.originedFrom(objName=self.hipsB, attrString=bottomLocGuide) utils.originedFrom(objName=self.chestB, attrString=topLocGuide) # create a simple spine ribbon: returnedRibbonList = ctrls.createSimpleRibbon( name=side + self.userGuideName + "_Rbn", totalJoints=(self.nJoints - 1) ) rbnNurbsPlane = returnedRibbonList[0] rbnNurbsPlaneShape = returnedRibbonList[1] rbnJointGrpList = returnedRibbonList[2] rbnJointList = returnedRibbonList[3] # position of ribbon nurbs plane: cmds.setAttr(rbnNurbsPlane + ".tz", -4) cmds.move(0, 0, 0, rbnNurbsPlane + ".scalePivot", rbnNurbsPlane + ".rotatePivot") cmds.rotate(90, 90, 0, rbnNurbsPlane) cmds.makeIdentity(rbnNurbsPlane, apply=True, translate=True, rotate=True) downLocPos = cmds.xform( side + self.userGuideName + "_Guide_JointLoc1", query=True, worldSpace=True, translation=True ) upLocPos = cmds.xform( side + self.userGuideName + "_Guide_JointLoc" + str(self.nJoints), query=True, worldSpace=True, translation=True, ) cmds.move(downLocPos[0], downLocPos[1], downLocPos[2], rbnNurbsPlane) # create up and down clusters: downCluster = cmds.cluster( rbnNurbsPlane + ".cv[0:3][0:1]", name=side + self.userGuideName + "_Down_Cls" )[1] upCluster = cmds.cluster( rbnNurbsPlane + ".cv[0:3][" + str(self.nJoints) + ":" + str(self.nJoints + 1) + "]", name=side + self.userGuideName + "_Up_Cls", )[1] # get positions of joints from ribbon nurbs plane: startRbnJointPos = cmds.xform( side + self.userGuideName + "_Rbn0_Jnt", query=True, worldSpace=True, translation=True ) endRbnJointPos = cmds.xform( side + self.userGuideName + "_Rbn" + str(self.nJoints - 1) + "_Jnt", query=True, worldSpace=True, translation=True, ) # move pivots of clusters to start and end positions: cmds.move( startRbnJointPos[0], startRbnJointPos[1], startRbnJointPos[2], downCluster + ".scalePivot", downCluster + ".rotatePivot", ) cmds.move( endRbnJointPos[0], endRbnJointPos[1], endRbnJointPos[2], upCluster + ".scalePivot", upCluster + ".rotatePivot", ) # snap clusters to guideLocators: tempDel = cmds.parentConstraint(bottomLocGuide, downCluster, maintainOffset=False) cmds.delete(tempDel) tempDel = cmds.parentConstraint(topLocGuide, upCluster, maintainOffset=False) cmds.delete(tempDel) # rotate clusters to compensate guide: upClusterRot = cmds.xform(upCluster, query=True, worldSpace=True, rotation=True) downClusterRot = cmds.xform(downCluster, query=True, worldSpace=True, rotation=True) cmds.xform( upCluster, worldSpace=True, rotation=(upClusterRot[0] + 90, upClusterRot[1], upClusterRot[2]) ) cmds.xform( downCluster, worldSpace=True, rotation=(downClusterRot[0] + 90, downClusterRot[1], downClusterRot[2]), ) # scaleY of the clusters in order to avoid great extremity deforms: rbnHeight = ctrls.distanceBet( side + self.userGuideName + "_Guide_JointLoc" + str(self.nJoints), side + self.userGuideName + "_Guide_JointLoc1", keep=False, )[0] cmds.setAttr(upCluster + ".sy", rbnHeight / 10) cmds.setAttr(downCluster + ".sy", rbnHeight / 10) # parent clusters in controls (up and down): cmds.parentConstraint( self.hipsB, downCluster, maintainOffset=True, name=downCluster + "_ParentConstraint" ) cmds.parentConstraint(self.chestB, upCluster, maintainOffset=True, name=upCluster + "_ParentConstraint") # organize a group of clusters: self.clustersGrp = cmds.group(name=side + self.userGuideName + "_Rbn_Clusters_Grp", empty=True) if hideJoints: cmds.setAttr(self.clustersGrp + ".visibility", 0) cmds.parent(downCluster, upCluster, self.clustersGrp, relative=True) # make ribbon joints groups scalable: for r, rbnJntGrp in enumerate(rbnJointGrpList): if (r > 0) and (r < (len(rbnJointGrpList) - 1)): scaleGrp = cmds.group(rbnJntGrp, name=rbnJntGrp.replace("_Grp", "_Scale_Grp")) ctrls.directConnect(scaleGrp, rbnJntGrp, ["sx", "sz"]) cmds.scaleConstraint(self.clustersGrp, scaleGrp, maintainOffset=True, name=rbnJntGrp + "_Scale") else: cmds.scaleConstraint( self.clustersGrp, rbnJntGrp, maintainOffset=True, name=rbnJntGrp + "_Scale" ) # calculate the distance to volumeVariation: arcLenShape = cmds.createNode("arcLengthDimension", name=side + self.userGuideName + "_Rbn_ArcLenShape") arcLenFather = cmds.listRelatives(arcLenShape, parent=True)[0] arcLen = cmds.rename(arcLenFather, side + self.userGuideName + "_Rbn_ArcLen") arcLenShape = cmds.listRelatives(arcLen, children=True, shapes=True)[0] cmds.setAttr(arcLen + ".visibility", 0) # connect nurbsPlaneShape to arcLength node: cmds.connectAttr(rbnNurbsPlaneShape + ".worldSpace[0]", arcLenShape + ".nurbsGeometry") cmds.setAttr(arcLenShape + ".vParamValue", 1) # avoid undesired squash if rotateZ the nurbsPlane: cmds.setAttr(arcLenShape + ".uParamValue", 0.5) arcLenValue = cmds.getAttr(arcLenShape + ".arcLengthInV") # create a multiplyDivide to output the squashStretch values: rbnMD = cmds.createNode("multiplyDivide", name=side + self.userGuideName + "_Rbn_MD") cmds.connectAttr(arcLenShape + ".arcLengthInV", rbnMD + ".input2X") cmds.setAttr(rbnMD + ".input1X", arcLenValue) cmds.setAttr(rbnMD + ".operation", 2) # create a blendColor in order to get the correct result value of volumeVariation: rbnBlendColors = cmds.createNode("blendColors", name=side + self.userGuideName + "_Rbn_BlendColor") cmds.connectAttr( self.hipsA + "." + side + self.userGuideName + "_" + self.langDic[self.langName]["c_volumeVariation"], rbnBlendColors + ".blender", ) cmds.connectAttr(rbnMD + ".outputX", rbnBlendColors + ".color1R") cmds.setAttr(rbnBlendColors + ".color2R", 1) # middle ribbon setup: for n in range(1, self.nJoints - 1): self.middle = cmds.circle( name=side + self.userGuideName + "_" + self.langDic[self.langName]["c_middle"] + str(n) + "_Ctrl", ch=False, o=True, nr=(0, 0, 1), d=3, s=8, radius=self.ctrlRadius, )[0] ctrls.setLockHide([self.middle], ["sx", "sy", "sz"]) cmds.setAttr(self.middle + ".visibility", keyable=False) cmds.parent(self.middle, self.hipsA) middleLocGuide = side + self.userGuideName + "_Guide_JointLoc" + str(n + 1) tempDel = cmds.parentConstraint(middleLocGuide, self.middle, maintainOffset=False) cmds.delete(tempDel) utils.zeroOut([self.middle]) middleCluster = cmds.cluster( rbnNurbsPlane + ".cv[0:3][" + str(n + 1) + "]", name=side + self.userGuideName + "_Middle_Cls" )[1] middleLocPos = cmds.xform( side + self.userGuideName + "_Guide_JointLoc" + str(n), query=True, worldSpace=True, translation=True, ) tempDel = cmds.parentConstraint(middleLocGuide, middleCluster, maintainOffset=False) cmds.delete(tempDel) middleClusterRot = cmds.xform(middleCluster, query=True, worldSpace=True, rotation=True) cmds.xform( middleCluster, worldSpace=True, rotation=(middleClusterRot[0] + 90, middleClusterRot[1], middleClusterRot[2]), ) cmds.parentConstraint( self.middle, middleCluster, maintainOffset=True, name=middleCluster + "_ParentConstraint" ) # parenting constraints like guide locators: self.parentConst = cmds.parentConstraint( self.hipsB, self.chestB, self.middle + "_Zero", name=self.middle + "_ParentConstraint", maintainOffset=True, )[0] nParentValue = (n) / float(self.nJoints - 1) cmds.setAttr(self.parentConst + "." + self.hipsB + "W0", 1 - nParentValue) cmds.setAttr(self.parentConst + "." + self.chestB + "W1", nParentValue) cmds.parent(middleCluster, self.clustersGrp, relative=True) # add originedFrom attribute to this middle ctrl: utils.originedFrom(objName=self.middle, attrString=middleLocGuide) # apply volumeVariation to joints in the middle ribbon setup: cmds.connectAttr(rbnBlendColors + ".outputR", rbnJointList[n] + ".scaleX") cmds.connectAttr(rbnBlendColors + ".outputR", rbnJointList[n] + ".scaleZ") # organize groups: self.rbnRigGrp = cmds.group(name=side + self.userGuideName + "_Grp", empty=True) self.rbnControlGrp = cmds.group(name=side + self.userGuideName + "_Control_Grp", empty=True) cmds.parent(self.hipsA + "_Zero", self.rbnControlGrp, relative=True) cmds.parent( self.clustersGrp, side + self.userGuideName + "_Rbn_RibbonJoint_Grp", self.rbnControlGrp, arcLen, self.rbnRigGrp, relative=True, ) if hideJoints: cmds.setAttr(side + self.userGuideName + "_Rbn_RibbonJoint_Grp.visibility", 0) # add hook attributes to be read when rigging integrated modules: utils.addHook(objName=self.rbnControlGrp, hookType="ctrlHook") utils.addHook(objName=self.clustersGrp, hookType="scalableHook") utils.addHook(objName=self.rbnRigGrp, hookType="staticHook") cmds.addAttr(self.rbnRigGrp, longName="dpAR_name", dataType="string") cmds.addAttr(self.rbnRigGrp, longName="dpAR_type", dataType="string") cmds.setAttr(self.rbnRigGrp + ".dpAR_name", self.userGuideName, type="string") cmds.setAttr(self.rbnRigGrp + ".dpAR_type", CLASS_NAME, type="string") # add module type counter value cmds.addAttr(self.rbnRigGrp, longName="dpAR_count", attributeType="long", keyable=False) cmds.setAttr(self.rbnRigGrp + ".dpAR_count", dpAR_count) # lockHide scale of up and down controls: ctrls.setLockHide([self.hipsA, self.hipsB, self.chestA, self.chestB], ["sx", "sy", "sz"]) # delete duplicated group for side (mirror): cmds.delete(side + self.userGuideName + "_" + self.mirrorGrp) # finalize this rig: self.integratingInfo() cmds.select(clear=True) # delete UI (moduleLayout), GUIDE and moduleInstance namespace: self.deleteModule()
def rigModule(self, *args): Base.StartClass.rigModule(self) # verify if the guide exists: if cmds.objExists(self.moduleGrp): try: hideJoints = cmds.checkBox('hideJointsCB', query=True, value=True) except: hideJoints = 1 # start as no having mirror: sideList = [""] # analisys the mirror module: self.mirrorAxis = cmds.getAttr(self.moduleGrp+".mirrorAxis") if self.mirrorAxis != 'off': # get rigs names: self.mirrorNames = cmds.getAttr(self.moduleGrp+".mirrorName") # get first and last letters to use as side initials (prefix): sideList = [ self.mirrorNames[0]+'_', self.mirrorNames[len(self.mirrorNames)-1]+'_' ] for s, side in enumerate(sideList): duplicated = cmds.duplicate(self.moduleGrp, name=side+self.userGuideName+'_Guide_Base')[0] allGuideList = cmds.listRelatives(duplicated, allDescendents=True) for item in allGuideList: cmds.rename(item, side+self.userGuideName+"_"+item) self.mirrorGrp = cmds.group(name="Guide_Base_Grp", empty=True) cmds.parent(side+self.userGuideName+'_Guide_Base', self.mirrorGrp, absolute=True) # re-rename grp: cmds.rename(self.mirrorGrp, side+self.userGuideName+'_'+self.mirrorGrp) # do a group mirror with negative scaling: if s == 1: if cmds.getAttr(self.moduleGrp+".flip") == 0: for axis in self.mirrorAxis: gotValue = cmds.getAttr(side+self.userGuideName+"_Guide_Base.translate"+axis) flipedValue = gotValue*(-2) cmds.setAttr(side+self.userGuideName+'_'+self.mirrorGrp+'.translate'+axis, flipedValue) else: for axis in self.mirrorAxis: cmds.setAttr(side+self.userGuideName+'_'+self.mirrorGrp+'.scale'+axis, -1) else: # if not mirror: duplicated = cmds.duplicate(self.moduleGrp, name=self.userGuideName+'_Guide_Base')[0] allGuideList = cmds.listRelatives(duplicated, allDescendents=True) for item in allGuideList: cmds.rename(item, self.userGuideName+"_"+item) self.mirrorGrp = cmds.group(self.userGuideName+'_Guide_Base', name="Guide_Base_Grp", relative=True) #for Maya2012: self.userGuideName+'_'+self.moduleGrp+"_Grp" # re-rename grp: cmds.rename(self.mirrorGrp, self.userGuideName+'_'+self.mirrorGrp) # store the number of this guide by module type: dpAR_count = utils.findModuleLastNumber(CLASS_NAME, "dpAR_type") + 1 # create a list to export: self.eyeScaleGrpList = [] # create the main control: self.eyeCtrl = cmds.circle(name=self.userGuideName+"_A_Ctrl", radius=(2.25*self.ctrlRadius), normal=(0,0,1), degree=3, constructionHistory=False)[0] cmds.addAttr(self.eyeCtrl, longName=self.langDic[self.langName]['c_Follow'], attributeType='float', keyable=True, minValue=0, maxValue=1) cmds.setAttr(self.eyeCtrl+"."+self.langDic[self.langName]['c_Follow'], 1) cmds.move(0,-1,0, self.eyeCtrl+".cv[1]", relative=True) cmds.move(0,1,0, self.eyeCtrl+".cv[5]", relative=True) cmds.delete(cmds.parentConstraint(sideList[0]+self.userGuideName+"_Guide_JointEnd", self.eyeCtrl, maintainOffset=False)) cmds.setAttr(self.eyeCtrl+".translateX", 0) self.eyeGrp = cmds.group(self.eyeCtrl, name=self.userGuideName+"_A_Grp") utils.zeroOut([self.eyeCtrl]) self.upLocGrp = cmds.group(name=self.userGuideName+"_UpLoc_Grp", empty=True) # run for all sides: for s, side in enumerate(sideList): cmds.select(clear=True) self.base = side+self.userGuideName+'_Guide_Base' # declare guide: self.guide = side+self.userGuideName+"_Guide_JointLoc1" # create a joint: self.jxt = cmds.joint(name=side+self.userGuideName+"_1_Jxt", scaleCompensate=False) self.jnt = cmds.joint(name=side+self.userGuideName+"_1_Jnt", scaleCompensate=False) cmds.addAttr(self.jnt, longName='dpAR_joint', attributeType='float', keyable=False) self.fkEyeCtrl = cmds.circle(name=side+self.userGuideName+"_Fk_Ctrl", radius=self.ctrlRadius, normal=(0,0,1), degree=1, sections=6, constructionHistory=False)[0] utils.originedFrom(objName=self.fkEyeCtrl, attrString=self.base+";"+self.guide) self.baseEyeCtrl = ctrls.cvBox(ctrlName=side+self.userGuideName+"_Base_Ctrl", r=self.ctrlRadius) utils.originedFrom(objName=self.baseEyeCtrl, attrString=self.base+";"+self.guide) # position and orientation of joint and control: cmds.delete(cmds.parentConstraint(self.guide, self.jxt, maintainOffset=False)) cmds.delete(cmds.parentConstraint(self.guide, self.fkEyeCtrl, maintainOffset=False)) cmds.delete(cmds.parentConstraint(self.guide, self.baseEyeCtrl, maintainOffset=False)) cmds.makeIdentity(self.baseEyeCtrl, self.fkEyeCtrl, apply=True) # zeroOut controls: eyeZeroList = utils.zeroOut([self.baseEyeCtrl, self.fkEyeCtrl]) cmds.parent(eyeZeroList[1], self.baseEyeCtrl) # hide visibility attribute: cmds.setAttr(self.fkEyeCtrl+'.visibility', keyable=False) ctrls.setLockHide([self.fkEyeCtrl], ['tx', 'ty', 'tz']) # create end joint: self.cvEndJoint = side+self.userGuideName+"_Guide_JointEnd" self.endJoint = cmds.joint(name=side+self.userGuideName+"_JEnd") cmds.delete(cmds.parentConstraint(self.cvEndJoint, self.endJoint, maintainOffset=False)) cmds.parent(self.endJoint, self.jnt, absolute=True) # create parentConstraint from ctrl to jxt: cmds.parentConstraint(self.fkEyeCtrl, self.jxt, maintainOffset=False, name=self.jnt+"_ParentConstraint") # create scaleConstraint from ctrl to jnt: cmds.scaleConstraint(self.fkEyeCtrl, self.jxt, maintainOffset=True, name=self.jnt+"_ScaleConstraint") # lookAt control: self.lookAtCtrl = cmds.circle(name=side+self.userGuideName+"_LookAt_Ctrl", radius=self.ctrlRadius, normal=(0,0,1), degree=3, constructionHistory=False)[0] cmds.delete(cmds.parentConstraint(self.cvEndJoint, self.lookAtCtrl, maintainOffset=False)) cmds.parent(self.lookAtCtrl, self.eyeCtrl, relative=False) cmds.makeIdentity(self.lookAtCtrl, apply=True) cmds.addAttr(self.lookAtCtrl, longName="active", attributeType="bool", defaultValue=1, keyable=True) # up locator: self.lUpGrpLoc = cmds.group(name=side+self.userGuideName+"_Up_Loc_Grp", empty=True) cmds.delete(cmds.parentConstraint(self.jnt, self.lUpGrpLoc, maintainOffset=False)) self.lUpLoc = cmds.spaceLocator(name=side+self.userGuideName+"_Up_Loc")[0] cmds.delete(cmds.parentConstraint(self.jnt, self.lUpLoc, maintainOffset=False)) cmds.move(cmds.getAttr(self.guideName+"_JointEnd.translateZ"), self.lUpLoc, moveY=True, relative=True) cmds.parent(self.lUpLoc, self.lUpGrpLoc, relative=False) cmds.parent(self.lUpGrpLoc, self.upLocGrp, relative=False) # look at aim constraint: aimConst = cmds.aimConstraint(self.lookAtCtrl, self.fkEyeCtrl+"_Zero", worldUpType="object", worldUpObject=self.upLocGrp+"|"+self.lUpGrpLoc+"|"+self.lUpLoc, maintainOffset=True)[0] cmds.connectAttr(self.lookAtCtrl+".active", aimConst+"."+self.lookAtCtrl+"W0", force=True) # eye aim rotation cmds.addAttr(self.fkEyeCtrl, longName="aimRotation", attributeType="float", keyable=True) cmds.connectAttr(self.fkEyeCtrl+".aimRotation", self.jnt+".rotateZ", force=True) cmds.pointConstraint(self.baseEyeCtrl, self.lUpGrpLoc, maintainOffset=True, name=self.lUpGrpLoc+"_PointConstraint") # create eyeScale setup: cmds.select(clear=True) self.eyeScaleJnt = cmds.joint(name=side+self.userGuideName+"Scale_1_Jnt", scaleCompensate=False) cmds.addAttr(self.eyeScaleJnt, longName='dpAR_joint', attributeType='float', keyable=False) # jointScale position: cmds.delete(cmds.parentConstraint(self.guide, self.eyeScaleJnt, maintainOffset=False)) # create endScale joint: self.endScaleJoint = cmds.joint(name=side+self.userGuideName+"Scale_JEnd") cmds.delete(cmds.parentConstraint(self.eyeScaleJnt, self.endScaleJoint, maintainOffset=False)) cmds.setAttr(self.endScaleJoint+".translateZ", 1) # create constraints to eyeScale: cmds.pointConstraint(self.jnt, self.eyeScaleJnt, maintainOffset=False, name=self.eyeScaleJnt+"_PointConstraint") cmds.scaleConstraint(self.jnt, self.eyeScaleJnt, maintainOffset=True, name=self.eyeScaleJnt+"_ScaleConstraint") self.eyeScaleGrp = cmds.group(self.eyeScaleJnt, name=self.eyeScaleJnt+"_Grp") self.eyeScaleGrpList.append(self.eyeScaleGrp) # create a masterModuleGrp to be checked if this rig exists: self.toCtrlHookGrp = cmds.group(eyeZeroList[0], name=side+self.userGuideName+"_Control_Grp") self.toScalableHookGrp = cmds.group(self.jxt, self.eyeScaleGrp, name=side+self.userGuideName+"_Joint_Grp") self.toStaticHookGrp = cmds.group(self.toCtrlHookGrp, self.toScalableHookGrp, name=side+self.userGuideName+"_Grp") if s == 0: cmds.parent(self.eyeGrp, self.toCtrlHookGrp) cmds.parent(self.upLocGrp, self.toScalableHookGrp) # create a locator in order to avoid delete static group: loc = cmds.spaceLocator(name=side+self.userGuideName+"_DO_NOT_DELETE")[0] cmds.parent(loc, self.toStaticHookGrp, absolute=True) cmds.setAttr(loc+".visibility", 0) ctrls.setLockHide([loc], ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v']) # add hook attributes to be read when rigging integrated modules: utils.addHook(objName=self.toCtrlHookGrp, hookType='ctrlHook') utils.addHook(objName=self.toScalableHookGrp, hookType='scalableHook') utils.addHook(objName=self.toStaticHookGrp, hookType='staticHook') cmds.addAttr(self.toStaticHookGrp, longName="dpAR_name", dataType="string") cmds.addAttr(self.toStaticHookGrp, longName="dpAR_type", dataType="string") cmds.setAttr(self.toStaticHookGrp+".dpAR_name", self.userGuideName, type="string") cmds.setAttr(self.toStaticHookGrp+".dpAR_type", CLASS_NAME, type="string") # add module type counter value cmds.addAttr(self.toStaticHookGrp, longName='dpAR_count', attributeType='long', keyable=False) cmds.setAttr(self.toStaticHookGrp+'.dpAR_count', dpAR_count) if hideJoints: cmds.setAttr(self.toScalableHookGrp+".visibility", 0) # delete duplicated group for side (mirror): cmds.delete(side+self.userGuideName+'_'+self.mirrorGrp) # finalize this rig: self.integratingInfo() cmds.select(clear=True) # delete UI (moduleLayout), GUIDE and moduleInstance namespace: self.deleteModule()