Adverti horiz upsell
Configuring jEdit with Maya
Configuring jEdit with Maya
rbublitz, updated 2007-05-19 23:24:23 UTC 45,141 views  Rating:
(6 ratings)
Page 3 of 4

5. Maya editor
a. Intro
With the Maya Editor Plugin you can send commands and/or the complete buffer to a connected Maya session and get any results or error messages back in a dedicated jEdit buffer.

It functions like the Maya script editor except that you are able to have syntax highlighting in the MayaEditor.mel buffer and you can save the results to disk at any time.
It also offers the ability to search Maya documentation for mel commands, Maya python commands and API classes.

b. Setting it up

In addition to the MayaEditor.jar file, the latest version of InfoViewer plugin is required. Place both of these in the jars/ directory. Place the mayaEditorMacro.bsh file in the macros/ directory. That takes care of the jEdit side. Since it needs to communicate with Maya, a command port needs to be opened in Maya to send and receive commands. Create a shelf button with the following script:

if(! `commandPort -q ":2566"`) commandPort -rnc -n ":2566" ;
global int $MayaEditorEchoState;

global proc MayaEditor() {
global int $MayaEditorEchoState;
eval("commandEcho -state " +$MayaEditorEchoState);
print "\\n\\n";
}



This has to be launched for each new session of Maya. This will create a command port named :2566. jEdit will communicate with this session of Maya across this port. If you have multiple sessions of Maya open, you can easily change each new Maya session to a new port number. Then goto the plugin options page in jEdit to modify what port number it is communicating on.

c. Setting up Toolbar Icons
There will now be four new commands available. They can be accessed by going to: Plugins/Maya Editor/

You can also associate these new commands with toolbar icons and shortcut keys. For the toolbar icons go to: Utilities/Global options/Tool bar/

Click on the plus button and navigate to the MayaEditor plugin, select a command and an associated icon image and then press ok. You can then move the placement of this new icon up or down through the list of toolbar icons.

d. Setting up Keyboard Shortcuts
To setup a new keyboard shortcut, go to: Utilities/Global options/Shortcuts/
Navigate to the Plugin: Maya Editor entry and click on the Primary Shortcut cell of the command to set up. It will open up a dialog to record a series of key presses to associate with the command. My set up is:
Display Docs -> Ctrl + Close Bracket
Execute Buffer -> Ctrl + Back Slash
Execute Range -> Ctrl + Enter

e. The commands
Display Docs
This command will display the Maya docs for the currently selected text in the InfoViewer panel. It will query the documentation set depending on what file type the buffer is currently set to. The options are: mel, Maya API (.cpp, .h), and python(.py).

The default location for the documentation can be specified by going to:
Plugins/Plugin Options/ Maya Editor

Execute Buffer
The complete contents of the current buffer can be sent to Maya and sourced. There is no character size limit for this command. The results and/or error messages from the command will be displayed in a new buffer called MayaEditor[id].mel. The [id] is a number given to each new instance of the Maya results file. If you have syntax highlighting activated for .mel files, the buffer will show the buffer according to your settings.

Execute Range
The selected range of text in the jEdit buffer will be sent to Maya. The socket has a size limit of 4095 characters for each submission. The results will be displayed in the MayaEditor[id].mel buffer.

Clear Buffer
At any point, the MayaEditor.mel buffer can be saved to disk. Since the file is actually owned by the current Maya session, it can not be saved to it's current path. Use the Save-A-Copy-As command in jEdit to save the file to a path of your choosing.

If the buffer gets too long or you just want to clear the contents, use the Clear Buffer command. This will close the current MayaEditor[id].mel buffer (removing access to it) and will tell Maya to start writing to a new MayaEditor[id].mel file. It will only show up in jEdit the next time you submit a command and it will have a new [id] number.

Also use the Clear Buffer command when starting a new session of Maya without closing the current session of jEdit. This will reconnect a valid tmp file.

Update Interval
Maya's script editor output is displayed in a jEdit buffer. The buffer is updated at intervals of 2 seconds by default. This interval can be modified by going to the MayaEditor plugin option pane and changing the "Update Interval" text field.