justinfx / MayaSublime

Send selected Python and MEL code snippets from SublimeText to Maya via commandPort
MIT License
150 stars 38 forks source link

Feature Request #26

Closed cloudnix closed 8 years ago

cloudnix commented 8 years ago

Hi Justin

May you add feature:

Thanks a lot ^__^

justinfx commented 8 years ago

Hi,

Real time feedback between maya script editor and Sublime console ? (seeing all the script editor output being fed into Sublime in the console)

Can you please clarify this behaviour? Do you want to see anything that is output to the Script Editor also being streamed to Sublime? Even just normal operations in Maya? Or is this specifically asking to see the output from code that you execute from Sublime to Maya?

cloudnix commented 8 years ago

Hi, thanks for your fast respone

"Do you want to see anything that is output to the Script Editor also being streamed to Sublime?"

Yes that exactly i mean about, anything in maya script editor streamed to sublime, even just normal operation in Maya, include code execute output. And maya can undo after that script executed.

Thanks

justinfx commented 8 years ago

Thanks for that. So on that point of returning anything output from Maya to Sublime, that will take a bit of investigation. It is a little more intrusive of a chance since a handler will have to be installed into the Maya session to collect and deliver the output.

I will look into it.

cloudnix commented 8 years ago

Thanks Justin for your help and time

justinfx commented 8 years ago

I have a first pass at being able to capture the output from Maya into the Sublime console, if you want to give this a test, in the 26_output_from_maya branch?

https://github.com/justinfx/MayaSublime/compare/26_output_from_maya

I've tried it out in both ST2 and ST3, and it seems to function. Not sure about whether this needs an option to write to a custom Output Panel as opposed to the main console. I haven't done anything with custom panels before.

You will find 2 new commands available in the command palette, for manually turning on and off the output from Maya. And also a new option in the preferences to automatically try and connect Maya's output.

justinfx commented 8 years ago

Some things I am looking to get feedback on are:

  1. Is printing the Maya output to the main console in Sublime the ideal behaviour?
  2. Do we care if there is an automatic option to make Maya start piping its output back to Sublime? It is kind of a pain to maintain, since Maya could be started after Sublime or it could be restarted again after being set up by MayaSublime. I deal with this by always ensuring the output callback is enabled whenever we send commands to Maya. This wouldn't be necessary if you had to install a plugin in Maya, but I want to avoid that. Would you expect to have maya start outputting when you start Sublime? Or would you expect to have to manually enable Maya's output with a command?
  3. Is the output formatting that I am using acceptable? Prefixing with [MayaSublime] so that you know where it came from?
justinfx commented 8 years ago

Work in progress merge request to make code comments easier

https://github.com/justinfx/MayaSublime/pull/27

matthewkapfhammer commented 8 years ago

@justinfx, I'm seeing some mangling of the output using the latest on the 26_output_from_maya branch on Win10, Maya2016, SublimeText-2.0.2 build 2221.

Repro steps:

  1. Open a new scene, create a new camera + poly sphere.
  2. Run the following:
import maya.cmds as cmds
from pprint import pprint

all_nodes = cmds.ls()
pprint(all_nodes)

Maya script editor output:

[u'time1',
 u'sequenceManager1',
 u'hardwareRenderingGlobals',
 u'renderPartition',
 u'renderGlobalsList1',
 u'defaultLightList1',
 u'defaultShaderList1',
 u'postProcessList1',
 u'defaultRenderUtilityList1',
 u'defaultRenderingList1',
 u'lightList1',
 u'defaultTextureList1',
 u'lambert1',
 u'particleCloud1',
 u'initialShadingGroup',
 u'initialParticleSE',
 u'initialMaterialInfo',
 u'shaderGlow1',
 u'dof1',
 u'defaultRenderGlobals',
 u'defaultRenderQuality',
 u'defaultResolution',
 u'defaultLightSet',
 u'defaultObjectSet',
 u'defaultViewColorManager',
 u'defaultColorMgtGlobals',
 u'hardwareRenderGlobals',
 u'characterPartition',
 u'defaultHardwareRenderGlobals',
 u'ikSystem',
 u'hyperGraphInfo',
 u'hyperGraphLayout',
 u'globalCacheControl',
 u'strokeGlobals',
 u'dynController1',
 u'persp',
 u'perspShape',
 u'top',
 u'topShape',
 u'front',
 u'frontShape',
 u'side',
 u'sideShape',
 u'lightLinker1',
 u'layerManager',
 u'defaultLayer',
 u'renderLayerManager',
 u'defaultRenderLayer',
 u'persp1',
 u'persp1Shape',
 u'left',
 u'leftShape',
 u'polySphere1',
 u'pSphere1',
 u'pSphereShape1']

ST2 console output:

