[Closed] how to wait script processed
Is there some Function like EventsProcessed for waiting all things done and wait untill CPU is Free, but not pause 3DS Max. Seems break and sleep just pause events process, but not wait all script done.
Not from within maxscript no. Maxscript runs within the UI/Main thread, any pauses here, will pause the main thread as well (and make max stop responding).
If you are using max9+ it MIGHT be possible to use the DotNet thread class to wait outside of the main thread. You will need to check the dotnet thread for more details about adding event listeners…
Shane
Dotnet has a “backgroundworker” class as well as the thread class that encompasses the process of setting up a separate thread in a single object – (no mucking around with delegates!). It provides progress notification and abort handlers also. That said, i’ve only set one up within VB.
The only trick with threading is that you cannot directly update a UI thread (ie a progress bar) with the work function being done on the other thread. The way round this is through the use of delegates (in the thread class) or the backgroundworker’s progress changed handler. I will see if i can get one calling a maxscript function and if the update handlers will return correctly.