PDA

View Full Version : program flow and user action


ctrl.studio
01-29-2008, 04:04 PM
Hello !

I'm not that great expert in maxscripting. So I'm wondering if you could get me some points to understand better this issue.

Let's say that basically I have a for loop, invoked from a button, that moves up the timeline and that at every frame calculates something storing it in a .net datatable. I need a way to stop the for loop by user intervention. For example a 'Stop' button in a form. But for the moment I see that the form is freezed until the loop is not exhausted. Any ideas on this. Or am I just taking this thing from a wrong pow and I should look for something different ?

max

Bobo
01-29-2008, 05:17 PM
Hello !

I'm not that great expert in maxscripting. So I'm wondering if you could get me some points to understand better this issue.

Let's say that basically I have a for loop, invoked from a button, that moves up the timeline and that at every frame calculates something storing it in a .net datatable. I need a way to stop the for loop by user intervention. For example a 'Stop' button in a form. But for the moment I see that the form is freezed until the loop is not exhausted. Any ideas on this. Or am I just taking this thing from a wrong pow and I should look for something different ?

max

Generally, the progressstart(), progressupdate() and progressend() methods can be used to display the progress bar at the bottom of Max, which has a Cancel button the user could press. You can check in the progressupdate() whether the Cancel was clicked and act accordingly, like exiting the loop prematurely.

Lately, since around the time WinXP came out, Max often appears to be "not responding" until a script is finished, at least from the POV of the OS. So sometimes handling Cancel messages or Esc key is sluggish or not working at all.

For inhouse production tools that are calculating so heavily that they appear not to respond to Cancel and Esc attempts, I sometimes implement a Lock File which is created when the script is run and is checked for in the loop while the script is running. So in order to stop such a script from running, all I have to do is delete the file from disk. But this is a hack you cannot subject others to, only for internal use in special cases.

ctrl.studio
01-29-2008, 05:29 PM
Generally, the progressstart(), progressupdate() and progressend() methods can be used to display the progress bar at the bottom of Max, which has a Cancel button the user could press. You can check in the progressupdate() whether the Cancel was clicked and act accordingly, like exiting the loop prematurely.thanks Bobo, I was really looking for something like that.

max

ctrl.studio
04-20-2008, 03:21 PM
For inhouse production tools that are calculating so heavily that they appear not to respond to Cancel and Esc attempts, I sometimes implement a Lock File..Having to work with .NET I found a better solution. When the script starts it opens a little form 'Close Me', then it checkes it if it's open or not. if not it will stop the script.

max

CGTalk Moderation
04-20-2008, 03:22 PM
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.