I’m writing some python functions with MaxPlus that will handle skinning, and I’ve hit a bit of a hurdle.
The test code below gets all bound nodes from a node with a skin modifier, however when obtaining the modifier references, they are Animatable objects. I want to obtain the scene graph INode from this, but can’t seem to figure it out.
iNode = MaxPlus.SelectionManager.GetNode(0) # make sure node with skin modifier is selected
for i in xrange(iNode.GetNumModifiers()):
modifier = iNode.GetModifier(i)
print 'Modifier: {}
Class_ID:{}
References: {}'.format(modifier.GetClassName(), modifier.GetClassID(), modifier.GetNumRefs())
if modifier.GetClassName() == 'Skin':
counter = 0
for j in xrange(modifier.GetNumRefs()):
ref = modifier.GetReference(j)
if ref and ref.GetClassName() == 'Node':
counter += 1
n = MaxPlus.INode.GetINodeByHandle(ref.GetAnimHandle())
h = None
if n:
h = n.GetHandle()
print ' Node: {} - Handle: {} --> INode: {} - Matching INode Handle: {}'.format(ref.GetNodeName(), ref.GetAnimHandle(), n, h)
print ' Count: {}'.format(counter)
Is there an easier way to obtain all bound INode objects of a skin modifier?