Maya Charm - Maya PyCharm connection

maya
python

#1

Was getting a little annoyed with haveing to copy and past code between pycharm and maya, so i made this plugin that exceutes the current documeant or the current selection in pyCharm in maya via the command port. Also did this as kinda a introductory to Java for myself.

Here is a link to the repo on my github page for those that want to look at the code or extend.

Plugin:
https://plugins.jetbrains.com/plugin/8218-mayacharm

Source:

When i have more time i intend to add a feature to have it return console messages from maya to PyCharm.

The 2 commands for running the selection or documeant are found in the run menu and can be bound to keys. Its settings are in the Other section of settings where you can setup the port number for the command port, and where you can also get the proper commands to have maya setup a command port for it to connect to.


#2

I was shock!No one reply this thread.:?:

I’d been searching for method of sending code from PyCharm to maya for a long time without any result, finally someone come to rescue.:D:

This plugin works perfectly on my machine, thanks for your great job!

P.S. Looking forward the function of retrieving console messages from maya to PyCharm


#3

I usually create button that links to my PyCharm project, but for selection this code could be useful.
Maybe auto-removal of intents would be awesome so you can run chunks inside classes and inside functions aswell.


#4

[QUOTE=ArYeS;26781]I usually create button that links to my PyCharm project, but for selection this code could be useful.
Maybe auto-removal of intents would be awesome so you can run chunks inside classes and inside functions aswell.[/QUOTE]

So what check to see if the selection is only 1 line long, and if true remove the indents? That sounds doable.

@Aryes ya when something is close to compleation i will normally make a button for it in maya, but i find this usefull for devlopmeant, since i will often open a scratch documeant in PyCharm where i put my commands i want to run in maya.


#5

Maybe even if there are multiple lines, go through all lines:

line 1: 1 indent
line 2: 2 indents
line 3: 2 indents

You can always remove 1 indent from each line, because that will “normalize” string to minimum indents and if-statements and for-loops will be testable.


#6

any other features you would like tried out for when i get back to it?


#7

This is extremely helpful and generous to create this.
I thought I’d add some helpful additions for those who want to make these into buttons in the toolbar.

  1. Show the toolbar.

  2. Right-Click in the Toolbar and Click “Customize Toolbar and Menus”
  3. Find the Main Toolbar section and Click “Add After” the Help Topics
  4. Traverse down the the Run menu and “Select the Send Current Document to Maya”

  5. Add the other Send command as well.

  6. Save this image for the toolbar icons

  7. Add Icons - > “Edit Action Icon”
  8. If you did it all correct you should have this in the toolbar.


#8

Ya I’m currently trying to figure out now to get Mayas log information into my plug in but my next release will have the Maya icons out of the box and I will also put it in the context menu.


#9

i added support for returing the maya command log to MayaCharm now, and also added icons. Next i will work on the normalization of indents when sending selections to maya.

Plugin:
https://plugins.jetbrains.com/plugin/8218-mayacharm

Source:


#10

How is this different from/advantageous over attaching a debugger to maya’s python interpreter? Can’t you execute code in maya from PyCharm with that method, or am I misunderstanding the differences are between the two approaches?


#11

With the way the PyCharm remote debugger works you can’t actually. You have to start the debugger and run a command in Maya to connect to the debugger, than run the script you want in Maya as well.

But ya this does nothing too special, just prevents you from having to copy and past code snippets to the Maya script editor, or from having to go to Maya to view the output of the script editor.

Convince functions essentially.

Later on once I learn more of the api for this ide I also want to build this into the debugging profile so it can make Maya auto connect to the debugger as well as expecting a default statement to run once connected.


#12

Is this confirmed to work in OS X Yosemite (v10.10)? I can’t get it to work, the menu items doesn’t show up for me.


#13

i wouldnt know i no longer have a mac. Are you getting any error messages, and does the maya log window still display?


#14

I can’t get the commands to show inside PyCharm. The plugin installs without problems but can’t find the commands to run it.


#15

hmm are you looking in the run menu? also if you press command+shift+a and search for maya, does it show either of the excute in maya actions? Also if you go to view > Tool Windows is there a window called Maya Log Avaiable to you?


#16

Checked to logs and it looks like there are some problems:

13:43:58 PluginException: uk/co/cmcproductions/mayacharm/toolwindows/MayaLogToolWindow : Unsupported major.minor version 52.0 [Plugin: uk.co.cmcproductions.mayacharm]: uk/co/cmcproductions/mayacharm/toolwindows/MayaLogToolWindow : Unsupported major.minor version 52.0 [Plugin: uk.co.cmcproductions.mayacharm]
13:44:05 PluginException: cannot create class "uk.co.cmcproductions.mayacharm.actions.SendBufferAction" [Plugin: uk.co.cmcproductions.mayacharm]: cannot create class "uk.co.cmcproductions.mayacharm.actions.SendBufferAction" [Plugin: uk.co.cmcproductions.mayacharm]

#17

Hmm i cant reacreate the problem on my end. The windows version works without issue, and i dont got a mac to test on.
What version of PyCharm are you working with, i devloped with 4.0.4.


#18

I had: Community Edition 3.4

Updated to: Community Edition 4.0.4

Same error. Don’t stress over it, to bad it doesn’t work. But that what you get for working on a mac. :stuck_out_tongue:

Edit:
I can see the Maya Log now but it only says “Initializing…”


#19

Ya sorry that i couldnt help, i was hopeing since the plugin is in java and the whole intellij/pycharm api is java it would just work on all platforms.


#20

This is awesome passerby!! Thanks a lot for sharing. I’ll definitely try it out.