def skinIt(): #Skin it geoGroupObjects = search.returnAllChildrenObjects('geo_grp', True) #Get our group objects jointChains = getSkinJointChains() for i, g in enumerate([ u'torso_geoGrp', u'armLeft_geoGrp', u'armRight_geoGrp', u'legLeft_geoGrp', u'legRight_geoGrp' ]): geoGroupObjects = search.returnAllChildrenObjects(g, True) toSkin = [] for o in geoGroupObjects: if search.returnObjectType(o) in ['mesh', 'nurbsSurface']: toSkin.append(o) if toSkin: for o in toSkin: toBind = jointChains[i] + [o] mc.skinCluster(toBind, tsb=True, normalizeWeights=True, mi=4, dr=10, polySmoothness=3) else: print("'%s' has nothing to skin!" % g)
def skinIt(): #Skin it geoGroupObjects = search.returnAllChildrenObjects('geo_grp',True) #Get our group objects jointChains = getSkinJointChains() for i,g in enumerate([u'torso_geoGrp', u'armLeft_geoGrp', u'armRight_geoGrp', u'legLeft_geoGrp', u'legRight_geoGrp']): geoGroupObjects = search.returnAllChildrenObjects(g,True) toSkin = [] for o in geoGroupObjects: if search.returnObjectType(o) in ['mesh','nurbsSurface']: toSkin.append(o) if toSkin: for o in toSkin: toBind = jointChains[i] + [o] mc.skinCluster(toBind, tsb = True, normalizeWeights = True, mi = 4, dr = 10,polySmoothness = 3) else: print ("'%s' has nothing to skin!"%g)
def checkGeo(self): """ Check a puppet's geo that it is actually geo """ assert self.msgGeoGroup.get() is not False, "No geo group found!" children = search.returnAllChildrenObjects(self.msgGeoGroup.get()) if not children: return False for o in children: if search.returnObjectType(o) in geoTypes: buff = mc.ls(o, long=True) self.geo.append(buff[0]) else: rigging.doParentToWorld(o) guiFactory.warning("'%s' isn't geo, removing from group." % o) return True
def rigMasterCardCharaterOLD(): spineChain = [] jointChains = [] def skinIt(): #Skin it geoGroupObjects = search.returnAllChildrenObjects('geo_grp', True) #Get our group objects jointChains = getSkinJointChains() for i, g in enumerate([ u'torso_geoGrp', u'armLeft_geoGrp', u'armRight_geoGrp', u'legLeft_geoGrp', u'legRight_geoGrp' ]): geoGroupObjects = search.returnAllChildrenObjects(g, True) toSkin = [] for o in geoGroupObjects: if search.returnObjectType(o) in ['mesh', 'nurbsSurface']: toSkin.append(o) if toSkin: for o in toSkin: toBind = jointChains[i] + [o] mc.skinCluster(toBind, tsb=True, normalizeWeights=True, mi=4, dr=10, polySmoothness=3) else: print("'%s' has nothing to skin!" % g) def orientSkeletonTemplate(): #First unparent the parts so we can orient properly hip = rigging.doParentToWorld('hip_l') heel = rigging.doParentToWorld('heel_l') clav = rigging.doParentToWorld('clavicle_l') palm = rigging.doParentToWorld('palm_l') spineChain = ['root'] spineChain.extend(search.returnChildrenJoints('root')) for j in spineChain: joints.orientJoint(j, 'xzy', 'zup') hipChain = [hip] hipChain.extend(search.returnChildrenJoints(hip)) for j in hipChain: joints.orientJoint(j, 'xzy', 'zup') armChain = [clav] armChain.extend(search.returnChildrenJoints(clav)) for j in armChain: joints.orientJoint(j, 'xyz', 'yup') footChain = [heel] footChain.extend(search.returnChildrenJoints(heel)) for j in footChain: joints.orientJoint(j, 'yzx', 'yup') handChain = [palm] handChain.extend(search.returnChildrenJoints(palm)) for j in handChain: joints.orientJoint(j, 'xzy', 'zup') #Fix the thumb thumbChain = ['thumb1_l'] thumbChain.extend(search.returnChildrenJoints('thumb1_l')) for j in thumbChain: #tweak - taken from Comet's orient mc.xform(j, r=True, os=True, ra=(-20, 0, 0)) mc.joint(j, e=True, zso=True) mc.makeIdentity(j, apply=True) #Fix the Head headChain = ['head1'] headChain.extend(search.returnChildrenJoints('head1')) for j in headChain: joints.orientJoint(j, 'yzx', 'zup') #Reconnect rigging.doParentReturnName(hip, 'root') rigging.doParentReturnName(clav, 'spine5') rigging.doParentReturnName(heel, 'ankle_l') rigging.doParentReturnName(palm, 'wrist_l') return spineChain def getSkinJointChains(): leftArmChain = ['clavicle_l'] leftArmChain.extend(search.returnChildrenJoints('clavicle_l')) rightArmChain = ['clavicle_r'] rightArmChain.extend(search.returnChildrenJoints('clavicle_r')) leftLegChain = ['hip_l'] leftLegChain.extend(search.returnChildrenJoints('hip_l')) rightLegChain = ['hip_r'] rightLegChain.extend(search.returnChildrenJoints('hip_r')) torsoChain.extend(['clavicle_l', 'clavicle_r']) returnList = [ torsoChain, leftArmChain, rightArmChain, leftLegChain, rightLegChain ] return returnList torsoChain = orientSkeletonTemplate() #Get ready for JTD stuff mel.eval('source JTDriggingUI;') mel.eval('source JTDarmRig;') mel.eval('source JTDspineRig;') mel.eval('source JTDneckRig;') mel.eval('source JTDdynParent;') mel.eval('source JTDfingerRig;') mel.eval( 'mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_l" "_r" "hip_l";' ) mel.eval( 'mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_l" "_r" "clavicle_l";' ) mel.eval('JTDspineRig("%s", "spine1", "spine5", "root", %f, "%s", "");' % (baseName, spineScale, world)) mel.eval('JTDneckRig("%s", "neck1", "head1", %f, "%s", "%s");' % (baseName, spineScale, world, connect)) mel.eval( 'JTDarmRig("%s","clavicle_l","shoulder_l","elbow_l","wrist_l", 3, 1, %f, "%s", "%s");' % (baseName, armScale, world, connect)) mel.eval( 'JTDarmRig("%s","clavicle_r","shoulder_r","elbow_r","wrist_r", 3, 2, %f, "%s", "%s");' % (baseName, armScale, world, connect)) mel.eval( 'JTDlegRig("%s","hip_l","knee_l","ankle_l","heel_l","ball_l", 3, 1, %f, "%s", "%s", 2);' % (baseName, legScale, world, connect)) mel.eval( 'JTDlegRig("%s","hip_r","knee_r","ankle_r","heel_r","ball_r", 3, 2, %f, "%s", "%s", 2);' % (baseName, legScale, world, connect)) #Fingers Left mel.eval( 'JTDfingerRig("wrist_l","","index1_l","index2_l","index3_l", 1, 1, 1, 0, 1, "%s", %f);' % (baseName, fingerScale)) mel.eval( 'JTDfingerRig("wrist_l","","fingers1_l","fingers2_l","fingers3_l", 1, 1, 4, 0, 1, "%s", %f);' % (baseName, fingerScale)) mel.eval( 'JTDfingerRig("wrist_l","","thumb1_l","thumb2_l","thumb3_l", 1, 1, 0, 1, 1, "%s", %f);' % (baseName, fingerScale)) #Fingers Right mel.eval( 'JTDfingerRig("wrist_r","","index1_r","index2_r","index3_r", 1, 1, 1, 0, 2, "%s", %f);' % (baseName, fingerScale)) mel.eval( 'JTDfingerRig("wrist_r","","fingers1_r","fingers2_r","fingers3_r", 1, 1, 4, 0, 2, "%s", %f);' % (baseName, fingerScale)) mel.eval( 'JTDfingerRig("wrist_r","","thumb1_r","thumb2_r","thumb3_r", 1, 1, 0, 1, 2, "%s", %f);' % (baseName, fingerScale)) #new stuff #Head scale attributes.doSetLockHideKeyableAttr('cubey_neck_IK_Cntrl', lock=False, visible=True, keyable=True, channels=['sx', 'sy', 'sz']) mc.setAttr('cubey_neck_IK_Cntrl.sx', keyable=True) mc.setAttr('cubey_neck_IK_Cntrl.sy', keyable=True) mc.setAttr('cubey_neck_IK_Cntrl.sz', keyable=True) mc.scaleConstraint('cubey_neck_IK_Cntrl', 'head1') #Sets and Coloring leftArmSetObjects = [ u'rig_clavicle_l_IK_Cntrl', u'rig_shoulder_l_twist', u'rig_shoulder_l_Bendy', u'rig_elbow_l_Bendy', u'rig_clavicle_l_FK_Cntrl', u'cubey_finger_Cntrl0_l', u'rig_wrist_l_FK', u'rig_wrist_l_SW', u'rig_shoulder_l_FK', u'rig_elbow_l_FK', u'cubey_arm_IK_Cntrl_l', u'rig_wrist_l_GimbleCntrl_l', u'cubey_arm_PV_Cntrl_l' ] # rightArmSetObjects = [ u'rig_clavicle_r_IK_Cntrl', u'rig_shoulder_r_twist', u'rig_shoulder_r_Bendy', u'rig_elbow_r_Bendy', u'rig_clavicle_r_FK_Cntrl', u'cubey_finger_Cntrl0_r', u'rig_wrist_r_FK', u'rig_wrist_r_SW', u'rig_shoulder_r_FK', u'rig_elbow_r_FK', u'cubey_arm_IK_Cntrl_r', u'rig_wrist_r_GimbleCntrl_r', u'cubey_arm_PV_Cntrl_r' ] # centerSetObjects = [ u'rig_spine1_Shoulders', u'rig_spine1_Hips', u'cubey_spine_Root', u'rig_spine1FK3', u'rig_spine1FK2', u'rig_spine1FK1', u'cubey_neck_FK_Cntrl', u'cubey_neck_IK_Cntrl' ] leftLegSetObjects = [ u'rig_ball_l_FK', u'rig_ankle_l_SW', u'rig_hip_l_Bendy', u'rig_knee_l_FK', u'rig_ankle_l_FK', u'rig_hip_l_FK', u'rig_knee_l_Bendy', u'rig_hip_l_twist', u'cubey_leg_GimbleCntrl_l', u'cubey_leg_IKleg_Cntrl_l', u'cubey_leg_PV_Cntrl_l' ] rightLegSetObjects = [ u'rig_ball_r_FK', u'rig_ankle_r_SW', u'rig_hip_r_Bendy', u'rig_knee_r_FK', u'rig_ankle_r_FK', u'rig_hip_r_FK', u'rig_knee_r_Bendy', u'rig_hip_r_twist', u'cubey_leg_GimbleCntrl_r', u'cubey_leg_IKleg_Cntrl_r', u'cubey_leg_PV_Cntrl_r' ] lArmSet = SetFactory.SetFactory('armLeft', 'animation', True) for o in leftArmSetObjects: lArmSet.store(o) #color curves.setCurveColorByName(o, 'blueBright') rArmSet = SetFactory.SetFactory('armRight', 'animation', True) for o in rightArmSetObjects: rArmSet.store(o) #color curves.setCurveColorByName(o, 'redBright') torsoSet = SetFactory.SetFactory('torso', 'animation', True) for o in centerSetObjects: torsoSet.store(o) curves.setCurveColorByName(o, 'yellow') lLegSet = SetFactory.SetFactory('legLeft', 'animation', True) for o in leftLegSetObjects: lLegSet.store(o) curves.setCurveColorByName(o, 'blueBright') rLegSet = SetFactory.SetFactory('legRight', 'animation', True) for o in rightLegSetObjects: rLegSet.store(o) curves.setCurveColorByName(o, 'redBright') bindJoints = search.returnAllChildrenObjects('root') bindJoints.append('root') skinJointsSet = SetFactory.SetFactory('skinJoints', 'td', True) for o in bindJoints: if mc.ls(o, type='joint'): skinJointsSet.store(o) #Set of all sets allSet = SetFactory.SetFactory('all', 'animation', True) allSet.store(rLegSet.nameLong) allSet.store(lLegSet.nameLong) allSet.store(torsoSet.nameLong) allSet.store(lArmSet.nameLong) allSet.store(rArmSet.nameLong) #Skin! skinIt()
def rigMasterCardCharaterOLD(): spineChain = [] jointChains = [] def skinIt(): #Skin it geoGroupObjects = search.returnAllChildrenObjects('geo_grp',True) #Get our group objects jointChains = getSkinJointChains() for i,g in enumerate([u'torso_geoGrp', u'armLeft_geoGrp', u'armRight_geoGrp', u'legLeft_geoGrp', u'legRight_geoGrp']): geoGroupObjects = search.returnAllChildrenObjects(g,True) toSkin = [] for o in geoGroupObjects: if search.returnObjectType(o) in ['mesh','nurbsSurface']: toSkin.append(o) if toSkin: for o in toSkin: toBind = jointChains[i] + [o] mc.skinCluster(toBind, tsb = True, normalizeWeights = True, mi = 4, dr = 10,polySmoothness = 3) else: print ("'%s' has nothing to skin!"%g) def orientSkeletonTemplate(): #First unparent the parts so we can orient properly hip = rigging.doParentToWorld('hip_l') heel = rigging.doParentToWorld('heel_l') clav = rigging.doParentToWorld('clavicle_l') palm = rigging.doParentToWorld('palm_l') spineChain = ['root'] spineChain.extend(search.returnChildrenJoints('root')) for j in spineChain: joints.orientJoint(j,'xzy','zup') hipChain = [hip] hipChain.extend(search.returnChildrenJoints(hip)) for j in hipChain: joints.orientJoint(j,'xzy','zup') armChain = [clav] armChain.extend(search.returnChildrenJoints(clav)) for j in armChain: joints.orientJoint(j,'xyz','yup') footChain = [heel] footChain.extend(search.returnChildrenJoints(heel)) for j in footChain: joints.orientJoint(j,'yzx','yup') handChain = [palm] handChain.extend(search.returnChildrenJoints(palm)) for j in handChain: joints.orientJoint(j,'xzy','zup') #Fix the thumb thumbChain = ['thumb1_l'] thumbChain.extend(search.returnChildrenJoints('thumb1_l')) for j in thumbChain: #tweak - taken from Comet's orient mc.xform(j,r=True,os=True,ra= (-20,0,0)) mc.joint(j,e=True,zso = True) mc.makeIdentity(j,apply=True) #Fix the Head headChain = ['head1'] headChain.extend(search.returnChildrenJoints('head1')) for j in headChain: joints.orientJoint(j,'yzx','zup') #Reconnect rigging.doParentReturnName(hip,'root') rigging.doParentReturnName(clav,'spine5') rigging.doParentReturnName(heel,'ankle_l') rigging.doParentReturnName(palm,'wrist_l') return spineChain def getSkinJointChains(): leftArmChain = ['clavicle_l'] leftArmChain.extend(search.returnChildrenJoints('clavicle_l')) rightArmChain = ['clavicle_r'] rightArmChain.extend(search.returnChildrenJoints('clavicle_r')) leftLegChain = ['hip_l'] leftLegChain.extend(search.returnChildrenJoints('hip_l')) rightLegChain = ['hip_r'] rightLegChain.extend(search.returnChildrenJoints('hip_r')) torsoChain.extend(['clavicle_l','clavicle_r']) returnList = [torsoChain,leftArmChain,rightArmChain,leftLegChain,rightLegChain] return returnList torsoChain = orientSkeletonTemplate() #Get ready for JTD stuff mel.eval('source JTDriggingUI;') mel.eval('source JTDarmRig;') mel.eval('source JTDspineRig;') mel.eval('source JTDneckRig;') mel.eval('source JTDdynParent;') mel.eval('source JTDfingerRig;') mel.eval('mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_l" "_r" "hip_l";') mel.eval('mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_l" "_r" "clavicle_l";') mel.eval('JTDspineRig("%s", "spine1", "spine5", "root", %f, "%s", "");'%(baseName,spineScale,world)) mel.eval('JTDneckRig("%s", "neck1", "head1", %f, "%s", "%s");'%(baseName,spineScale,world,connect)) mel.eval('JTDarmRig("%s","clavicle_l","shoulder_l","elbow_l","wrist_l", 3, 1, %f, "%s", "%s");'%(baseName,armScale,world,connect)) mel.eval('JTDarmRig("%s","clavicle_r","shoulder_r","elbow_r","wrist_r", 3, 2, %f, "%s", "%s");'%(baseName,armScale,world,connect)) mel.eval('JTDlegRig("%s","hip_l","knee_l","ankle_l","heel_l","ball_l", 3, 1, %f, "%s", "%s", 2);'%(baseName,legScale,world,connect)) mel.eval('JTDlegRig("%s","hip_r","knee_r","ankle_r","heel_r","ball_r", 3, 2, %f, "%s", "%s", 2);'%(baseName,legScale,world,connect)) #Fingers Left mel.eval('JTDfingerRig("wrist_l","","index1_l","index2_l","index3_l", 1, 1, 1, 0, 1, "%s", %f);'%(baseName,fingerScale)) mel.eval('JTDfingerRig("wrist_l","","fingers1_l","fingers2_l","fingers3_l", 1, 1, 4, 0, 1, "%s", %f);'%(baseName,fingerScale)) mel.eval('JTDfingerRig("wrist_l","","thumb1_l","thumb2_l","thumb3_l", 1, 1, 0, 1, 1, "%s", %f);'%(baseName,fingerScale)) #Fingers Right mel.eval('JTDfingerRig("wrist_r","","index1_r","index2_r","index3_r", 1, 1, 1, 0, 2, "%s", %f);'%(baseName,fingerScale)) mel.eval('JTDfingerRig("wrist_r","","fingers1_r","fingers2_r","fingers3_r", 1, 1, 4, 0, 2, "%s", %f);'%(baseName,fingerScale)) mel.eval('JTDfingerRig("wrist_r","","thumb1_r","thumb2_r","thumb3_r", 1, 1, 0, 1, 2, "%s", %f);'%(baseName,fingerScale)) #new stuff #Head scale attributes.doSetLockHideKeyableAttr('cubey_neck_IK_Cntrl',lock = False,visible=True,keyable=True,channels = ['sx','sy','sz']) mc.setAttr('cubey_neck_IK_Cntrl.sx', keyable = True) mc.setAttr('cubey_neck_IK_Cntrl.sy', keyable = True) mc.setAttr('cubey_neck_IK_Cntrl.sz', keyable = True) mc.scaleConstraint('cubey_neck_IK_Cntrl','head1') #Sets and Coloring leftArmSetObjects = [u'rig_clavicle_l_IK_Cntrl', u'rig_shoulder_l_twist', u'rig_shoulder_l_Bendy', u'rig_elbow_l_Bendy', u'rig_clavicle_l_FK_Cntrl', u'cubey_finger_Cntrl0_l', u'rig_wrist_l_FK', u'rig_wrist_l_SW', u'rig_shoulder_l_FK', u'rig_elbow_l_FK', u'cubey_arm_IK_Cntrl_l', u'rig_wrist_l_GimbleCntrl_l', u'cubey_arm_PV_Cntrl_l'] # rightArmSetObjects = [u'rig_clavicle_r_IK_Cntrl', u'rig_shoulder_r_twist', u'rig_shoulder_r_Bendy', u'rig_elbow_r_Bendy', u'rig_clavicle_r_FK_Cntrl', u'cubey_finger_Cntrl0_r', u'rig_wrist_r_FK', u'rig_wrist_r_SW', u'rig_shoulder_r_FK', u'rig_elbow_r_FK', u'cubey_arm_IK_Cntrl_r', u'rig_wrist_r_GimbleCntrl_r', u'cubey_arm_PV_Cntrl_r'] # centerSetObjects = [u'rig_spine1_Shoulders', u'rig_spine1_Hips', u'cubey_spine_Root', u'rig_spine1FK3', u'rig_spine1FK2', u'rig_spine1FK1', u'cubey_neck_FK_Cntrl', u'cubey_neck_IK_Cntrl'] leftLegSetObjects = [u'rig_ball_l_FK', u'rig_ankle_l_SW', u'rig_hip_l_Bendy', u'rig_knee_l_FK', u'rig_ankle_l_FK', u'rig_hip_l_FK', u'rig_knee_l_Bendy', u'rig_hip_l_twist', u'cubey_leg_GimbleCntrl_l', u'cubey_leg_IKleg_Cntrl_l', u'cubey_leg_PV_Cntrl_l'] rightLegSetObjects = [u'rig_ball_r_FK', u'rig_ankle_r_SW', u'rig_hip_r_Bendy', u'rig_knee_r_FK', u'rig_ankle_r_FK', u'rig_hip_r_FK', u'rig_knee_r_Bendy', u'rig_hip_r_twist', u'cubey_leg_GimbleCntrl_r', u'cubey_leg_IKleg_Cntrl_r', u'cubey_leg_PV_Cntrl_r'] lArmSet = SetFactory.SetFactory('armLeft','animation',True) for o in leftArmSetObjects: lArmSet.store(o) #color curves.setCurveColorByName(o,'blueBright') rArmSet = SetFactory.SetFactory('armRight','animation',True) for o in rightArmSetObjects: rArmSet.store(o) #color curves.setCurveColorByName(o,'redBright') torsoSet = SetFactory.SetFactory('torso','animation',True) for o in centerSetObjects: torsoSet.store(o) curves.setCurveColorByName(o,'yellow') lLegSet = SetFactory.SetFactory('legLeft','animation',True) for o in leftLegSetObjects: lLegSet.store(o) curves.setCurveColorByName(o,'blueBright') rLegSet = SetFactory.SetFactory('legRight','animation',True) for o in rightLegSetObjects: rLegSet.store(o) curves.setCurveColorByName(o,'redBright') bindJoints = search.returnAllChildrenObjects('root') bindJoints.append('root') skinJointsSet = SetFactory.SetFactory('skinJoints','td',True) for o in bindJoints: if mc.ls(o,type='joint'): skinJointsSet.store(o) #Set of all sets allSet = SetFactory.SetFactory('all','animation',True) allSet.store(rLegSet.nameLong) allSet.store(lLegSet.nameLong) allSet.store(torsoSet.nameLong) allSet.store(lArmSet.nameLong) allSet.store(rArmSet.nameLong) #Skin! skinIt()