I don't know if I want to cry or laugh… Probably both… on a loop.
jb On 13 May 2014, at 17:52, Christopher Crouzet <[email protected]> wrote: > The code flushing out after execution is indeed a bit annoying but you get > used to it. The combo Ctrl+A then Ctrl+Enter quickly becomes an automatism. > > The two biggest annoyances for me were to code within the Script Editor (I > guess I'm too used to Sublime Text), and more importantly the persistence of > the variables. In my case this seemed to cause more bugs than the other way > around. Example: when refactoring a code and deleting some variables, you > expect the execution of the script to raise some errors if you forgot to > remove some occurences of those variables that you've deleted. With this > persistence thing, this will won't warn you of anything. If you're unlucky, > this will even preserve the expected behavior of the script. Then, when you > copy/paste the code in a library or when you reload Maya, bam. > > I guess the Script Editor is not made to code your super complex functions > anyways, but to workaround those issues, I came to use a quick/hacky solution. > The idea is to create a .py script file somewhere in which you define a main > function that contains your script and that you call at the end of the file. > > def main(): > maya = 'workaround land' > print maya > > main() > > > Then, just create a button in the shell that calls `execfile` with the path > of the .py file. The variables defined within the main function won't pollute > the environment—they won't persist. > > There's probably ways to wrap this up more nicely but I couldn't be arsed. > > > > On 13 May 2014 12:27, Jordi Bares <[email protected]> wrote: > Exactly right. > > Jordi Bares > [email protected] > > On 13 May 2014, at 17:13, Peter Agg <[email protected]> wrote: > >> Basically I want my scripts to stay there - whether I run them or close the >> program. I'll delete them when I'm good and ready, damnit! >> >> >> On 13 May 2014 15:42, Eric Thivierge <[email protected]> wrote: >> What do you mean? Close and reopen it and your scripts are still there. If >> you're talking about when you close Softimage, that is expected. That kind >> of functionality is weird to me in Maya. It's like reloading your last scene >> you had open before you closed the last time. > > > > > -- > Christopher Crouzet > http://christophercrouzet.com >

