What's New in the 3ds Max 2018 Python API

This release of 3ds Max introduces some changes and improvements to the Max Python API.

Python version

The Python version used by 3ds Max has been upgraded to 2.7.12.

PySide Version

The included PySide version is upgraded to PySide 2.0, to support upgraded Qt 5.6.2. PySide 2.0 moves widgets from QtGui into their own module, QtWidgets. Existing PySide-based scripts will need to add this import.

This version of PySide includes the pyside2uic module for loading Qt Designer .ui files.

Widget Docking

The MakeQWidgetDockable API has been removed, and is replaced by the standard PySide approach. QToolBar and QDockWidget can be docked to the main 3ds Max window. See the sample script [3dsmax]\scripts\\Python\demoPySideToolBarQWidget.py, which demonstrates the standard PySide approach.

Note: You need to run demoPySideToolBarQWidget.py from the Scripting > Run Script menu, as it uses the __file__ global variable.

3ds Max Main Window Access

The GetQMaxWindow() function is replaced with GetQMaxMainWindow(). GetQMaxWindowWinId() is also removed, as the main window is now a native Qt window.

CreateCUIFrameWindow

With the migration to Qt, you can no longer create a Windows CUI window using MaxPlus::CUIFrame.Create(). Use PySide2 to create windows and dialogs.

What's New in 3ds Max 2018.4 Update

By-Reference Parameter Handling

The pymxs module now supports functions that take by-reference parameters, with the new pymxs.mxsreference() function. In previous versions, these parameters were not handled.

For example:

import MaxPlus
rt = pymxs.runtime

MaxPlus.Core.EvalMAXScript("mySphere = sphere radius:10")
MaxPlus.Core.EvalMAXScript("myType = #reference")
MaxPlus.Core.EvalMAXScript("myResultArray = Array()")

offset1 = rt.Point3(50.0, 50.0, 10.0)
myReturnedList = []
rt.maxOps.cloneNodes(rt.mySphere,  offset=offset1, cloneType=rt.myType, newNodes=pymxs.mxsreference(myReturnedList))
print "python array: "
print myReturnedList

offset2 = rt.Point3(-50.0, -50.0, 10.0)
rt.maxOps.cloneNodes(rt.mySphere,  offset=offset2, cloneType=rt.myType, newNodes=pymxs.mxsreference(rt.myResultArray))
print "runtime array: "
print rt.myResultArray