PDA

View Full Version : how to wait script processed


m17
04-09-2008, 12:37 PM
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.

RustyKnight
04-10-2008, 11:18 PM
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

LoneRobot
04-11-2008, 08:53 AM
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.

CGTalk Moderation
04-11-2008, 08:53 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.