def bdAddEyeAttr(eyeCtrl): bdRigUtils.bdAddSeparatorAttr(eyeCtrl, '______') eyeAttr = ['BlinkUpper', 'BlinkLower'] bdRigUtils.bdAddAttributeMinMax(eyeCtrl, eyeAttr, 'double', -10, 10, 0) eyeAttr = ['BlinkLine'] bdRigUtils.bdAddAttributeMinMax(eyeCtrl, eyeAttr, 'double', -50, 50, 0)
def bdAddEyeAttr(eyeCtrl): bdRigUtils.bdAddSeparatorAttr(eyeCtrl,'______') eyeAttr = ['BlinkUpper','BlinkLower'] bdRigUtils.bdAddAttributeMinMax(eyeCtrl,eyeAttr,'double',-10,10,0) eyeAttr = ['BlinkLine'] bdRigUtils.bdAddAttributeMinMax(eyeCtrl,eyeAttr,'double',-50,50,0)
def bdRigEye(side): #create IK handles for the bind joints, for now getting the joints based on the name bindJoints = cmds.ls(side + "*Lid_jnt_*") eyeJoint = cmds.ls( "anim*" + side + "*eye")[0] eyeAnim = cmds.ls(side + '_eye_ctrl') cmds.aimConstraint(eyeAnim[0],eyeJoint,offset = [0, 0, 0] ,weight=1 , aimVector =[1 ,0 ,0] ,upVector=[0, 1, 0] ,worldUpType="vector" ,worldUpVector= [0,1,0]) blinkUpJnt = cmds.duplicate(eyeJoint,name = side + '_eye_upLid_blink_jnt',po=True) blinkLowJnt = cmds.duplicate(eyeJoint,name = side + '_eye_lowLid_blink_jnt',po=True) baseLidsJnt = cmds.ls(side + '*lids*base') cmds.parent([blinkUpJnt[0],blinkLowJnt[0]],baseLidsJnt[0]) for joint in bindJoints: print joint endJoint = cmds.listRelatives(joint,c=True,type='joint') ikName = endJoint[0].replace('bnd_jnt','ikHandle') ctrlName = endJoint[0].replace('bnd_jnt','anim') bdRigUtils.bdAddIk(joint,endJoint[0],'ikSCsolver',ikName) bdRigUtils.bdBuildBoxController(endJoint[0],ctrlName,0.2) bdRigUtils.bdAddAttributeMinMax(ctrlName,['BlinkPosition'],'double',-5,5,1) cmds.parent(ikName,ctrlName) bdBuildJointStructure(joint,ctrlName,ikName) allAnimsGrps = cmds.ls(side + '*eye*CON_??',type='transform') globalAnimGrp = cmds.ls('controllers') cmds.parent(allAnimsGrps,globalAnimGrp[0]) bdAddEyeAttr(eyeAnim[0]) bdCreateVerticalFollow(side) bdCreateSideFollow(side) bdCreateBlink(side)
def bdRigEye(side): #create IK handles for the bind joints, for now getting the joints based on the name bindJoints = cmds.ls(side + "*Lid_jnt_*") eyeJoint = cmds.ls(side + "*eye*jnt")[0] eyeAnim = cmds.ls(side + '_eye_anim') cmds.aimConstraint(eyeAnim[0],eyeJoint,offset = [0, 0, 0] ,weight=1 , aimVector =[1 ,0 ,0] ,upVector=[0, 1, 0] ,worldUpType="vector" ,worldUpVector= [0,1,0]) blinkUpJnt = cmds.duplicate(eyeJoint,name = side + '_eye_upLid_blink_jnt',po=True) blinkLowJnt = cmds.duplicate(eyeJoint,name = side + '_eye_lowLid_blink_jnt',po=True) baseLidsJnt = cmds.ls(side + '*lids*base') cmds.parent([blinkUpJnt[0],blinkLowJnt[0]],baseLidsJnt[0]) for joint in bindJoints: print joint endJoint = cmds.listRelatives(joint,c=True,type='joint') ikName = endJoint[0].replace('bnd_jnt','ikHandle') ctrlName = endJoint[0].replace('bnd_jnt','anim') bdRigUtils.bdAddIk(joint,endJoint[0],'ikSCsolver',ikName) bdRigUtils.bdBuildBoxController(endJoint[0],ctrlName,0.2) bdRigUtils.bdAddAttributeMinMax(ctrlName,['BlinkPosition'],'double',-5,5,1) cmds.parent(ikName,ctrlName) bdBuildJointStructure(joint,ctrlName,ikName) allAnimsGrps = cmds.ls(side + '*eye*CON_??',type='transform') globalAnimGrp = cmds.ls('controllers') cmds.parent(allAnimsGrps,globalAnimGrp[0]) bdAddEyeAttr(eyeAnim[0]) bdCreateVerticalFollow(side) bdCreateSideFollow(side) bdCreateBlink(side)
def bdRigEye(self): #create IK handles for the bind joints, for now getting the joints based on the name parts = [] if self.templateSide == 'both': parts = ['left','right'] else: parts = [self.templateSide] for side in parts: eyeLidsJnt = pm.ls(side + '*eyelid_*_01_jnt') eyeJoint = pm.ls(side + "*eye*jnt")[0] eyeCorners = pm.ls(side + "*eye*corner*01_jnt") eyeAnim = pm.ls(side + '_eye_anim') pm.select(cl=True) eyeAnimGrp = pm.group(n=side + '_eyelids_anim_GRP') pm.select(cl=True) pm.aimConstraint(eyeAnim[0],eyeJoint,offset = [0, 0, 0] ,weight=1 , aimVector =[0 ,0 ,1] ,upVector=[0, 1, 0] ,worldUpType="vector" ,worldUpVector= [0,1,0]) blinkUpJnt = pm.duplicate(eyeJoint,name = side + '_eyelid_upper_blink_jnt',po=True) blinkLowJnt = pm.duplicate(eyeJoint,name = side + '_eyelid_lower_blink_jnt',po=True) baseLidsJnt = pm.ls(side + '*lids*base') pm.parent([blinkUpJnt[0],blinkLowJnt[0]],baseLidsJnt[0]) for joint in (eyeLidsJnt + eyeCorners): endJoint = pm.listRelatives(joint,c=True,type='joint') ikName = endJoint[0].name().replace('02_bnd_jnt','ikHandle') ctrlName = endJoint[0].name().replace('02_bnd_jnt','anim') bdRigUtils.bdAddIk(joint.name(),endJoint[0].name(),'ikSCsolver',ikName) eyelidAnim,eyelidAnimGrp = bdRigUtils.bdBuildSquareController(endJoint[0].name(),ctrlName,0.2) pm.parent(eyelidAnimGrp , eyeAnimGrp) #bdRigUtils.bdBuildBoxController(endJoint[0].name(),ctrlName,0.2) if 'corner' not in ctrlName: bdRigUtils.bdAddAttributeMinMax(ctrlName,['BlinkPosition'],'double',-5,5,1) pm.parent(ikName,ctrlName) self.bdBuildJointStructure(joint,ctrlName,ikName) ''' allAnimsGrps = pm.ls(self.templateSide + '*eye*CON_??',type='transform') globalAnimGrp = pm.ls('controllers') pm.parent(allAnimsGrps,globalAnimGrp[0]) ''' self.bdAddEyeAttr(eyeAnim[0]) self.bdCreateVerticalFollow(side) self.bdCreateSideFollow(side) self.bdCreateBlink(side) self.bdCleanupGuides(side)