def BindSkin(): sel = base.ls(sl=True) if (len(sel) == 0): base.confirmDialog(title="Empty Selection", message="You have to select a mesh", button=['Ok']) else: for i in range(0, len(sel)): base.skinCluster(sel[i], "RIG_ROOT", bm=3, sm=1, dr=0.1, name="Mesh" + str(i)) base.geomBind('Mesh' + str(i), bm=3, gvp=[64, 1]) if (base.objExists("RIG_LAYER")): _rig = base.select("RIG") base.editDisplayLayerMembers("RIG_LAYER", "RIG") else: _rig = base.select("RIG") base.createDisplayLayer(nr=True, name="RIG_LAYER") _ik = base.ls("IK_*") base.editDisplayLayerMembers("RIG_LAYER", _ik) if (base.objExists("CONTROLLERS")): base.editDisplayLayerMembers("CONTROLLERS", "MASTER_CONTROLLER") else: _ctrl = base.select("MASTER_CONTROLLER") base.createDisplayLayer(nr=True, name="CONTROLLERS")
def bindMesh(objName): global name name = objName name = returnName() sel = cmds.ls(name) for i in range(0, len(sel)): cmds.skinCluster(sel[i], 'jnt_0', bm=3, sm=1, dr=0.1, name='Mesh' + str(i)) cmds.geomBind('Mesh' + str(i), bm=3, gvp=[256, 1], mi=1) print 'Skin Bound'
def bindSkin(prefix): #### Binds skin to mesh, if mesh not selected than message appears #### sel = cmds.ls(sl=True) if (len(sel) == 0): cmds.confirmDialog( title="Empty Selection", message= "You have to select a mesh, cause I can't do everything for you.", button=['Ok']) else: for i in range(0, len(sel)): cmds.skinCluster(sel[i], prefix + "_Root_Jnt", bm=3, sm=0, name="Mesh" + str(i)) cmds.geomBind('Mesh' + str(i), bm=3, mi=4, gvp=[1024, 1])
def BindSkin(): #hide all ik handles cmds.setAttr("ik_R_leg.visibility", 0) cmds.setAttr("ik_L_leg.visibility", 0) cmds.setAttr("ik_L_upper_wing.visibility", 0) cmds.setAttr("ik_L_lower_wing.visibility", 0) cmds.setAttr("ik_R_upper_wing.visibility", 0) cmds.setAttr("ik_R_lower_wing.visibility", 0) cmds.setAttr('Joints.visibility', 0) #hide joints so animators do not accidently move them cmds.delete('loc*') #delete locators #bind the bird mesh to the rig using a geodexic voxel bind cmds.select('bird') sel = cmds.ls(selection = True) for i in range(0, len(sel)): cmds.skinCluster(sel[i], 'jnt_root', bm=3, sm=1, dr=0.1, name='Mesh'+str(i)) cmds.geomBind('Mesh'+str(i), bm=3, gvp=[256,1], mi=2) #import skin weights cmds.deformerWeights('skinWeights.xml',im=True, sh='bird') print 'Skin Bound'
def geomBind(*args, **kwargs): res = cmds.geomBind(*args, **kwargs) if not kwargs.get('query', kwargs.get('q', False)): res = _factories.maybeConvert(res, _general.PyNode) return res