Test each item and compare the apiType too OpenMaya.MFn.kSkinClusterFilter. The first skinCluster may not be correct. Suppose an influence is bound and the geo is not bound. The loop will find the influence's skinCluster and exit. Test the outGeometry is the same as the node you are looping before exiting.
-brian
-------- Original Message --------
Subject: [Maya-Python] Re: grabbing skin cluster. API
From: "[email protected]" <[email protected]>
Date: Thu, October 08, 2009 1:02 pm
To: python_inside_maya <[email protected]>
import maya.OpenMaya as OpenMaya
import maya.cmds as cmds
import maya.OpenMayaAnim as OpenMayaAnim
"""--------------------------------------------------------------------"""
#still don't know exactly how to take the selection into account with
API.
sel = cmds.ls(sl=True)
#declare variables as types
node = om.MObject()
selectionList = om.MSelectionList()
selectionList.add(sel[0])
selectionList.getDependNode(0,node)
# oMesh is MObject to your mesh
try:
itDG = OpenMaya.MItDependencyGraph(node,
OpenMaya.MFn.kSkinClusterFilter,
OpenMaya.MItDependencyGraph.kUpstream)
while not itDG.isDone():
oCurrentItem = itDG.currentItem()
fnSkin = OpenMayaAnim.MFnSkinCluster(oCurrentItem)
# Don't need to loop any more since we got the skin cluster
break
except:
print "no Cluster"
# No skin cluster
pass
Now this always prints "no Cluster" even if I have a skinned mesh
selected. I'm thinking that how I am getting a hold of the mesh object
is the problem, but I'm still shaky on how to get that information.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---
