How To Get Real Time Feedback from Maya Script Editor to Sublime Text Console??

415 views
Skip to first unread message

Eric S

unread,
Aug 31, 2016, 4:41:18 AM8/31/16
to Python Programming for Autodesk Maya
Hi guys

Need help here i'm new with Sublime
i just instal and setting sublime to execute successfully with this package( https://github.com/justinfx/MayaSublime )

but i can't get real time feedback from maya script editor to sublime console like eclipse do.
Can this works with sublime too ??


Thanks a lot

Justin Israel

unread,
Aug 31, 2016, 6:53:06 AM8/31/16
to Python Programming for Autodesk Maya
I haven't used the Eclipse equivalent. Are you talking about seeing all the script editor output being fed into Sublime in the console? If so, the MayaSublime doesn't do that. It only focuses on executing snippets or whole files from Sublime to Maya. 

And if you are talking about seeing the output from the commands being sent from Sublime being piped back to the Sublime console, it also doesn't do that. The reason is that not everyone opens a commandPort with the return option set up and with a large enough buffer. I'm sure an option could be added to enable this behavior when you know you have set it up. 



Thanks a lot

--
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/1997162e-e6f0-4e1e-99b0-157368c7184c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric S

unread,
Aug 31, 2016, 3:27:50 PM8/31/16
to Python Programming for Autodesk Maya
Thanks Justin for your explination.
Whish this feature we can achive in future.
In eclipse realtime feedBack really helpfull and when the script executed feom eclipse go to maya we can undo it, when do this with sublime maya can't undo it.

Justin Israel

unread,
Aug 31, 2016, 4:07:50 PM8/31/16
to Python Programming for Autodesk Maya
Can you do me a favor and log a detailed feature request to the project (or more than one if you have multiple new features) ? 

List what behavior you want to see. I will try to find some time to work on it. 

Thanks! 


--
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.

Alok Gandhi

unread,
Aug 31, 2016, 11:25:57 PM8/31/16
to python_in...@googlegroups.com
Thanks for doing that Justin!
(from a happy user of may sublime)

On Thu, Sep 1, 2016 at 4:07 AM, Justin Israel <justin...@gmail.com> wrote:


On Thu, 1 Sep 2016, 7:27 AM Eric S <cloud...@gmail.com> wrote:
Thanks Justin for your explination.
Whish this feature we can achive in future.
In eclipse realtime feedBack really helpfull and when the script executed feom eclipse  go to maya we can undo it, when do this with sublime maya can't undo it.

Can you do me a favor and log a detailed feature request to the project (or more than one if you have multiple new features) ? 

List what behavior you want to see. I will try to find some time to work on it. 

Thanks! 

--
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_maya+unsub...@googlegroups.com.

--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0%2BPONCdZzJaZt_Oywg4MUKZOtf%2B%3DCUE8gBnVFBUZzstw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--

Justin Israel

unread,
Aug 31, 2016, 11:27:34 PM8/31/16
to python_in...@googlegroups.com
On Thu, Sep 1, 2016 at 3:25 PM Alok Gandhi <alok.ga...@gmail.com> wrote:
Thanks for doing that Justin!
(from a happy user of may sublime)

No worries. And thanks for the positive feedback.
 

On Thu, Sep 1, 2016 at 4:07 AM, Justin Israel <justin...@gmail.com> wrote:


On Thu, 1 Sep 2016, 7:27 AM Eric S <cloud...@gmail.com> wrote:
Thanks Justin for your explination.
Whish this feature we can achive in future.
In eclipse realtime feedBack really helpfull and when the script executed feom eclipse  go to maya we can undo it, when do this with sublime maya can't undo it.

Can you do me a favor and log a detailed feature request to the project (or more than one if you have multiple new features) ? 

List what behavior you want to see. I will try to find some time to work on it. 

Thanks! 

--
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.

--
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.
--
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/CAPaTLMQhv2CW62XfgD63uRAFyaZC75eWLTtdq_tk5%3D_novFz4g%40mail.gmail.com.

Eric S

unread,
Sep 1, 2016, 1:17:22 AM9/1/16
to Python Programming for Autodesk Maya
Yes i will do it, thanks a lot Justin ^____^


On Thursday, September 1, 2016 at 4:07:50 AM UTC+8, Justin Israel wrote:


On Thu, 1 Sep 2016, 7:27 AM Eric S <cloud...@gmail.com> wrote:
Thanks Justin for your explination.
Whish this feature we can achive in future.
In eclipse realtime feedBack really helpfull and when the script executed feom eclipse  go to maya we can undo it, when do this with sublime maya can't undo it.

Can you do me a favor and log a detailed feature request to the project (or more than one if you have multiple new features) ? 

List what behavior you want to see. I will try to find some time to work on it. 

Thanks! 


--
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_maya+unsub...@googlegroups.com.

Justin Israel

unread,
Sep 3, 2016, 7:19:57 AM9/3/16
to Python Programming for Autodesk Maya
Hey All,

I've put a little time into trying to get a first pass of this feature working. 

I was hoping any of the SublimeText users here that use MayaSublime could try this out and give me some feedback? 

This feature allows SublimeText to receive all of the ScriptEditor output from Maya, into the main console (ctrl + ~)
I tried to implement this in a way where you wouldn't need to install any custom shelf buttons or plugins into Maya. My approach was to have MayaSublime connect to Maya as it normally does, and install a callback which publishes all the output onto a udp port. Then MayaSublime starts a listener and receives the output text from Maya and echoes it to the console. 

In the config you can tell MayaSublime to automatically make this enabled with Maya. And you can manually enable/disable the behaviour with the 2 new Command Palette actions (ctrl+shift+p  and type 'Maya')

Feel free to comment/follow the issue that I linked above.

Thanks!


On Thu, Sep 1, 2016 at 5:17 PM Eric S <cloud...@gmail.com> wrote:
Yes i will do it, thanks a lot Justin ^____^

On Thursday, September 1, 2016 at 4:07:50 AM UTC+8, Justin Israel wrote:


On Thu, 1 Sep 2016, 7:27 AM Eric S <cloud...@gmail.com> wrote:
Thanks Justin for your explination.
Whish this feature we can achive in future.
In eclipse realtime feedBack really helpfull and when the script executed feom eclipse  go to maya we can undo it, when do this with sublime maya can't undo it.

Can you do me a favor and log a detailed feature request to the project (or more than one if you have multiple new features) ? 

List what behavior you want to see. I will try to find some time to work on it. 

Thanks! 


--
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.

--
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/e5e38460-5f5d-4b2d-a6ee-383d86377ee1%40googlegroups.com.

Marcus Ottosson

unread,
Sep 3, 2016, 7:40:57 AM9/3/16
to python_in...@googlegroups.com
Based on your description alone, I spot a few potential problems with that approach.

1. What should the sender do when Sublime closes? How will it know that Sublime closes? Say, for example, that Sublime crashes (spoiler alert, it can't know).
2. Second, what should happen if you have multiple Sublime and/or multiple Maya's?

I get that you use UDP rather than TCP to avoid having to wait for confirmation from a potentially dead Sublime, but I'm less sure about how elegant that actually is.

Another way might be to instead of pushing updates *to* Sublime, I would pull *from* Sublime. You could let Maya build up a buffer of messages that got emptied at a regular (of on demand) basis. That would eliminate the risk of Maya pushing messages unnecessarily. The buffer could optionally include a timestamp for each message such that you could pull a particular range of dates, so as to not prevent others from receiving any, and to not receive doubles.

This way worst case scenario is an endless buildup of this buffer internal to Maya that never gets emptied. To solve that, you could either periodically empty it from within Maya, or only allow a fixed number of messages in it.

For multiple concurrent sessions; I'm assuming you deal with this already, otherwise I've got an idea or two for this as well!

Justin Israel

unread,
Sep 3, 2016, 8:04:37 AM9/3/16
to python_in...@googlegroups.com
Thanks for starting to look at this. Replies inline.. 


On Sat, 3 Sep 2016, 11:40 PM Marcus Ottosson <konstr...@gmail.com> wrote:
Based on your description alone, I spot a few potential problems with that approach.

1. What should the sender do when Sublime closes? How will it know that Sublime closes? Say, for example, that Sublime crashes (spoiler alert, it can't know).

It won't matter if sublime closes. Maya would publish to udp and no one will receive it so it gets dropped. That was one reason for choosing udp over tcp

2. Second, what should happen if you have multiple Sublime and/or multiple Maya's?

In the case of multiple sublimes, each one creates a random ephemeral port and tells Maya to use that port when installing the callback. But you bring up a good point because I think I still have a clash that will happen when it saves the callback for removal. I need to namespace the callback by the port number it is given. 

With multiple Maya's, I am not sure it will be an issue since MayaSublime has to be configured with a port for the target Maya. So extra Maya sessions wouldn't be able to open the same command port. Basically it's only going to talk to the one it is configured to connect with. 


I get that you use UDP rather than TCP to avoid having to wait for confirmation from a potentially dead Sublime, but I'm less sure about how elegant that actually is.

Another way might be to instead of pushing updates *to* Sublime, I would pull *from* Sublime. You could let Maya build up a buffer of messages that got emptied at a regular (of on demand) basis. That would eliminate the risk of Maya pushing messages unnecessarily. The buffer could optionally include a timestamp for each message such that you could pull a particular range of dates, so as to not prevent others from receiving any, and to not receive doubles.

This way worst case scenario is an endless buildup of this buffer internal to Maya that never gets emptied. To solve that, you could either periodically empty it from within Maya, or only allow a fixed number of messages in it.

This actually sounds a lot more complicated than using udp. I didn't only use it for the aspect of not waiting for a response. I also used it because it is connectionless and I don't have to deal with the other side disconnecting on me. Maya just sends output. If sublime is there to pick it up, then it gets displayed. I don't see the need to buffer anything really. 

Initially before deciding to use udp, I was going to have Maya write to a text file. And then Sublime would read it. But then I wouldn't be able to use select() in case the file gets stored on nfs. And then I would have to just poll it for changes at intervals. 

Seems udp gives me active feedback as messages arrive. 


For multiple concurrent sessions; I'm assuming you deal with this already, otherwise I've got an idea or two for this as well!

So far I haven't done anything to try to support multiple Maya sessions. I would have to extend MayaSublime to be able to connect to alternate commandPorts. Is that what you meant? 


--
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.

Marcus Ottosson

unread,
Sep 3, 2016, 8:20:10 AM9/3/16
to python_in...@googlegroups.com
> This actually sounds a lot more complicated than using udp. I didn't only use it for the aspect of not waiting for a response. I also used it because it is connectionless and I don't have to deal with the other side disconnecting on me. Maya just sends output. If sublime is there to pick it up, then it gets displayed. I don't see the need to buffer anything really.

I'm surprised you said this. :( I would have expected you to care about your software cleaning up after itself.

To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3woEpCJWcsHTQrXSx8CKsFCz4fyRhHLEFeYk%3D%3DmUxy7g%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
Sep 3, 2016, 4:23:24 PM9/3/16
to python_in...@googlegroups.com


On Sun, 4 Sep 2016, 12:20 AM Marcus Ottosson <konstr...@gmail.com> wrote:
> This actually sounds a lot more complicated than using udp. I didn't only use it for the aspect of not waiting for a response. I also used it because it is connectionless and I don't have to deal with the other side disconnecting on me. Maya just sends output. If sublime is there to pick it up, then it gets displayed. I don't see the need to buffer anything really.

I'm surprised you said this. :( I would have expected you to care about your software cleaning up after itself.

I don't understand this comment. Why are you implying that my software is not cleaning up after itself? What is the difference between Maya posting to a udp port and it buffering data in memory that someone isn't collecting? Udp should be quite low impact. It's no different than if we told Maya to write the script editor to a file that someone either tailed or didn't. Or if a plugin emits it's log output to some logging endpoint. 

I do have the ability to stop the publisher when Sublime shuts down. But only in ST3 because they give you a plugin unload hook. That is already added to MayaSublime. 

The only way I can really see to get Maya to stop publishing if Sublime goes away is to have a heartbeat. If Maya didn't see an updated timestamp in a period of time, it might disable the publish. But really I would have to profile and determine that it even matters. I have to believe sending to udp is faster than having the script editor open and seeing the output write to that widget. 



On 3 September 2016 at 13:04, Justin Israel <justin...@gmail.com> wrote:
Thanks for starting to look at this. Replies inline.. 

On Sat, 3 Sep 2016, 11:40 PM Marcus Ottosson <konstr...@gmail.com> wrote:
Based on your description alone, I spot a few potential problems with that approach.

1. What should the sender do when Sublime closes? How will it know that Sublime closes? Say, for example, that Sublime crashes (spoiler alert, it can't know).

It won't matter if sublime closes. Maya would publish to udp and no one will receive it so it gets dropped. That was one reason for choosing udp over tcp

2. Second, what should happen if you have multiple Sublime and/or multiple Maya's?

In the case of multiple sublimes, each one creates a random ephemeral port and tells Maya to use that port when installing the callback. But you bring up a good point because I think I still have a clash that will happen when it saves the callback for removal. I need to namespace the callback by the port number it is given. 

With multiple Maya's, I am not sure it will be an issue since MayaSublime has to be configured with a port for the target Maya. So extra Maya sessions wouldn't be able to open the same command port. Basically it's only going to talk to the one it is configured to connect with. 


I get that you use UDP rather than TCP to avoid having to wait for confirmation from a potentially dead Sublime, but I'm less sure about how elegant that actually is.

Another way might be to instead of pushing updates *to* Sublime, I would pull *from* Sublime. You could let Maya build up a buffer of messages that got emptied at a regular (of on demand) basis. That would eliminate the risk of Maya pushing messages unnecessarily. The buffer could optionally include a timestamp for each message such that you could pull a particular range of dates, so as to not prevent others from receiving any, and to not receive doubles.

This way worst case scenario is an endless buildup of this buffer internal to Maya that never gets emptied. To solve that, you could either periodically empty it from within Maya, or only allow a fixed number of messages in it.

This actually sounds a lot more complicated than using udp. I didn't only use it for the aspect of not waiting for a response. I also used it because it is connectionless and I don't have to deal with the other side disconnecting on me. Maya just sends output. If sublime is there to pick it up, then it gets displayed. I don't see the need to buffer anything really. 

Initially before deciding to use udp, I was going to have Maya write to a text file. And then Sublime would read it. But then I wouldn't be able to use select() in case the file gets stored on nfs. And then I would have to just poll it for changes at intervals. 

Seems udp gives me active feedback as messages arrive. 


For multiple concurrent sessions; I'm assuming you deal with this already, otherwise I've got an idea or two for this as well!

So far I haven't done anything to try to support multiple Maya sessions. I would have to extend MayaSublime to be able to connect to alternate commandPorts. Is that what you meant? 


--
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.

--
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.
--
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/CAFRtmOC2Aikemic-M%3DuS19G1PL0DnwT5w8QJ01x6%2BPUjwjDhtw%40mail.gmail.com.

Justin Israel

unread,
Sep 3, 2016, 4:53:13 PM9/3/16
to python_in...@googlegroups.com
On Sun, Sep 4, 2016 at 8:23 AM Justin Israel <justin...@gmail.com> wrote:


On Sun, 4 Sep 2016, 12:20 AM Marcus Ottosson <konstr...@gmail.com> wrote:
> This actually sounds a lot more complicated than using udp. I didn't only use it for the aspect of not waiting for a response. I also used it because it is connectionless and I don't have to deal with the other side disconnecting on me. Maya just sends output. If sublime is there to pick it up, then it gets displayed. I don't see the need to buffer anything really.

I'm surprised you said this. :( I would have expected you to care about your software cleaning up after itself.

I don't understand this comment. Why are you implying that my software is not cleaning up after itself? What is the difference between Maya posting to a udp port and it buffering data in memory that someone isn't collecting? Udp should be quite low impact. It's no different than if we told Maya to write the script editor to a file that someone either tailed or didn't. Or if a plugin emits it's log output to some logging endpoint. 

I do have the ability to stop the publisher when Sublime shuts down. But only in ST3 because they give you a plugin unload hook. That is already added to MayaSublime. 

The only way I can really see to get Maya to stop publishing if Sublime goes away is to have a heartbeat. If Maya didn't see an updated timestamp in a period of time, it might disable the publish. But really I would have to profile and determine that it even matters. I have to believe sending to udp is faster than having the script editor open and seeing the output write to that widget. 

Just to clarify my response, I acknowledge that you are identifying that the publishing is potentially left running in Maya if sublime crashes or if using ST2 (or if the unload hook doesnt run for some reason). Really I was objecting to me not caring about cleaning up my software. I considered this configuration to be just like a standard Maya plugin situation, where a plugin gets loaded. The user can choose to unload that plugin from Sublime. 
What I meant by not having to care if the other side disconnects is related to transient disconnects. Like if you restart Sublime. I don't have to constantly deal with re-establishing a TCP connection between Maya and Sublime. 

Marcus Ottosson

unread,
Sep 3, 2016, 6:23:26 PM9/3/16
to python_in...@googlegroups.com
Slow down. Take a moment, think about what's been said and I'll think you'll find that (a) I pointed out a problem in your program and (b) offered advice. I did that because I wanted you to succeed and because you asked for it. There's no need to get offended, I think it's a good idea.

Justin Israel

unread,
Sep 3, 2016, 7:51:59 PM9/3/16
to python_in...@googlegroups.com


On Sun, 4 Sep 2016, 10:23 AM Marcus Ottosson <konstr...@gmail.com> wrote:
Slow down. Take a moment, think about what's been said and I'll think you'll find that (a) I pointed out a problem in your program and (b) offered advice. I did that because I wanted you to succeed and because you asked for it. There's no need to get offended, I think it's a good idea.


I completely appreciate your input. I want the feedback. But also do the same and think about how you phrase things. I do care :-) People might not take it personal if you make sure not to phrase things as "you don't care about your software design" 

I will consider your advice. I didn't see it as a problem but I will consider that you see it as one to have the publisher still sending messages if you close sublime. 

--
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.
Reply all
Reply to author
Forward
0 new messages