[MaxPlus] Unexpected Conversion of iNode to Animatable class

Hi,

For some reason I get an unusual conversion of iNode to Animatable class in the MaxPlus module.
In my testing scene, it only has 1 Edtiable Poly Cube bound to bones.

all_obj = MaxPlus.Core.GetRootNode().Children
all_mesh = []

for obj in all_obj:
    if obj.GetObject().GetClassName() == "DerivedObject":
        all_mesh += obj
        print type(obj) 

for mesh in all_mesh:
    print type(mesh)

# Result of the Print
<class 'MaxPlus.INode'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>
<class 'MaxPlus.Animatable'>

As you can see on the for mesh loop. It spits out Animatable instead of iNode.

Is there a way around this? I need the iNode to perform several methods not available in the Animatable class.

Thank you for looking at my problem.

I guess the Animatables are the bones your cube is skinned to.

You can get an INode from an Animatable:

1 Like

@Munkybutt

Thanks for the response but is it possible to altogether avoid that (i.e. getting inode from animatable)?

I already have the iNode. My main problem is the iNode being converted to Animatable unnecessarily ( I didn’t have any conversion function in my command above).

Is there a way around this?

I think you are misunderstanding what is happening, nothing is being converted, you are iterating over the objects in the scene.
To get a better idea, try printing out what obj is, not just the type:

try put this in your loop:

print("obj = {obj}".format(obj=obj))
if type(obj) == MaxPlus.Animatable:
    obj = MaxPlus.INode._CastFrom(obj)
print("obj.GetName = {objName}".format(objName=obj.GetName()))

That should let you see what is being iterated over.