Sending python:
'import maya.cmds as cmds\nfrom pprint import pprint\n\nall_nodes = cmds.ls()\npprint(all_nodes)'
...
[MayaSublime] [
[MayaSublime] u'time1'
[MayaSublime] ,

[MayaSublime] u'sequenceManager1'
[MayaSublime] ,

[MayaSublime] u'hardwareRenderingGlobals'
[MayaSublime] ,

[MayaSublime] u'renderPartition'
[MayaSublime] ,

[MayaSublime] u'renderGlobalsList1'
[MayaSublime] ,

[MayaSublime] u'defaultLightList1'
[MayaSublime] ,

[MayaSublime] u'defaultShaderList1'
[MayaSublime] ,

[MayaSublime] u'postProcessList1'
[MayaSublime] ,

[MayaSublime] u'defaultRenderUtilityList1'
[MayaSublime] ,

[MayaSublime] u'defaultRenderingList1'
[MayaSublime] ,

[MayaSublime] u'lightList1'
[MayaSublime] ,

[MayaSublime] u'defaultTextureList1'
[MayaSublime] ,

[MayaSublime] u'lambert1'
[MayaSublime] ,

[MayaSublime] u'particleCloud1'
[MayaSublime] ,

[MayaSublime] u'initialShadingGroup'
[MayaSublime] ,

[MayaSublime] u'initialParticleSE'
[MayaSublime] ,

[MayaSublime] u'initialMaterialInfo'
[MayaSublime] ,

[MayaSublime] u'shaderGlow1'
[MayaSublime] ,

[MayaSublime] u'dof1'
[MayaSublime] ,

[MayaSublime] u'defaultRenderGlobals'
[MayaSublime] ,

[MayaSublime] u'defaultRenderQuality'
[MayaSublime] ,

[MayaSublime] u'defaultResolution'
[MayaSublime] ,

[MayaSublime] u'defaultLightSet'
[MayaSublime] ,

[MayaSublime] u'defaultObjectSet'
[MayaSublime] ,

[MayaSublime] u'defaultViewColorManager'
[MayaSublime] ,

[MayaSublime] u'defaultColorMgtGlobals'
[MayaSublime] ,

[MayaSublime] u'hardwareRenderGlobals'
[MayaSublime] ,

[MayaSublime] u'characterPartition'
[MayaSublime] ,

[MayaSublime] u'defaultHardwareRenderGlobals'
[MayaSublime] ,

[MayaSublime] u'ikSystem'
[MayaSublime] ,

[MayaSublime] u'hyperGraphInfo'
[MayaSublime] ,

[MayaSublime] u'hyperGraphLayout'
[MayaSublime] ,

[MayaSublime] u'globalCacheControl'
[MayaSublime] ,

[MayaSublime] u'strokeGlobals'
[MayaSublime] ,

[MayaSublime] u'dynController1'
[MayaSublime] ,

[MayaSublime] u'persp'
[MayaSublime] ,

[MayaSublime] u'perspShape'
[MayaSublime] ,

[MayaSublime] u'top'
[MayaSublime] ,

[MayaSublime] u'topShape'
[MayaSublime] ,

[MayaSublime] u'front'
[MayaSublime] ,

[MayaSublime] u'frontShape'
[MayaSublime] ,

[MayaSublime] u'side'
[MayaSublime] ,

[MayaSublime] u'sideShape'
[MayaSublime] ,

[MayaSublime] u'lightLinker1'
[MayaSublime] ,

[MayaSublime] u'layerManager'
[MayaSublime] ,

[MayaSublime] u'defaultLayer'
[MayaSublime] ,

[MayaSublime] u'renderLayerManager'
[MayaSublime] ,

[MayaSublime] u'defaultRenderLayer'
[MayaSublime] ,

[MayaSublime] u'persp1'
[MayaSublime] ,

[MayaSublime] u'persp1Shape'
[MayaSublime] ,

[MayaSublime] u'left'
[MayaSublime] ,

[MayaSublime] u'leftShape'
[MayaSublime] ,

[MayaSublime] u'polySphere1'
[MayaSublime] ,

[MayaSublime] u'pSphere1'
[MayaSublime] ,

[MayaSublime] u'pSphereShape1'
[MayaSublime] ]```
justinfx commented 8 years ago

@matthewkapfhammer , thanks for that report. I found out the cause. Basically I was adding newlines when I shouldn't. Also, I changed it to not add the [MayaSublime ] prefix to the line unless its a Maya-initiated message like "Warning, Error, Result".

Can you try it again with the latest commits?

justinfx commented 8 years ago

If I don't hear of any further bugs by the end of day, I will merge this and release it.

matthewkapfhammer commented 8 years ago

@justinfx, I won't get a chance to test it until tomorrow. I don't see any reason to delay a release, though. I only saw that one issue. I'll update tomorrow and open a new issue if I see anything.

justinfx commented 8 years ago

Tagged as 3.0.0 I think it takes up to 24 hours for Package Control to sync, if you aren't already manually managing this plugin.

fredrikaverpil commented 8 years ago

Hey, this completely went under my radar. I've got to try this out right now!

You should definitively mention it in the README!

justinfx commented 8 years ago

Good call. I can update the readme. I only included info about it in the settings and in the package control changelog messages.

justinfx commented 8 years ago

@fredrikaverpil , fixed and tagged 3.0.2!

fredrikaverpil commented 8 years ago

Nice! :)