Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detect Unresponding/infinite loop in MEL scripts

Detect Unresponding/infinite loop in MEL scripts

Somehow detect when a MEL script is not responding or jumping at the same location over and over and within a specified timeout display a popup window asking whether or not to abort the current script...

 

Currently when making a mistake in for or while loop conditions there is no choice but forcefully close Maya and lose the code in Maya script editor and other unsaved worked in the scene.

2 Comments
FirespriteNate
Advocate

While an official Autodesk solution would be great I'm not sure how it could be implemented seeing as how it's a generic coding problem, nothing to do with MEL or Maya. Either way, I've come up with this workaround which I've been using since Maya 6.5 or so and it works beautifully... you just have to remember to put it into your loops 😉

 

http://www.naughtynathan.co.uk/?p=59

 

jwlove
Advocate

I think python has something built into it that breaks out of the loop after getting to some obscenely high loop count... I could be wrong on that though - I just seem to remember a few times here and there where I accidentally made an infinite loop with python (usually a 'while' loop) and it broke out of it - I think it also printed out something about reaching some value and suspecting it to be an infinite loop...

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea