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 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 CreateBipedRig(self): try: CharacterName = self.MetaNameConv.AssetType + "_" + self.MetaNameConv.AssetName + "_rig" except: CharacterName = "MainCharacter" if pm.objExists(CharacterName): MainGroup = CharacterName else: MainGroup = pm.group(empty=True, name=CharacterName) if pm.objExists("mesh_grp"): mesh = pm.ls("mesh_grp")[0] else: mesh = pm.group(empty=True, name="mesh_grp") if pm.objExists("rig_grp"): rig = pm.ls("rig_grp")[0] else: rig = pm.group(empty=True, name="rig_grp") pm.setAttr("%s.visibility" % rig, False) for eachgroup in self.geometryGroups: if not pm.objExists(eachgroup): pm.group(empty=True, name=eachgroup) pm.parent(eachgroup, mesh) deformation = pm.group(empty=True, name="deformation") kinematics = pm.group(empty=True, name="kinematics") joints = pm.group(empty=True, name="joints") controls = pm.group(empty=True, name="controls_grp") self.world = pm.group(empty=True, name="world" + CharacterName) self.moverWorld = pm.group(empty=True, name="moverWorld" + CharacterName) self.Spine = RMSpine.RMSpine() self.LimbArmLeft = RMLimbIKFK.RMLimbIKFK(worldNode=self.world, NameConv=self.NameConv) self.LimbLegRight = RMLimbIKFK.RMLimbIKFK(worldNode=self.world, NameConv=self.NameConv) self.LimbLegLeft = RMLimbIKFK.RMLimbIKFK(worldNode=self.world, NameConv=self.NameConv) self.LimbArmRight = RMLimbIKFK.RMLimbIKFK(worldNode=self.world, NameConv=self.NameConv) self.LFfeet = RMFeet.RMFeetRig() self.RHfeet = RMFeet.RMFeetRig() self.kinematics = kinematics self.deformation = deformation self.joints = joints self.controls = controls pm.parent(self.world, self.kinematics) pm.parent(self.moverWorld, self.kinematics) meshp = pm.listRelatives(mesh, parent=True) if not meshp: pm.parent(mesh, MainGroup) rigp = pm.listRelatives(rig, parent=True) if not rigp: pm.parent(rig, MainGroup) pm.parent(controls, MainGroup) pm.parent(deformation, rig) pm.parent(kinematics, rig) pm.parent(joints, rig) #Creacion del spine spineJoints = [ "C_Spine01_rig_pnt", "C_Spine02_rig_pnt", "C_Spine03_rig_pnt", "C_Spine04_rig_pnt", "C_Spine05_rig_pnt" ] hip = ["C_Spine01_rig_pnt", "C_Hip01_rig_pnt"] clavLF = ["L_clavicle01_rig_pnt", "L_shoulder01_rig_pnt"] clavRH = ["R_clavicle01_rig_pnt", "R_shoulder01_rig_pnt"] self.Spine.RMCreateSpineRig(spineJoints, hip, clavLF, clavRH) spineKinematics = pm.group(empty=True, name="spineKinematics") self.NameConv.rename_name_in_format(spineKinematics, system="kinematics") spineControls = pm.group(empty=True, name="spineControls") self.NameConv.rename_name_in_format(spineControls, system="controls") spineJoints = pm.group(empty=True, name="spineJoints") self.NameConv.rename_name_in_format(spineJoints, system="joints") pm.parent(spineKinematics, kinematics) pm.parent(spineControls, controls) pm.parent(spineJoints, deformation) pm.parent(self.Spine.ResetCOG, spineControls) pm.parent(self.Spine.kinematics, spineKinematics) pm.parent(self.Spine.rootSpineJoints, spineJoints) mover01Reset, self.Mover01 = RMRigShapeControls.RMCircularControl( self.world, axis="Y", radius=self.Spine.SpineLength * 1.5, name="mover02") mover02Reset, self.Mover02 = RMRigShapeControls.RMCircularControl( self.world, axis="Y", radius=self.Spine.SpineLength * 2, name="mover01") placerReset, self.placer = RMRigShapeControls.RMCircularControl( self.world, axis="Y", radius=self.Spine.SpineLength * 2.5, name="mainPlacer") self.mainMover = self.Mover01 pm.parent(placerReset, controls) pm.parent(mover02Reset, self.placer) pm.parent(mover01Reset, self.Mover02) pm.parent(spineControls, self.Mover01) pm.parentConstraint(self.Mover01, self.moverWorld) ''' WorldRClavicle = pm.group(empty = True, name = "clavicleWorld" ) WorldRClavicle = self.NameConv.RMRenameBasedOnBaseName (self.Spine.rightClavicleControl, WorldRClavicle, NewName = "world", System = "RClavicleSpaceSwitch") RMRigTools.RMAlign(self.Spine.rightClavicleControl, WorldRClavicle ,3) pm.parent( WorldRClavicle, self.moverWorld) RSpaceSwitchGroup = RMRigTools.RMCreateGroupOnObj(self.Spine.rightClavicleControl) self.SPSW.CreateSpaceSwitch(RSpaceSwitchGroup,[self.Spine.resetRightClavicleControl, WorldRClavicle],self.Spine.rightClavicleControl, constraintType = "orient") WorldLClavicle = pm.group(empty = True, name = "clavicleWorld" ) WorldLClavicle = self.NameConv.RMRenameBasedOnBaseName (self.Spine.leftClavicleControl, WorldLClavicle, NewName = "world", System = "LClavicleSpaceSwitch") RMRigTools.RMAlign(self.Spine.leftClavicleControl, WorldLClavicle ,3) pm.parent( WorldLClavicle, self.moverWorld) LSpaceSwitchGroup = RMRigTools.RMCreateGroupOnObj(self.Spine.leftClavicleControl) self.SPSW.CreateSpaceSwitch(LSpaceSwitchGroup,[self.Spine.resetLeftClavicleControl, WorldLClavicle],self.Spine.leftClavicleControl, constraintType = "orient") ''' #Creacion de la cabeza neck = ["C_neck01_rig_pnt", "C_head01_rig_pnt"] Head = ["C_head01_rig_pnt", "C_headTip01_rig_pnt"] Jaw = ["C_jaw01_rig_pnt", "C_jawTip01_rig_pnt"] self.NeckHead.RMCreateHeadAndNeckRig(Head, neck, Jaw) pm.parent(self.NeckHead.RootNeckJoints, self.Spine.chestJoint) pm.parent(self.NeckHead.resetNeckControl, self.Spine.ChestRotationControl) WorldHead = pm.group(empty=True, name="worldHead") self.NameConv.rename_based_on_base_name(self.NeckHead.headControl, WorldHead, name="world", system="HeadSpaceSwitch") RMRigTools.RMAlign(self.NeckHead.resetHeadControl, WorldHead, 3) pm.parent(WorldHead, self.world) HeadResetPoint = pm.group(empty=True, name="NeckOrientConstraint") self.NameConv.rename_based_on_base_name(self.NeckHead.headControl, HeadResetPoint, name="Neck", system="HeadSpaceSwitch") RMRigTools.RMAlign(self.NeckHead.resetHeadControl, HeadResetPoint, 3) pm.parent(HeadResetPoint, self.NeckHead.NeckJoints[1]) self.SPSW.CreateSpaceSwitch(self.NeckHead.resetHeadControl, [HeadResetPoint, WorldHead], self.NeckHead.headControl, constraintType="orient", mo=True) #Creacion de Brazos #BrazoDerecho self.LimbArmRight.RMLimbRig("R_shoulder01_rig_pnt", FKAxisFree='010') RHArmDic = self.OrganizeLimb(self.LimbArmRight, "RH", "Arm", self.Spine.RightClavicleJoints[1], self.Spine.chestJoint) RHWorldFKArm = pm.group(empty=True, name="ArmWorld") self.NameConv.rename_based_on_base_name( self.LimbArmRight.FKparentGroup, RHWorldFKArm, name="world", system="RFKArmSpaceSwitch") RMRigTools.RMAlign(self.LimbArmRight.FKparentGroup, RHWorldFKArm, 3) pm.parent(RHWorldFKArm, self.moverWorld) RSpaceSwitchGroup = self.rig_tools.RMCreateGroupOnObj( self.LimbArmRight.FKparentGroup) self.SPSW.CreateSpaceSwitchReverse( self.LimbArmRight.FKparentGroup, [RSpaceSwitchGroup, RHWorldFKArm], self.LimbArmRight.FKFirstLimbControl, sswtype="float", Name="", mo=False, constraintType="orient") #BrazoIzquierdo self.LimbArmLeft.RMLimbRig("L_shoulder01_rig_pnt", FKAxisFree='010') RHArmDic = self.OrganizeLimb(self.LimbArmLeft, "LF", "Arm", self.Spine.LeftClavicleJoints[1], self.Spine.chestJoint) LFWorldFKArm = pm.group(empty=True, name="ArmWorld") self.NameConv.rename_based_on_base_name(self.LimbArmLeft.FKparentGroup, LFWorldFKArm, name="world", system="LFKArmSpaceSwitch") RMRigTools.RMAlign(self.LimbArmLeft.FKparentGroup, LFWorldFKArm, 3) pm.parent(LFWorldFKArm, self.moverWorld) LSpaceSwitchGroup = self.rig_tools.RMCreateGroupOnObj( self.LimbArmLeft.FKparentGroup) self.SPSW.CreateSpaceSwitchReverse(self.LimbArmLeft.FKparentGroup, [LSpaceSwitchGroup, LFWorldFKArm], self.LimbArmLeft.FKFirstLimbControl, sswtype="float", Name="", mo=False, constraintType="orient") #ManoDerecha self.GHRightRig = RMGenericHandRig.RMGenericHandRig() self.GHRightRig.CreateHandRig("R_palm01_rig_pnt", self.LimbArmRight.SpaceSwitchControl) #pm.group(name = "R_palmMover_grp_rig") RMRigTools.RMAlign("R_palm01_rig_pnt", self.LimbArmRight.IKControlResetPoint, 3) RMRigTools.RMAlign("R_palm01_rig_pnt", self.LimbArmRight.ThirdLimbParent, 3) self.LimbArmRight.SPSW.RMCreateListConstraintSwitch( [self.GHRightRig.MainKinematics], [self.LimbArmRight.IKjointStructure[2]], self.LimbArmRight.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch") self.LimbArmRight.SPSW.RMCreateListConstraintSwitch( [self.GHRightRig.MainKinematics], [self.LimbArmRight.FKTrirdLimbControl], self.LimbArmRight.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch", reverse=True) self.LimbArmLeft.SPSW.CreateSpaceSwitch( self.LimbArmRight.IKControlResetPoint, [ self.Spine.rightClavicleControl, self.world, self.Spine.COG, self.Spine.hipJoints[0], self.NeckHead.HeadJoints[0], self.moverWorld ], self.LimbArmRight.ikControl) pm.parent(self.GHRightRig.MainKinematics, RHArmDic["kinematics"]) pm.parent( self.GHRightRig.GHS.palmJoint, self.LimbArmRight.TJElbow.TwistJoints[ len(self.LimbArmRight.TJElbow.TwistJoints) - 1]) pm.parent(self.GHRightRig.PalmResetPoint, RHArmDic["controls"]) #ManoIzquierda self.GHLeftRig = RMGenericHandRig.RMGenericHandRig() self.GHLeftRig.CreateHandRig( "L_palm01_rig_pnt", PalmControl=self.LimbArmLeft.SpaceSwitchControl) RMRigTools.RMAlign("L_palm01_rig_pnt", self.LimbArmLeft.IKControlResetPoint, 3) RMRigTools.RMAlign("L_palm01_rig_pnt", self.LimbArmLeft.ThirdLimbParent, 3) self.LimbArmLeft.SPSW.RMCreateListConstraintSwitch( [self.GHLeftRig.MainKinematics], [self.LimbArmLeft.IKjointStructure[2]], self.LimbArmLeft.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch") self.LimbArmLeft.SPSW.RMCreateListConstraintSwitch( [self.GHLeftRig.MainKinematics], [self.LimbArmLeft.FKTrirdLimbControl], self.LimbArmLeft.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch", reverse=True) self.LimbArmLeft.SPSW.CreateSpaceSwitch( self.LimbArmLeft.IKControlResetPoint, [ self.Spine.leftClavicleControl, self.world, self.Spine.COG, self.Spine.hipJoints[0], self.NeckHead.HeadJoints[0], self.moverWorld ], self.LimbArmLeft.ikControl) pm.parent(self.GHLeftRig.MainKinematics, RHArmDic["kinematics"]) pm.parent( self.GHLeftRig.GHS.palmJoint, self.LimbArmLeft.TJElbow.TwistJoints[ len(self.LimbArmLeft.TJElbow.TwistJoints) - 1]) pm.parent(self.GHLeftRig.PalmResetPoint, RHArmDic["controls"]) #Creacion de pierna self.LimbLegRight.RMLimbRig("R_leg01_rig_pnt", FKAxisFree='001') RHLegDic = self.OrganizeLimb(self.LimbLegRight, "RH", "Leg", self.Spine.hipJoints[1], self.Spine.hipJoints[1]) self.LimbLegLeft.RMLimbRig("L_leg01_rig_pnt", FKAxisFree='001') LFLegDic = self.OrganizeLimb(self.LimbLegLeft, "LF", "Leg", self.Spine.hipJoints[1], self.Spine.hipJoints[1]) Locator = pm.spaceLocator(name="referenceLocator") RMRigTools.RMAlign("L_ball01_rig_pnt", Locator, 1) pm.setAttr(Locator + ".rotateX", 90) pm.setAttr(Locator + ".rotateZ", -90) RMRigTools.RMAlign(Locator, self.LimbLegLeft.IKControlResetPoint, 2) RMRigTools.RMAlign(Locator, self.LimbLegLeft.ThirdLimbParent, 2) RMRigTools.RMAlign(Locator, self.LimbLegRight.IKControlResetPoint, 2) RMRigTools.RMAlign(Locator, self.LimbLegRight.ThirdLimbParent, 2) pm.delete(Locator) StandarFeetLFPoints = { "feet": ["L_ankleFeet01_rig_pnt", "L_ball01_rig_pnt", "L_toe01_rig_pnt"], "limitBack": "L_footLimitBack01_rig_pnt", "limitOut": "L_footLimitOuter01_rig_pnt", "limitIn": "L_footLimitInner01_rig_pnt" } self.LFfeet.RigFeetIKFK(StandarFeetLFPoints, self.LimbLegLeft.ikControl, self.LimbLegLeft.FKTrirdLimbControl) self.LimbLegLeft.SPSW.RMCreateListConstraintSwitch( self.LFfeet.StandardFeetJoints, self.LFfeet.StandardFeetIKJoints, self.LimbLegLeft.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch") self.LimbLegLeft.SPSW.RMCreateListConstraintSwitch( self.LFfeet.StandardFeetJoints, self.LFfeet.StandardFeetFKJoints, self.LimbLegLeft.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch", reverse=True) pm.parent( self.LFfeet.rootJoints, self.LimbLegLeft.TJElbow.TwistJoints[ len(self.LimbLegLeft.TJElbow.TwistJoints) - 1]) feetJointsGroup = pm.group(empty=True, name="FeetJoints") self.NameConv.rename_name_in_format(feetJointsGroup, side="LF") pm.parent(self.LFfeet.MainFeetKinematics, feetJointsGroup) pm.parent(self.LFfeet.rootFKJoints, feetJointsGroup) pm.parent(feetJointsGroup, self.joints) pm.pointConstraint(self.LimbLegLeft.ikControl, self.LimbLegLeft.IkHandle, remove=True) pm.parent(self.LimbLegLeft.IkHandle, self.LFfeet.IKAttachPoint) pm.parent(self.LFfeet.rootIKJoints, self.LimbLegLeft.IKjointStructure[2]) StandarFeetRHPoints = { "feet": ["R_ankleFeet01_rig_pnt", "R_ball01_rig_pnt", "R_toe01_rig_pnt"], "limitBack": "R_footLimitBack01_rig_pnt", "limitOut": "R_footLimitOuter01_rig_pnt", "limitIn": "R_footLimitInner01_rig_pnt" } self.RHfeet.RigFeetIKFK(StandarFeetRHPoints, self.LimbLegRight.ikControl, self.LimbLegRight.FKTrirdLimbControl) self.LimbLegRight.SPSW.RMCreateListConstraintSwitch( self.RHfeet.StandardFeetJoints, self.RHfeet.StandardFeetIKJoints, self.LimbLegRight.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch") self.LimbLegRight.SPSW.RMCreateListConstraintSwitch( self.RHfeet.StandardFeetJoints, self.RHfeet.StandardFeetFKJoints, self.LimbLegRight.SpaceSwitchControl, SpaceSwitchName="IKFKSwitch", reverse=True) pm.parent( self.RHfeet.rootJoints, self.LimbLegRight.TJElbow.TwistJoints[ len(self.LimbLegRight.TJElbow.TwistJoints) - 1]) feetJointsGroup = pm.group(empty=True, name="FeetJoints") self.NameConv.rename_name_in_format(feetJointsGroup, side="right") pm.parent(self.RHfeet.MainFeetKinematics, feetJointsGroup) pm.parent(self.RHfeet.rootFKJoints, feetJointsGroup) pm.parent(feetJointsGroup, self.joints) pm.pointConstraint(self.LimbLegRight.ikControl, self.LimbLegRight.IkHandle, remove=True) pm.parent(self.LimbLegRight.IkHandle, self.RHfeet.IKAttachPoint) pm.parent(self.RHfeet.rootIKJoints, self.LimbLegRight.IKjointStructure[2]) #pm.parentConstraint(placer,self.kinematics) self.ColorCode() self.Visibility()
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]])