MString nodeName( "nodeName" );
MDagPath dagPath;
MSelectionList sList;
if( MGlobal::getSelectionListByName( nodeName, sList ) )
{
sList.getDagPath( 0, dagPath );
}
joints = cmds.skinPercent("leftEyeballSkinCluster", "AT_JH_eyeball_left.vtx[1]", q=True, t=None)
print joints
weight = cmds.skinPercent("leftEyeballSkinCluster", "AT_JH_eyeball_left.vtx[1]", q=True, v=True)
print weight
[u'facialRoot', u'leftEye']
[0.8059321898658935, 0.19406781013410648]
cmds.skinCluster("leftEyeballSkinCluster", query=True, influence=True)
# Result: [u'facialRoot', u'leftEye'] #
cmds.polyEvaluate("AT_JH_eyeball_left", v=True)
# Result: 130 #
cmds.polyEvaluate("AT_JH_eyeball_left")
# Result: {'edge': 272,
'edgeComponent': 0,
'face': 144,
'faceComponent': 0,
'shell': 1,
'triangle': 256,
'triangleComponent': 0,
'uvComponent': 0,
'uvShell': 0,
'uvcoord': 146,
'vertex': 130,
'vertexComponent': 0} #
cmds.skinCluster("HeadSkinCluster", e=True, mjm=True)
# move joint
cmds.skinCluster("HeadSkinCluster", e=True, mjm=False)
polyListComponentConversion -fv -tuv AT_JH_Head.vtx[658];
polyEditUV -q AT_JH_Head.map[558];
def getDagPathFromName(in_name):
selector = OpenMaya.MSelectionList()
OpenMaya.MGlobal.getSelectionListByName(in_name, selector)
path = OpenMaya.MDagPath()
selector.getDagPath(0, path)
return path
def getNodeFromName(in_name):
selector = OpenMaya.MSelectionList()
OpenMaya.MGlobal.getSelectionListByName(in_name, selector)
node = OpenMaya.MObject()
selector.getDependNode(0, node)
return node
def testSetAttrWeight():
VertexNb = cmds.polyEvaluate("AT_JH_Head", v=1) - 1
weight = cmds.getAttr('{0}.weightList[0].weights[0:{1}]'.format("LeftUpperEyelashWire", VertexNb))
# for blendshape
#VertexNb = cmds.polyEvaluate(Mesh, v=1)
#weight = cmds.getAttr('{0}.inputTarget[0].baseWeights[0:{1}]'.format(blendShapeNode, VertexNb))
for i in range(len(weight)):
weight[i] = 0
cmds.setAttr('{0}.weightList[0].weights[0:{1}]'.format("LeftUpperEyelashWire", VertexNb), *weight, size=len(weight))
def getSelectedObjectSkinnedJoints():
objects = cmds.ls(sl=True);
cmds.select(cl=True)
for obj in objects:
skinClusterStr = 'findRelatedSkinCluster("' + obj + '")'
skinCluster = mel.eval(skinClusterStr)
print(skinCluster)
if (skinCluster is not None):
cmds.select(cmds.skinCluster(skinCluster, query=True, inf=True), add=True)
else:
print("-----> no skin on " + obj + "!")
markdown syntax https://github.github.com/gfm/