PDA

View Full Version : script editor history


Stringkeeper
10-21-2010, 09:55 AM
Hello,

in the script editor when executing a script is there a way Maya will NOT print the whole script I just executed in the history panel and just print the outputs the script creates?

I have found no option to disable this.

Cheers

Sebastian

NaughtyNathan
10-21-2010, 12:03 PM
don't execute "scripts" in the script Editor is the only real solution.

anything you directly input is echoed (and this is absolutely how it should be), and this goes for all hotkeys, shelf buttons, manual inputs, etc...

make your code into a procedure, then just call that, and at least it's only then echoing back the procedure name.

:nathaN

Stringkeeper
10-21-2010, 01:02 PM
As far as I can tell you are wrong. Writing functions and executing by control+a and control=+Enter will always print the all code first in the history pane then to programs output.

NaughtyNathan
10-21-2010, 01:47 PM
i'm not wrong, you just don't understand what I meant. as I've already said:

don't execute "scripts" in the script Editor is the only real solution

if you are writing procedures and inputting them in the script editor you are directly contravening the above statement. Don't input them into the script editor, write them in a proper external editor and then just call that. The script editor is fine for inputting individual lines but not much more than that (unless you don't mind spamming the history with a ton of code which you obviously do)

but why would anyone care if their code is echoed in the script history..?

:nathaN

Stringkeeper
10-21-2010, 02:06 PM
So you restart Maya every time you change something in the external editor to reload the imported python file? Or is there a better way?

goleafsgo
10-21-2010, 02:58 PM
You call 'source' on your file and it reloads it.

goleafsgo
10-21-2010, 03:00 PM
And just realized that you said Python...I can't remember the exact syntax to do it but there is a way to reload them too. Google or search in the forums here and you'll find instructions.

NaughtyNathan
10-21-2010, 03:13 PM
So you restart Maya every time you change something in the external editor to reload the imported python file? Or is there a better way?

are you serious? that would be insane... ;)

If I'm writing a MEL function called "myTool" I have a file called "myTool.mel" open in my text editor. inside that text file is the line:

global proc myTool()
etc...inside my script editor in Maya is the single line:
source myTool;myTool;and when I hit Enter only that line is echoed to the history and the latest saved version of my script is executed. This way I will also NEVER lose any code when I invariably crash Maya.

The python equivalent is this:

import myTool
reload(myTool)
myTool.main()or:
import myTool;reload(myTool);myTool.main()if you're really anal about less junk echoed to the history.
:nathaN

ewerybody
10-22-2010, 09:16 AM
Or use the command port. This way I call Maya to source my scripts from outside. Seems you can run stuff from outside without anything about that being written to the script Editor history unless you print it by yourself.

So if you are looking for a cleaner debug thing: Another Idea would be to write a logging function that writes your stuff to an external file. There are log or tail viewers available too.

You can write stuff to the Output window as well via trace (http://download.autodesk.com/us/maya/2009help/Commands/trace.html). Sadly you cannot flush the trace. It could also be spammed with other stuff.

So actually the only way be sure you ONLY read what you want is the own log file. You know any script or plugin is allowed to use print or trace.

CGTalk Moderation
10-22-2010, 09:16 AM
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.