progress ESC
How do I make it so when the user hits the ESC key the operation is completely stopped and canceled....
I've been trying to trouble shoot this and the help file is not really explaining it well enough in a way that is making sense.
Thanks
John
startFrame = animationRange.start endFrame = animationRange.end frameCount = endFrame - startFrame step = 1 prgCount = 0 progressStart "Go:" for t = startFrame to endFrame by step do ( if keyboard.escPressed then exit with (escapeEnable = false; progressEnd(); format "Canceled\n") else ( sliderTime = t progPerct = (100.0 * prgCount * step / frameCount) as integer --//ProgressValue progressUpdate progPerct prgCount += 1 ) ) progressEnd()
Comments
I have implemented what you
I have implemented what you have written but once I uncomment the
progressStart "Go:"
progressUpdate progPerct
progressEnd()
And run the script I continualy get this "Question" dialog which pops up and whether i hit yes or no it still runs the for loop.....hmmm?
John Martini
Digital Artist
http://www.JokerMartini.com (new site)
Yeah, the PBar is very
Yeah, the PBar is very capricious feature :)
I remember that changing
escapeEnable
not help,and the ESC key messed up with the PBar cancelation.
The fix is to use other key than ESC, Ctrl for example.
Also sometime needs to set progressUpdate 100.
In other words, replace last lines:
with:
my recent MAXScripts RSS (archive here)
An easy made logical mistake,
An easy made logical mistake, I think. Your Exit break only stop the progressbar but not the for-loop. You can fix that with boolean pointer into the for-loop (using while), something like:
my recent MAXScripts RSS (archive here)
MZP
they are un-readable files?
John Martini
Digital Artist
http://www.JokerMartini.com (new site)
I don't have time to find out
I don't have time to find out and post the code, but download RTTAssist and check EXPLODE function. You can see haw I use ESC key to stop explosion.
Tools and Scripts for Autodesk 3dsMax