Duplicate output window ?

147 views
Skip to first unread message

Christopher.

unread,
Jun 19, 2015, 8:46:38 PM6/19/15
to python_in...@googlegroups.com
Can we not feed what the output window produces into another output window with line numbers and such for easier debugging and cutting and pasting ? Maybe I'm the only one that finds the native output window a little like finding my way though the Amazonian rain forest. 

Anyone know of such a tool in existence I would be so happy, if anyone cares about my happiness, that is ! 

Justin Israel

unread,
Jun 20, 2015, 7:43:00 PM6/20/15
to python_in...@googlegroups.com
I don't have a tool to recommend, but there are a number of ways to hook into both the logger and the script editor for different goals. One way is to set up a callback so that you can tee the output and direct it into something else:

import maya.OpenMaya as om
from PySide import QtGui

# Some alternate target to receive 
# Script Editor output
OUTPUT = QtGui.QTextEdit()
OUTPUT.show()
OUTPUT.raise_()

def callback(msg, *args):
    OUTPUT.append(msg.strip())

# Start the callback
cbk_id = om.MCommandMessage.addCommandOutputFilterCallback(callback)

# Stop the callback
#om.MCommandMessage.removeCallback(cbk_id)

Hopefully that does what you want?

On Sat, Jun 20, 2015 at 12:46 PM Christopher. <crestchr...@gmail.com> wrote:
Can we not feed what the output window produces into another output window with line numbers and such for easier debugging and cutting and pasting ? Maybe I'm the only one that finds the native output window a little like finding my way though the Amazonian rain forest. 

Anyone know of such a tool in existence I would be so happy, if anyone cares about my happiness, that is ! 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f9b1ce8d-ba72-4ae1-ab7c-ecbc4c2d08ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Crest Christopher

unread,
Jun 20, 2015, 8:13:59 PM6/20/15
to python_in...@googlegroups.com
If I wanted to send it to Sublime text 2, I simply change the output=QtGui.Sublime, so I can give it a shot ?

Justin Israel wrote:
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/J3RhFyC-pPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0dftbCGz9EgYB7KozM_F-MSm4%2B77bbmKCcFHowWpNOfw%40mail.gmail.com.

Justin Israel

unread,
Jun 20, 2015, 8:59:42 PM6/20/15
to python_in...@googlegroups.com


On Sun, 21 Jun 2015 12:13 PM Crest Christopher <crestchr...@gmail.com> wrote:

If I wanted to send it to Sublime text 2, I simply change the output=QtGui.Sublime, so I can give it a shot ?

Software doesn't work like that. You can't just make an object in Qt and say "output=QtGui.Sublime", and expect Qt to know that it should go out and find a SublimeText2 process, and then tell it to accept text for it to show in its own view.

In order to get external text flowing into Sublime, you would need to create a plugin that opens a socket for Maya to connect to and feed it data. Or you would need to have Maya log to a file, which you then have Sublime poll for updates.

Either way, you would have a bit of work to do beyond just the callback in Maya. That was just a way to get the hook installed.

To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/558601BE.40302%40gmail.com.

Crest Christopher

unread,
Jun 20, 2015, 9:06:50 PM6/20/15
to python_in...@googlegroups.com
Taking a step back, what is going on behind the scenes with the code you posted ?

Justin Israel wrote:

Crest Christopher

unread,
Jun 20, 2015, 10:30:03 PM6/20/15
to python_in...@googlegroups.com
I understand what you mean. 

Justin Israel wrote:

Justin Israel

unread,
Jun 20, 2015, 11:00:48 PM6/20/15
to python_in...@googlegroups.com


On Sun, 21 Jun 2015 1:06 PM Crest Christopher <crestchr...@gmail.com> wrote:

Taking a step back, what is going on behind the scenes with the code you posted ?

1) Create an instance of Qt's QTextEdit class
2) Define a function that matches the proper spec required for the CommandMessage callback. This function will receive the message that would go to the script editor, so that we can direct it elsewhere. In this case I am just appending it to my own QTextEdit widget.
3) Connect the callback to Maya so it will get called.

To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/55860E22.6010102%40gmail.com.

Crest Christopher

unread,
Jun 20, 2015, 11:11:56 PM6/20/15
to python_in...@googlegroups.com
I'm surprised no one thought of this, they thought of clearing the output window, not feeding the results else where, well now the idea is out there.

Justin Israel wrote:

Justin Israel

unread,
Jun 20, 2015, 11:24:32 PM6/20/15
to python_in...@googlegroups.com


On Sun, 21 Jun 2015 3:11 PM Crest Christopher <crestchr...@gmail.com> wrote:

I'm surprised no one thought of this, they thought of clearing the output window, not feeding the results else where, well now the idea is out there.

I don't understand what you mean by no one thinking of this. You would need to have a specific application of where to route it, and this isn't the first time the question has been asked about controlling the output. You can search the history on the topic.

Are you looking to write a specific Sublime plugin that dumps Maya's output into a tabbed document view?

To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/55862B72.9050203%40gmail.com.

Crest Christopher

unread,
Jun 20, 2015, 11:34:30 PM6/20/15
to python_in...@googlegroups.com
You may be right, I suppose I didn't search if this has been asked. 

Are you looking to write a specific Sublime plugin that dumps Maya's output into a tabbed document view?

Yes, for every time a render is initiated, it's dumb into a tab, if that's possible ?

Justin Israel wrote:

Justin Israel

unread,
Jun 20, 2015, 11:46:14 PM6/20/15
to python_in...@googlegroups.com

As for general solutions, here is one where someone thought to replace the script editor:
http://zurbrigg.com/charcoal-editor

And yea it would be possible to do what you want, with data being fed to Sublime. Like I mentioned, either you need to have Sublime connect to a port in Maya, or Maya to connect to a port in sublime, or Sublime to watch a file being written to by Maya.


Crest Christopher

unread,
Jun 21, 2015, 12:23:02 AM6/21/15
to python_in...@googlegroups.com
I already have his page bookmarked, I've been watching his python tutorials. 

The console window makes a giant shmorigshborg of everything it does, it's not atleast to a degree segregate things.



Justin Israel wrote:

Padraig Ó Cuínn

unread,
Dec 16, 2015, 2:12:21 PM12/16/15
to Python Programming for Autodesk Maya
doesnt chris zubbrig have this exact free script on his website  :)

Christopher.

unread,
Dec 16, 2015, 8:52:50 PM12/16/15
to Python Programming for Autodesk Maya
This output window does miss some of the information when Maya starts, but it is helpful as a docked window in Maya.
Reply all
Reply to author
Forward
0 new messages