View Full Version : Work with the script editor

10 October 2012, 06:38 PM
Okay, this is the most noob question, but since I'm a maya noob, and up until now I have worked with notepad++, I'll allow myself: ;)

When I write something in the script editor it's executed with the keypad enter, but the script is gone. How do I make it stay??

10 October 2012, 07:08 PM
Ctrl + Enter

10 October 2012, 07:21 PM
Either use numpad enter or the other one in combination with CTRL

10 October 2012, 07:59 PM
To execute the script, but how do I prevent the editor from deleting the script (clearing the editor)?

10 October 2012, 08:09 PM
if you select (highlight)something in the script editor it will only execute that highlighted code when you press Enter. A side-effect of this is that it doesn't clear the code either (it would be stupid to clear it in this case because you couldn't test individual lines of code from a larger section)

So to retain code simply highlight it first, and a quick way to preserve/execute the entire lot is to press Ctrl-A to `select all` before pressing Enter.

10 October 2012, 08:16 PM
Yeah, my fault, assumed highlighting as the obvious.

10 October 2012, 08:25 PM
Okay... And this is how you work? :surprised

10 October 2012, 08:30 PM
Now ctrl-a is quickly done...

10 October 2012, 09:29 PM
Okay... And this is how you work?
Yes. Fast. Easy. Simple. :cool:
I have somewhere between 10 and 20 tabs at any one time, named for each of the tasks I'm working on. They are really for quick development and for running small snippets of code. Often for testing something, or doing a simple task.

For full script writing I use Sublime Text 2, but the maya script editor is still essential.


10 October 2012, 05:57 AM

If you need to have better external editing capabilities,
you could check out Cutter: .


10 October 2012, 06:15 AM
i use sublime aswell and you can send stuff from sublime direct to maya as well as auto completion. basically a full swap out really.

10 October 2012, 11:45 AM
Okay... And this is how you work? :surprised
nope, I don't use the Script Editor for coding in as it's pretty rubbish, but that's exactly what you asked for...

10 October 2012, 01:19 PM
Nathan, fair enough.

@zaskar, @djx: Don't you think that the play button should leave the script be? Don't you think that all the tabs in the script editor should be saved? Or in general, don't you think there should be a better and more professional design? No need to answer, just some points for thought.

Guys, thanks for the editor recommendations, but if possible please elaborate why do you like this editor, and why do you think it's better (like @stallion did). Maybe wiki should have a table that specifies if the editor has auto-completion, debug capabilities, (is) free, direct interface with maya. Actually I have the wing editor, but I found it terribly slow and uncomfortable.

10 October 2012, 03:04 PM
I think this thread went somewhat into a dispute about why the Script Editor should be prefered against others - initially it was about how to use it correctly, nothing more. Mayas editor is simple although it has evolved a bit, first the additional tabs some years ago, then the syntax highlighting since the qt interface. If they add some more settings for style and get the editor into opening instantly it should be sufficient for scripting.

10 October 2012, 09:36 PM
Don't you think that the play button should leave the script be? Don't you think that all the tabs in the script editor should be saved? Or in general, don't you think there should be a better and more professional design? No need to answer, just some points for thought.
"just some points for thought" :) Well, just think about them then. Why write them here if you don't want answers?

I've never used the play button. Almost forgot it was even there. "Enter" on the num-pad leaves the script where it is. All tabs do get saved when you exit maya. They actually exist as text files somewhere. I have no problem with the design. It is what it is.

There are plenty of text editors and full blown IDE's that integrate well with maya. Why you like a particular one is probably going to be different to why I like one. I've moved from notepad++ to jEdit, to eclipse to sublime. At their core they are all text editors. I liked the code completion in eclipse. And in sublime I like the search everywhere for everything (you need to see it to know what this means).


10 October 2012, 11:18 PM
Sorry David, I phrased myself poorly. I meant don't have to (in the sense that I wouldn't want to bother you with), and as you know I'm always open to discussion and love to hear other opinions. So thanks for your opinion.
I didn't notice that the code was saved when saving preferences, I guess that now it would be nice if the autosave would include the preferences (preferably to temporary files, which would be restored upon request, like in word).
I guess that after you get used to something, it looks to you like the best idea in the world, but I hope you'll agree that if after a few years of playing with maya I'm posting this thread, then maybe it's not the most intuitive/comfortable option for the user, and this strange behavior (IMO) should at least have an option to configure. I will make a wild guess, and speculate that no one in their right mind would design such an interface, and it's actually a result of evolution from a command line to a script editor. And if you don't use the play button yourself, at least try to consider the new/average user as well.
Also I wonder how can you code comfortably without a debug option, although I would have to ask myself first how do I code in npp without auto-completion, before asking myself the same question.

Off-topic, since you mentioned that they all in the end just text editors, can someone speculate why winword and vs2010, which are just dumb editors, take so long to start (and in vs case open a solution)? I mean, can't they just give me my text editor and just load all the BS in the background later?!

10 October 2012, 08:29 PM
I gave a go to the script editor: It would never work for me, I'm used to working with the keypad - as a programmer I have the num-lock off, and I use numpad1-9 to navigate, and of course the keypad enter for a new line. :banghead:

I also tried sublime. It doesn't have debug capabilities. I installed but these two lines

host = _settings['host']
port = _settings['py_port'] if lang=='python' else _settings['mel_port']

set a None value to the variables, despite having a global var:

_settings = {
'host' : '',
'mel_port' : 7001,
'py_port' : 7002

So I needed to replace these lines with

host = ''
port = 7002

What's up with that?
Also when I execute, I don't get a feedback, e.g. print 'hi' doesn't print anything anywhere, maybe there's an output window?

So I guess the main highlight of this editor is the auto-completion. But it hardly works for anything (I tried pymel and openmaya packages and variables). For that matter maya script editor and wing editor didn't fair better. Also both in the script editor and sublime I can't navigate with pgup/pgdown like in vs, and unless I can change this behavior I would never use it.

When I have a large script, I can't seem to find something similar to npp's function list plugin (a small list on the side of the functions that let's you navigate the code).

10 October 2012, 09:05 PM
try eclipse, it has the function list, remote debugging, auto completion, etc... but setting it up is quite involved. I don't have the details for setting it up, but there are detailed instructions floating around the internet.

10 October 2012, 09:45 PM
to see the console in sublime press Ctrl + `...and auto complete needs a few seconds at the beginning to catalogue all entries.

anyway, there is a script editor replacement I've been waiting for....which checking just now, has come out v1.01

CGTalk Moderation
10 October 2012, 09:45 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.