3dsMax 2022 script compatibility


#1

Hi
There is very handy script to toggle between sub-objects and object selection
It is working like a charm in 3dsMax 2020, but this error occurs in 2022 when run on EditableMesh or EditablePoly with no modifiers assigned

MAXScript%20MacroScript%20Error%20Exception_210531120944

Will appreciate fix
Thanks!

rapid_edit_04.ms (3.9 KB)


#2

There should be an error message in maxscript listener with the source code line number and position where this error happens.


#3

I know, but there is nothing in the Listener even if it is enabled

MAXScript%20Listener_210601121409


#4

The error is on line 46. This line in the code below modPanel.setCurrentObject obj.modifiers[obj.modifiers.count]

local obj = selection[1]
		
		if getCommandPanelTaskMode() == #modify and subObjectLevel != 0 then
		(
			subObjectLevel = 0
			modPanel.setCurrentObject obj.modifiers[obj.modifiers.count]
			setCommandPanelTaskMode #create
			setCommandPanelTaskMode #modify
		)

I don’t know if this will help, but when the line 46 is replaced with this:

if obj.modifiers.count != 0 then
				modPanel.setCurrentObject obj.modifiers[obj.modifiers.count]
			else
				modPanel.setCurrentObject obj

the error not appear.