def LockAndHide(selection): if selection: if (cmds.getAttr("%s.visibility"%selection[0])): for eachObject in selection : RMRigTools.RMLockAndHideAttributes( eachObject, "xxxxxxxxx1" ) cmds.setAttr("%s.visibility"%eachObject,False) RMRigTools.RMLockAndHideAttributes( eachObject, "xxxxxxxxxl" ) else: for eachObject in selection : RMRigTools.RMLockAndHideAttributes( eachObject, "xxxxxxxxx1" ) cmds.setAttr("%s.visibility"%eachObject,True)
def ConstraintVisibility(self, Objects, ControlObject, VisibilitySwitch='visibility', visibilityType="visibility"): Objects = RMRigTools.validate_pymel_nodes(Objects) ControlObject = RMRigTools.validate_pymel_nodes(ControlObject) '''visibilityType valid values are overrideVisibility, lodVisibility or visibility''' if (self.AddEnumParameters(ControlObject, VisibilitySwitch=VisibilitySwitch)): for eachObject in Objects: RMRigTools.RMLockAndHideAttributes(eachObject, "xxxxxxxxxL") RMRigTools.RMLockAndHideAttributes(eachObject, "xxxxxxxxxh") # print ("connecting Visibility %s.%s to %s.%s"%(ControlObject,VisibilitySwitch,eachObject,visibilityType) ) pm.connectAttr("%s.%s" % (ControlObject, VisibilitySwitch), "%s.%s" % (eachObject, visibilityType)) else: print "Not Valid Object"
def StardardFeetFK(self, StandarFeetPointsDic, FeetControl=None): Side = self.NameConv.get_from_name( self.StandardFeetPointsDic["feet"][0], "side") self.rootFKJoints, StandardFeetFKJoints = self.StandardReverseFeetJointStructure( StandarFeetPointsDic) self.NameConv.rename_set_from_name(StandardFeetFKJoints, "FK", "name", mode="add") FootIn = self.StandardFeetPointsDic["limitIn"] FootOut = self.StandardFeetPointsDic["limitOut"] FootBK = self.StandardFeetPointsDic["limitBack"] Length = RMRigTools.RMPointDistance( self.StandardFeetPointsDic["feet"][2], FootBK) if not FeetControl: self.FirstLimbFeetResetControl, FeetControl = RMRigShapeControls.RMCircularControl( StandardFeetFKJoints[0], radius=Length, name="FKFeetControl") self.FeetControl = FeetControl SecondLimbfeetResetControl, SecondLimbFeetControl = RMRigShapeControls.RMCircularControl( StandardFeetFKJoints[1], radius=Length, name="FKTipFeetControl") pm.parentConstraint(FeetControl, StandardFeetFKJoints[0], mo=True) pm.parentConstraint(SecondLimbFeetControl, StandardFeetFKJoints[1], mo=True) pm.parentConstraint(StandardFeetFKJoints[0], SecondLimbfeetResetControl, mo=True) pm.parent(SecondLimbfeetResetControl, FeetControl) RMRigTools.RMLockAndHideAttributes(FeetControl, "000111000h") RMRigTools.RMLockAndHideAttributes(SecondLimbFeetControl, "000111000h") self.StandardFeetFKJoints = StandardFeetFKJoints self.SecondLimbFeetControl = SecondLimbFeetControl self.SecondLimbControlResetPoint = SecondLimbfeetResetControl
def CreateJointChainSquareRig(self, JointChain, UDaxis="Y"): if self.NameConv.is_name_in_format(JointChain[0]): if self.NameConv.get_from_name(JointChain[0], "side") == "LF": sideVariation = 1 else: sideVariation = -1 else: sideVariation = 1 if UDaxis in ["Y", "Z"]: BoxResetPoint, BoxControl = RMRigShapeControls.RMCreateBoxCtrl( JointChain[len(JointChain) - 1], ParentBaseSize=True, Xratio=.5, Yratio=.5, Zratio=.5) self.addChainParameters(BoxControl, len(JointChain) - 1) cmds.makeIdentity(BoxControl, apply=True, r=False, t=True, s=True, n=0) cmds.parentConstraint(JointChain[len(JointChain) - 1], BoxResetPoint) RMRigTools.RMLockAndHideAttributes(BoxControl, "0000000000") if UDaxis == "Y": LRaxis = "Z" elif UDaxis == "Z": LRaxis = "Y" for eachjoint in range(len(JointChain) - 1): RMRigTools.RMConnectWithLimits( BoxControl + ".UD" + str(eachjoint + 1), JointChain[eachjoint] + (".rotate%s" % UDaxis), [[-10, 100], [0, 0], [10, -100]]) RMRigTools.RMConnectWithLimits( BoxControl + ".LR" + str(eachjoint + 1), JointChain[eachjoint] + (".rotate%s" % LRaxis), [[-10, sideVariation * 100], [0, 0], [10, sideVariation * -100]]) RMRigTools.RMConnectWithLimits( BoxControl + ".Twist" + str(eachjoint + 1), JointChain[eachjoint] + ".rotateX", [[-10, sideVariation * 100], [0, 0], [10, sideVariation * -100]]) else: print "Not Valid UD Axis Provided"
def CreateFingerSquareRig(self, Finger): if self.NameConv.get_from_name(Finger[0], "side") == "L": sideVariation = 1 else: sideVariation = -1 BoxResetPoint, BoxControl = RMRigShapeControls.RMCreateBoxCtrl( Finger[len(Finger) - 1], ParentBaseSize=True, Xratio=.5, Yratio=.5, Zratio=.5) self.RMaddFinguerControls(BoxControl) pm.makeIdentity(BoxControl, apply=True, r=False, t=True, s=True, n=0) pm.parentConstraint(Finger[len(Finger) - 1], BoxResetPoint) RMRigTools.RMLockAndHideAttributes(BoxControl, "0000000000") RMRigTools.RMConnectWithLimits("%s.MidUD" % BoxControl, "%s.rotateY" % Finger[0], [[-10, 100], [0, 0], [10, -100]]) RMRigTools.RMConnectWithLimits( "%s.MidLR" % BoxControl, "%s.rotateZ" % Finger[0], [[-10, sideVariation * 120], [0, 0], [10, sideVariation * -127]]) RMRigTools.RMConnectWithLimits( "%s.MidTwist" % BoxControl, "%s.rotateX" % Finger[0], [[-10, sideVariation * 90], [0, 0], [10, sideVariation * -90]]) index = 1 for eachjoint in range(0, len(Finger) - 1): RMRigTools.RMConnectWithLimits("%s.UD%s" % (BoxControl, index), "%s.rotateY" % Finger[eachjoint], [[-10, 100], [0, 0], [10, -100]]) RMRigTools.RMConnectWithLimits("%s.LR%s" % (BoxControl, index), "%s.rotateZ" % Finger[eachjoint], [[-10, sideVariation * 120], [0, 0], [10, sideVariation * -127]]) RMRigTools.RMConnectWithLimits( "%s.Twist%s" % (BoxControl, index), "%s.rotateX" % Finger[eachjoint], [[-10, sideVariation * 90], [0, 0], [10, sideVariation * -90]]) index += 1 self.fingerControlsReset.append(BoxResetPoint) self.fingerContols.append(BoxControl)
def deleteSimpleRig(): constraint = pm.listConnections(type="parentConstraint") if constraint and len(constraint) > 0: parentConst = constraint[0] wAlias = pm.parentConstraint(parentConst, q=True, wal=True) control = pm.parentConstraint(parentConst, q=True, tl=True) joint = pm.listConnections("%s.constraintTranslateX" % (parentConst)) skinList = pm.listConnections(joint, type="skinCluster") if skinList and len(skinList) > 0: skinCluster = skinList[0] geolist = pm.listConnections("%s.outputGeometry" % (skinCluster)) pm.delete(skinCluster) parentsJoint = pm.listRelatives(joint, parent=True) parentsControl = pm.listRelatives(control, parent=True) pm.delete(parentsJoint[0]) pm.delete(parentsControl[0]) for eachObject in geolist: RMRigTools.RMLockAndHideAttributes(geolist, "1111111111") else: print "no skin cluster Identified" else: print "no constraint Node Identified"
def RMCleanUP(self): self.NameConv.rename_set_from_name(self.LeftClavicleJoints[0], "sknjnt", "objectType") self.NameConv.rename_set_from_name(self.RightClavicleJoints[0], "sknjnt", "objectType") self.NameConv.rename_set_from_name(self.spineJoints, "sknjnt", "objectType") self.NameConv.rename_set_from_name(self.hipJoints[0], "sknjnt", "objectType") self.NameConv.rename_set_from_name(self.chestJoint, "sknjnt", "objectType") RMRigTools.RMLockAndHideAttributes(self.hipControl, "000111000h") RMRigTools.RMLockAndHideAttributes(self.ChestRotationControl, "000111000h") RMRigTools.RMLockAndHideAttributes(self.waistControl, "000111000h") RMRigTools.RMLockAndHideAttributes(self.COG, "111111000h") RMRigTools.RMLockAndHideAttributes(self.chestControl, "111111000h") RMRigTools.RMLockAndHideAttributes(self.leftClavicleControl, "111111000h") RMRigTools.RMLockAndHideAttributes(self.rightClavicleControl, "111111000h")
def RMCreateSpineIKSystem(self): self.spineIK, effector, self.spineCurve = pm.ikHandle( startJoint=self.spineJoints[0], endEffector=self.spineJoints[len(self.spineJoints) - 1], createCurve=True, numSpans=len(self.spineJoints), solver="ikSplineSolver", name="spineIK") self.NameConv.rename_based_on_base_name( self.spineJoints[len(self.spineJoints) - 1], self.spineIK) self.NameConv.rename_based_on_base_name( self.spineJoints[len(self.spineJoints) - 1], effector, name="spineIKEffector") self.NameConv.rename_based_on_base_name( self.spineJoints[len(self.spineJoints) - 1], self.spineCurve, name="spineIKCurve") Clusters = RMRigTools.RMCreateClustersOnCurve(self.spineCurve) ClustersGroup = RMRigTools.RMCreateGroupOnObj(Clusters[0]) RMRigTools.RMParentArray(ClustersGroup, Clusters[1:]) self.kinematics.append(ClustersGroup) self.kinematics.append(self.spineIK) #ResetCOG, COG = RMRigShapeControls.create_box_ctrl(self.spineJoints[0],Yratio=3,Zratio=3) ResetCOG, COG = RMRigShapeControls.RMImportMoveControl( self.spineJoints[0], scale=RMRigTools.RMLenghtOfBone(self.spineJoints[0]) * 7) self.NameConv.rename_set_from_name(COG, "COG", "name") ResetChest, Chest = RMRigShapeControls.RMCreateBoxCtrl( self.spineJoints[len(self.spineJoints) - 1], Yratio=3, Zratio=3) self.NameConv.rename_set_from_name(Chest, "Chest", "name") SpineLength = RMRigTools.RMPointDistance(COG, Chest) ResetChestRotation, ChestRotation = RMRigShapeControls.RMCircularControl( Chest, radius=SpineLength, name="ChestRotation") pm.parent(ResetChestRotation, Chest) pm.parentConstraint(ChestRotation, self.chestJoint, mo=True) self.ResetChestRotationControl = ResetChestRotation self.ChestRotationControl = ChestRotation #pm.parent(ResetChest,COG) pm.setAttr(self.spineIK + ".dTwistControlEnable", 1) pm.setAttr(self.spineIK + ".dWorldUpType", 4) #pm.setAttr(self.spineIK + ".dForwardAxis",0)#Valid Option only in Maya 2016 pm.setAttr(self.spineIK + ".dWorldUpAxis", 0) pm.connectAttr(COG + ".worldMatrix[0]", self.spineIK + ".dWorldUpMatrix") pm.connectAttr(Chest + ".worldMatrix[0]", self.spineIK + ".dWorldUpMatrixEnd") locators = RMRigTools.RMCreateNLocatorsBetweenObjects(COG, Chest, 3, align="FirstObj") ChestControls = [] ChestGroups = [] AllSpine = [COG] spineControlGroup = pm.group(empty=True, name="SpineControls") self.NameConv.rename_name_in_format(spineControlGroup, name=spineControlGroup) self.secondaryControls for eachPosition in locators: ControlGroup, NewControl = RMRigShapeControls.RMImportMoveControl( eachPosition, scale=SpineLength) self.secondaryControls.append(NewControl) ChestGroups.append(ControlGroup) ChestControls.append(NewControl) AllSpine.append(NewControl) ResetTransformGroup = RMRigTools.RMCreateGroupOnObj(ControlGroup) print ResetTransformGroup print spineControlGroup pm.parent(ResetTransformGroup, spineControlGroup) pm.delete(eachPosition) RMRigTools.RMLockAndHideAttributes(NewControl, "111000000h") AllSpine.append(Chest) pm.parent(spineControlGroup, COG) ChestChildGroup = RMRigTools.RMCreateGroupOnObj(Chest, Type="child", NameConv=self.NameConv) pm.xform(ChestChildGroup, t=[-SpineLength / 2, 0, 0], os=True, relative=True) spineEnds = [COG, ChestChildGroup] self.RMRedistributeConstraint(AllSpine, Clusters, 3, ConstraintType="parent") self.RMRedistributeConstraint(spineEnds, ChestGroups, 3, ConstraintType="parent") DeformedShape, OrigShape = pm.listRelatives(self.spineCurve, children=True, shapes=True) curveInfoOriginal = pm.shadingNode('curveInfo', asUtility=True, name="SpineCurveOriginalInfo") curveInfoDeformed = pm.shadingNode('curveInfo', asUtility=True, name="SpineCurveDeformedInfo") self.NameConv.rename_name_in_format(curveInfoOriginal, name=curveInfoOriginal) self.NameConv.rename_name_in_format(curveInfoDeformed, name=curveInfoDeformed) pm.connectAttr(OrigShape + ".worldSpace[0]", curveInfoOriginal + ".inputCurve") pm.connectAttr(DeformedShape + ".worldSpace[0]", curveInfoDeformed + ".inputCurve") curveScaleRatio = pm.shadingNode('multiplyDivide', asUtility=True, name="SpineScaleRatio") self.NameConv.rename_name_in_format(curveScaleRatio, name=curveScaleRatio) pm.connectAttr(curveInfoDeformed + ".arcLength", curveScaleRatio + ".input1X") pm.connectAttr(curveInfoOriginal + ".arcLength", curveScaleRatio + ".input2X") pm.setAttr(curveScaleRatio + ".operation", 2) #preparation for Scale multiplication function of each spine joint pm.addAttr(Chest, at="float", sn="ssf", ln="spineSquashFactor", hnv=1, hxv=1, h=0, k=1, smn=-10, smx=10) GaussLen = len(self.spineJoints) center = len(self.spineJoints) / 2 powMaxValue = 5 powRate = powMaxValue / center index = 1 for eachJoint in self.spineJoints[1:]: #translate stretch multiplication functions of each spine joint SpineStretchMult = pm.shadingNode( 'multiplyDivide', asUtility=True, name="SpineTranslateStretchMult" + self.NameConv.get_a_short_name(eachJoint)) self.NameConv.rename_name_in_format(SpineStretchMult, name=SpineStretchMult) CurrentXPosition = pm.getAttr(eachJoint + ".translateX") pm.setAttr(SpineStretchMult + ".input2X", CurrentXPosition) pm.connectAttr(curveScaleRatio + ".outputX", SpineStretchMult + ".input1X") pm.connectAttr(SpineStretchMult + ".outputX", eachJoint + ".translateX") #Scale multiplication function of each spine joint if index >= center: PowValue = (GaussLen - 1 - index) else: PowValue = index SpineStretchRatio = pm.shadingNode( 'multiplyDivide', asUtility=True, name="SpineStretchRatio" + self.NameConv.get_a_short_name(eachJoint)) self.NameConv.rename_name_in_format(SpineStretchRatio, name=SpineStretchRatio) pm.connectAttr(Chest + ".spineSquashFactor ", SpineStretchRatio + ".input1X") pm.setAttr(SpineStretchRatio + ".input2X", PowValue) pm.setAttr(SpineStretchRatio + ".operation", 1) SpineScaleStretchPow = pm.shadingNode( 'multiplyDivide', asUtility=True, name="SpineScaleStretchPow" + self.NameConv.get_a_short_name(eachJoint)) self.NameConv.rename_name_in_format(SpineScaleStretchPow, name=SpineScaleStretchPow) pm.connectAttr(curveScaleRatio + ".outputX ", SpineScaleStretchPow + ".input1X") pm.connectAttr(SpineStretchRatio + ".outputX ", SpineScaleStretchPow + ".input2X") pm.setAttr(SpineScaleStretchPow + ".operation", 3) SpineInversScaleRatio = pm.shadingNode( 'multiplyDivide', asUtility=True, name="SpineInverseScaleRatio") self.NameConv.rename_name_in_format(SpineInversScaleRatio, name=SpineInversScaleRatio) pm.connectAttr(SpineScaleStretchPow + ".outputX ", SpineInversScaleRatio + ".input1X") pm.setAttr(SpineInversScaleRatio + ".input2X", -1) pm.setAttr(SpineInversScaleRatio + ".operation", 3) pm.connectAttr(SpineInversScaleRatio + ".outputX", eachJoint + ".scaleY") pm.connectAttr(SpineInversScaleRatio + ".outputX", eachJoint + ".scaleZ") index += 1 resetWaist, waist = RMRigShapeControls.RMCircularControl( AllSpine[1], radius=SpineLength * .8, name="waist") pm.parent(ResetChest, waist) pm.parent(resetWaist, COG) self.chestControl = Chest self.resetChestControl = ResetChest self.waistControl = waist self.resetWaistControl = resetWaist self.COG = COG self.ResetCOG = ResetCOG self.SpineLength = SpineLength
def Visibility(self): '''self.Spine = None self.LimbArmLeft = None self.LimbLegRight = None self.LimbLegLeft = None self.LimbArmRight = None self.LFfeet = None self.RHfeet = None self.moverMain = None self.Mover01 = None self.Mover02 = None self.placer = None self.NeckHead self.GHRightRig = None self.GHLeftRig = None ''' VisSwitch = RMVisibilitySwitch.RMVisibilitySwitch() Vgroup, VControl = RMRigShapeControls.RMImportMoveControl( self.NeckHead.HeadJoints[0], scale=RMRigTools.RMLenghtOfBone(self.NeckHead.HeadJoints[0]), Type="v") pm.setAttr("%s.rotateX" % Vgroup, 0) pm.setAttr("%s.rotateY" % Vgroup, 0) pm.setAttr("%s.rotateZ" % Vgroup, 0) RMRigTools.RMAlign(self.NeckHead.HeadJoints[1], Vgroup, 1) pm.parentConstraint(self.Mover01, Vgroup, mo=True) pm.parent(Vgroup, "controls_grp") VisSwitch.ConstraintVisibility([ self.LimbArmLeft.PoleVectorControl, self.LimbArmLeft.ikControl, self.LimbArmLeft.FKFirstLimbControl, self.LimbArmLeft.FKSecondLimbControl, self.LimbArmLeft.FKTrirdLimbControl, self.LimbArmLeft.SpaceSwitchControl, self.LimbArmRight.PoleVectorControl, self.LimbArmRight.ikControl, self.LimbArmRight.FKFirstLimbControl, self.LimbArmRight.FKSecondLimbControl, self.LimbArmRight.FKTrirdLimbControl, self.LimbArmRight.SpaceSwitchControl, self.LimbLegLeft.PoleVectorControl, self.LimbLegLeft.ikControl, self.LimbLegLeft.FKFirstLimbControl, self.LimbLegLeft.FKSecondLimbControl, self.LimbLegLeft.FKTrirdLimbControl, self.LimbLegLeft.SpaceSwitchControl, self.LimbLegRight.PoleVectorControl, self.LimbLegRight.ikControl, self.LimbLegRight.FKFirstLimbControl, self.LimbLegRight.FKSecondLimbControl, self.LimbLegRight.FKTrirdLimbControl, self.LimbLegRight.SpaceSwitchControl, self.Spine.rightClavicleControl, self.Spine.leftClavicleControl, self.Spine.waistControl, self.Spine.chestControl, self.Spine.hipControl, self.Spine.COG, self.LFfeet.SecondLimbFeetControl, self.RHfeet.SecondLimbFeetControl, self.GHRightRig.MainControl, self.GHLeftRig.MainControl ], VControl, VisibilitySwitch="Controls", visibilityType="lodVisibility") #print self.LFfeet.feetMainMoveIK #print self.RHfeet.feetMainMoveIK VisSwitch.ConstraintVisibility([ self.LimbArmLeft.TJArm.TwistControl, self.LimbArmLeft.TJElbow.TwistControl, self.LimbArmRight.TJArm.TwistControl, self.LimbArmRight.TJElbow.TwistControl, self.LimbLegLeft.TJArm.TwistControl, self.LimbLegLeft.TJElbow.TwistControl, self.LimbLegRight.TJArm.TwistControl, self.LimbLegRight.TJElbow.TwistControl ], VControl, VisibilitySwitch="Secondary", visibilityType="lodVisibility") VisSwitch.ConstraintVisibility(["body_grp"], VControl, VisibilitySwitch="Geometry") VisSwitch.AddAffectedObject(VControl, self.Spine.secondaryControls, VisibilitySwitch="Secondary", visibilityType="lodVisibility") VisSwitch.AddAffectedObject(VControl, self.GHRightRig.fingerControlsReset, VisibilitySwitch="Controls", visibilityType="lodVisibility") VisSwitch.AddAffectedObject(VControl, self.GHLeftRig.fingerControlsReset, VisibilitySwitch="Controls", visibilityType="lodVisibility") RMRigTools.RMLockAndHideAttributes(VControl, "0000000000") #VisSwitch.AddEnumParameters( VControl, VisibilitySwitch = "Facial" ) pass
def CreatePalmRig(self, PalmControl=None): if self.NameConv.get_from_name(self.GHS.palmJoint, "side") == "L": sideVariation = -1 else: sideVariation = 1 self.CreatePalmReferencePoints() if PalmControl == None: palmResetPoint, PalmControl = RMRigShapeControls.RMCircularControl( self.GHS.palmJoint) else: palmResetPoint = pm.group(empty=True, name="palmControl") self.NameConv.rename_based_on_base_name(self.GHS.palmJoint, palmResetPoint, name=palmResetPoint) RMRigTools.RMAlign(self.GHS.palmJoint, palmResetPoint, 3) self.PalmControl = PalmControl self.PalmResetPoint = palmResetPoint self.MainControl = palmResetPoint # palmResetPoint = self.NameConv.RMRenameSetFromName(palmResetPoint,"palmControls","Name") self.RMaddPalmControls(self.PalmControl) RMRigTools.RMLockAndHideAttributes(self.PalmControl, "0000000000") pinky = self.GHS.fingerJointsByName("pinky") if pinky: self.PalmFingerControlGrp[ "pinky"] = self.name_conv.RMCreateGroupOnObj(pinky[0]) RMRigTools.RMChangeRotateOrder(pinky, "yxz") RMRigTools.RMConnectWithLimits( "%s.Spread" % self.PalmControl, '%s.rotateZ' % self.PalmFingerControlGrp["pinky"], [[-10, sideVariation * 10], [0, 0], [10, sideVariation * -60]]) ring = self.GHS.fingerJointsByName("ring") if ring: self.PalmFingerControlGrp[ "ring"] = self.name_conv.RMCreateGroupOnObj(ring[0]) RMRigTools.RMChangeRotateOrder(ring, "yxz") RMRigTools.RMConnectWithLimits( "%s.Spread" % self.PalmControl, '%s.rotateZ' % self.PalmFingerControlGrp["ring"], [[-10, sideVariation * 5], [0, 0], [10, sideVariation * -30]]) middle = self.GHS.fingerJointsByName("middle") if middle: self.PalmFingerControlGrp[ "middle"] = self.name_conv.RMCreateGroupOnObj(middle[0]) RMRigTools.RMChangeRotateOrder(middle, "yxz") RMRigTools.RMConnectWithLimits( "%s.Spread" % self.PalmControl, '%s.rotateZ' % self.PalmFingerControlGrp["middle"], [[-10, 0], [0, 0], [10, sideVariation * -5]]) index = self.GHS.fingerJointsByName("index") if index: self.PalmFingerControlGrp[ "index"] = self.name_conv.RMCreateGroupOnObj(index[0]) RMRigTools.RMChangeRotateOrder(index, "yxz") RMRigTools.RMConnectWithLimits( "%s.Spread" % self.PalmControl, '%s.rotateZ' % self.PalmFingerControlGrp["index"], [[-10, sideVariation * -5], [0, 0], [10, sideVariation * 30]]) thumb = self.GHS.fingerJointsByName("thumb") if thumb: self.PalmFingerControlGrp[ "thumb"] = self.name_conv.RMCreateGroupOnObj(thumb[0]) RMRigTools.RMChangeRotateOrder(thumb, "yxz") RMRigTools.RMConnectWithLimits( "%s.Spread" % self.PalmControl, '%s.rotateZ' % self.PalmFingerControlGrp["thumb"], [[-10, sideVariation * -10], [0, 0], [10, sideVariation * 60]]) for eachFingerName in self.fingerRoot: if eachFingerName != 'thumb': RMRigTools.RMConnectWithLimits( "%s.PalmBend" % self.PalmControl, '%s.rotateY' % self.PalmFingerControlGrp[eachFingerName], [[-10, 90], [0, 0], [10, -90]]) RMRigTools.RMConnectWithLimits( "%s.Twist" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints[eachFingerName], [[-10, sideVariation * 45], [0, 0], [10, sideVariation * -45]]) RMRigTools.RMConnectWithLimits( "%s.PalmCup" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints["pinky"], [[0, 0], [10, sideVariation * 50]]) RMRigTools.RMConnectWithLimits( "%s.PalmCup" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints["ring"], [[0, 0], [10, sideVariation * 25]]) RMRigTools.RMConnectWithLimits( "%s.PalmCup" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints["middle"], [[0, 0], [10, sideVariation * 5]]) RMRigTools.RMConnectWithLimits( "%s.PalmCup" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints["index"], [[0, 0], [10, sideVariation * -30]]) RMRigTools.RMConnectWithLimits( "%s.PalmCup" % self.PalmControl, '%s.rotateX' % self.PalmReferencePoints["thumb"], [[0, 0], [10, sideVariation * -60]])
def supportScaleOnRig(): cmds.scaleConstraint("worldMainCharacter", "Character01_LF_curveLineBetweenPnts00_shp_Rig") cmds.scaleConstraint("worldMainCharacter", "Character01_LF_curveLineBetweenPnts01_shp_Rig") cmds.scaleConstraint("worldMainCharacter", "Character01_RH_curveLineBetweenPnts00_shp_Rig") cmds.scaleConstraint("worldMainCharacter", "Character01_RH_curveLineBetweenPnts01_shp_Rig") cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_RH_palm00_grp_Rig") cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_LF_palm00_grp_Rig") cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "joints") cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "deformation") # Avoid Spine Scale cmds.parent("Character01_MD_spineIKCurve00_shp_Rig", "kinematics") # ikFixing cmds.connectAttr("Character01_MD_StretchyIkHandleStartPoint00_loc_Rig.translate", "Character01_RH_IKBaseDistanceNodewrist00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleEndPoint00_loc_Rig.translate", "Character01_RH_IKBaseDistanceNodewrist00_dbtw_Rig.point2", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleStartPoint01_loc_Rig.translate", "Character01_LF_IKBaseDistanceNodewrist00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleEndPoint01_loc_Rig.translate", "Character01_LF_IKBaseDistanceNodewrist00_dbtw_Rig.point2", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleStartPoint03_loc_Rig.translate", "Character01_LF_IKBaseDistanceNodeankle00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleEndPoint03_loc_Rig.translate", "Character01_LF_IKBaseDistanceNodeankle00_dbtw_Rig.point2", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleStartPoint02_loc_Rig.translate", "Character01_RH_IKBaseDistanceNodeankle00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_StretchyIkHandleEndPoint02_loc_Rig.translate", "Character01_RH_IKBaseDistanceNodeankle00_dbtw_Rig.point2", force=True) # TwistJointFixing cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_RH_StretchyRefPointsShoulder00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistShoulder00_loc_Rig.translate", "Character01_RH_DistanceNode00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistShoulder00_loc_Rig.translate", "Character01_RH_DistanceNode00_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_RH_StretchyRefPointsElbow00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistElbow00_loc_Rig.translate", "Character01_RH_DistanceNode01_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistElbow00_loc_Rig.translate", "Character01_RH_DistanceNode01_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_LF_StretchyRefPointsShoulder00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistShoulder01_loc_Rig.translate", "Character01_LF_DistanceNode00_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistShoulder01_loc_Rig.translate", "Character01_LF_DistanceNode00_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_LF_StretchyRefPointsElbow00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistElbow01_loc_Rig.translate", "Character01_LF_DistanceNode01_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistElbow01_loc_Rig.translate", "Character01_LF_DistanceNode01_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_RH_StretchyRefPointsLeg00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistLeg00_loc_Rig.translate", "Character01_RH_DistanceNode02_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistLeg00_loc_Rig.translate", "Character01_RH_DistanceNode02_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_RH_StretchyRefPointsKnee00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistKnee00_loc_Rig.translate", "Character01_RH_DistanceNode03_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistKnee00_loc_Rig.translate", "Character01_RH_DistanceNode03_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_LF_StretchyRefPointsLeg00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistLeg01_loc_Rig.translate", "Character01_LF_DistanceNode02_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistLeg01_loc_Rig.translate", "Character01_LF_DistanceNode02_dbtw_Rig.point2", force=True) cmds.scaleConstraint("Character_MD_mainPlacer00_ctr_Rig", "Character01_LF_StretchyRefPointsKnee00_grp_Rig") cmds.connectAttr("Character01_MD_startTwistKnee01_loc_Rig.translate", "Character01_LF_DistanceNode03_dbtw_Rig.point1", force=True) cmds.connectAttr("Character01_MD_endTwistKnee01_loc_Rig.translate", "Character01_LF_DistanceNode03_dbtw_Rig.point2", force=True) cmds.addAttr("Character_MD_mainPlacer00_ctr_Rig", at="float", ln="GlobalScale", h=0, k=1) cmds.setAttr("Character_MD_mainPlacer00_ctr_Rig.GlobalScale", 1) RMRigTools.RMLockAndHideAttributes("Character_MD_mainPlacer00_ctr_Rig", "xxxxxxhhhx") cmds.connectAttr("Character_MD_mainPlacer00_ctr_Rig.GlobalScale", "Character_MD_mainPlacer00_ctr_Rig.scaleX") cmds.connectAttr("Character_MD_mainPlacer00_ctr_Rig.GlobalScale", "Character_MD_mainPlacer00_ctr_Rig.scaleY") cmds.connectAttr("Character_MD_mainPlacer00_ctr_Rig.GlobalScale", "Character_MD_mainPlacer00_ctr_Rig.scaleZ") cmds.shadingNode("multiplyDivide", asUtility=True, name="Character_MD_SpineGlobalScale00_mult_Rig") cmds.connectAttr("Character_MD_SpineCurveOriginalInfo00_cui_Rig.arcLength", "Character_MD_SpineGlobalScale00_mult_Rig.input1X") cmds.connectAttr("Character_MD_mainPlacer00_ctr_Rig.GlobalScale", "Character_MD_SpineGlobalScale00_mult_Rig.input2X") cmds.connectAttr("Character_MD_SpineGlobalScale00_mult_Rig.outputX", "Character_MD_SpineScaleRatio00_mult_Rig.input2X", force=True)
def supportScaleOnRig(): cmds.scaleConstraint("worldMainCharacter", "L_curveLineBetweenPnts00_Limbik_shp") cmds.scaleConstraint("worldMainCharacter", "L_curveLineBetweenPnts01_Limbik_shp") cmds.scaleConstraint("worldMainCharacter", "R_curveLineBetweenPnts00_Limbik_shp") cmds.scaleConstraint("worldMainCharacter", "R_curveLineBetweenPnts01_Limbik_shp") cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "R_palm00_Rig_grp") cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "L_palm00_Rig_grp") cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "joints") cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "deformation") # Avoid Spine Scale cmds.parent("C_spineIKCurve00_Rig_shp", "kinematics") # ikFixing cmds.connectAttr("C_Object00_Rig_pnt.translate", "R_IKBaseDistanceNodewrist00_Limbik_dbtw.point1", force=True) cmds.connectAttr("C_Object01_Rig_pnt.translate", "R_IKBaseDistanceNodewrist00_Limbik_dbtw.point2", force=True) cmds.connectAttr("C_Object06_Rig_pnt.translate", "L_IKBaseDistanceNodewrist00_Limbik_dbtw.point1", force=True) cmds.connectAttr("C_Object07_Rig_pnt.translate", "L_IKBaseDistanceNodewrist00_Limbik_dbtw.point2", force=True) cmds.connectAttr("C_Object18_Rig_pnt.translate", "L_IKBaseDistanceNodeankle00_Limbik_dbtw.point1", force=True) cmds.connectAttr("C_Object19_Rig_pnt.translate", "L_IKBaseDistanceNodeankle00_Limbik_dbtw.point2", force=True) cmds.connectAttr("C_Object12_Rig_pnt.translate", "R_IKBaseDistanceNodeankle00_Limbik_dbtw.point1", force=True) cmds.connectAttr("C_Object13_Rig_pnt.translate", "R_IKBaseDistanceNodeankle00_Limbik_dbtw.point2", force=True) # TwistJointFixing cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "R_StretchyRefPointsShoulder00_Limbskn_grp") cmds.connectAttr("C_Object02_Rig_pnt.translate", "R_DistanceNode00_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object03_Rig_pnt.translate", "R_DistanceNode00_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "R_StretchyRefPointsElbow00_Limbskn_grp") cmds.connectAttr("C_Object04_Rig_pnt.translate", "R_DistanceNode01_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object05_Rig_pnt.translate", "R_DistanceNode01_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "L_StretchyRefPointsShoulder00_Limbskn_grp") cmds.connectAttr("C_Object08_Rig_pnt.translate", "L_DistanceNode00_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object09_Rig_pnt.translate", "L_DistanceNode00_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "L_StretchyRefPointsElbow00_Limbskn_grp") cmds.connectAttr("C_Object10_Rig_pnt.translate", "L_DistanceNode01_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object08_Rig_pnt.translate", "L_DistanceNode01_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "R_StretchyRefPointsLeg00_Limbskn_grp") cmds.connectAttr("C_Object14_Rig_pnt.translate", "R_DistanceNode02_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object15_Rig_pnt.translate", "R_DistanceNode02_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "R_StretchyRefPointsKnee00_Limbskn_grp") cmds.connectAttr("C_Object16_Rig_pnt.translate", "R_DistanceNode03_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object17_Rig_pnt.translate", "R_DistanceNode03_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "L_StretchyRefPointsLeg00_Limbskn_grp") cmds.connectAttr("C_Object20_Rig_pnt.translate", "L_DistanceNode02_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object21_Rig_pnt.translate", "L_DistanceNode02_Limbskn_dbtw.point2", force=True) cmds.scaleConstraint("C_mainPlacer00_Rig_ctr", "L_StretchyRefPointsKnee00_Limbskn_grp") cmds.connectAttr("C_Object22_Rig_pnt.translate", "L_DistanceNode03_Limbskn_dbtw.point1", force=True) cmds.connectAttr("C_Object23_Rig_pnt.translate", "L_DistanceNode03_Limbskn_dbtw.point2", force=True) cmds.addAttr("C_mainPlacer00_Rig_ctr", at="float", ln="GlobalScale", h=0, k=1) cmds.setAttr("C_mainPlacer00_Rig_ctr.GlobalScale", 1) RMRigTools.RMLockAndHideAttributes("C_mainPlacer00_Rig_ctr", "xxxxxxhhhx") cmds.connectAttr("C_mainPlacer00_Rig_ctr.GlobalScale", "C_mainPlacer00_Rig_ctr.scaleX") cmds.connectAttr("C_mainPlacer00_Rig_ctr.GlobalScale", "C_mainPlacer00_Rig_ctr.scaleY") cmds.connectAttr("C_mainPlacer00_Rig_ctr.GlobalScale", "C_mainPlacer00_Rig_ctr.scaleZ") cmds.shadingNode("multiplyDivide", asUtility=True, name="C_SpineGlobalScale00_Rig_mult") cmds.connectAttr("C_SpineCurveOriginalInfo00_Rig_cui.arcLength", "C_SpineGlobalScale00_Rig_mult.input1X") cmds.connectAttr("C_mainPlacer00_Rig_ctr.GlobalScale", "C_SpineGlobalScale00_Rig_mult.input2X") cmds.connectAttr("C_SpineGlobalScale00_Rig_mult.outputX", "C_SpineScaleRatio00_Rig_mult.input2X", force=True)