Get Top Level Nodes in 3DS MAX

I ran into a situation the other day where I needed all of the top level nodes of a scene, not ALL of the nodes. I also wanted to avoid using the MaxPlus API as it has been deprecated in Python 3. Here’s what I found.

1609223026406-08ZY4PF7QCF5501Q7ANR.png

For this scene, the top level nodes would be “Boxes”, “Pyramid001”, and “Sphere001”. The children of “Boxes” would not be included.

from pymxs import runtime as mxs

top_nodes = list(mxs.rootScene[mxs.name('world')].object.children)