pymxs runtime implementation of MaxPlus.Core.GetRootNode() ?

pymxs runtime implementation of MaxPlus.Core.GetRootNode() ?

Anonymous
Not applicable
1,264 Views
2 Replies
Message 1 of 3

pymxs runtime implementation of MaxPlus.Core.GetRootNode() ?

Anonymous
Not applicable

Hello!

 

As my title indicates, I'm wondering if there's a runtime implementation of the GetRootNode function in MaxPlus, specifically I would love to know if there's a way to traverse the children of the root node.

 

https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__developer_maxplus_python_api_introduction_wor...

 

Kind regards, 

Martin Allers

0 Likes
Accepted solutions (1)
1,265 Views
2 Replies
Replies (2)
Message 2 of 3

eric.brosseau
Autodesk
Autodesk
Accepted solution

Martin,

Thank you for your question.

 

If you strictly want to use pymxs in your Python script, here is the way to do it:

from pymxs import runtime as rt

def getRootNode():
    rootScene = rt.rootScene
    worldSubAnim = rootScene[rt.Name('world')]
    return worldSubAnim.object
	
def outputNode(n, indent = ''):
    print indent, n.Name
    for c in n.Children:
        outputNode(c, indent + '--')
		
if __name__ == '__main__':
    outputNode(getRootNode())

This code was inspired from the maxscript documentation.

https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/3DSMa...

and

https://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=GUID-3F9BC35F-918C-46C6-8617-7DCDDD62FCE3

 

Hope it helps.

Regards,

Eric Brosseau
Senior Software Developer, 3ds Max, Autodesk
Message 3 of 3

Anonymous
Not applicable

Worked like a charm, thank you very much!