[Closed] Stop Max from temporarily hanging during long processes?
A little more nitty-gritty than most of the issues I am normally dealing with, but I’ve noticed that when Max is given too much to handle at once, it has a tendency to appear to freeze until it catches up to its instructions.
If this is occurring in the context of a script, is there anything I can do to stop this from happening? Basically, I just want my dialogs and listener output to continue updating in real time when a long process is taking place.
Windows has a mechanism to mark processes as Not Responding if they don’t report back within a certain period of time (I think it is 5 seconds by default). So when running long loops in MAXScript, this often kicks in because the “message pump” is not being processed and Max is not telling Windows “I am still alive and kicking!”
The solution is to add the line
windows.processPostedMessages()
to your loop, for example close to where you might be updating UI values or progress bars.
It is available in 3ds Max 2011 and higher.
Thanks Bobo, worked like a charm! Not only did it take away the “not sure if crashing” issue, but being able to watch the script perform helped me figure out why a couple other unexpected things were happening!