Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Jan 2006
    Saumur, France

    Tutorial (Scripting): Setting up jEdit for Maya Programming

    In this tutorial we will cover setting up and IDE for Maya Programming, so you no longer need to rely on the Maya Script Editor alone. To be more specific this tutorial tells you how to setup up jEdit for using it with MEL and Python scripting. Be aware that if you are intending to stay along for the ride that the process of setting up jEdit may cost you a few valuable hours of your life and possibly parts of your own sanity. If you couldn't bother less with downloading plugins, tweaking settings and reading tutorials simply get Maxya - Learning Editon. Maxya has pretty much all the same features as a beefed up version of jEdit, only it offers all the candy right out of the box. The only problem I have with Maxya is that the Learning Editon will occasionally not let you save and the Code Execution is limited for each session. jEdit on the other hand has all the same capabilities and it comes for free without crippling features or nag screens. Now, let’s figure out how to install and tweak the awesomeness that is jEdit.

    1. Downloading and Installing jEdit

    Let’s cover the very basics first. You need to get the installer files for jEdit in order to start coding. Go to and go to the “Downloads” section. There are usually two download options: A stable version and a development version. If you want to use the newest plugins (and believe me, you do) then you need to get a newer development version. At the time of writing this jEdit 4.3 pre 16 is the newest version. However, one of the plugins that I use won’t work with pre16, so I recommend getting pre 15 (unless you don’t plan on ever using auto code completion features). Installing the application is straight forward. Just execute the installer files and follow the on-screen instructions.

    2. Plugins and such…

    Since jEdit is an open source IDE one of its most powerful features is the large amount of plugins that have been created by other users. Admittedly jEdit isn’t quite suited for Maya Scripting right out of the box, so ready yourself for some major customizing before you plunge into the world of coding. So where do you find plugins and how do you install them? The easiest way to get plugins is through jEdit itself. Launch the application and go to Plugins->Plugin Manager. Make sure you have an active internet connection and go to the “Install” tab. Choose any plugin you like, download it and jEdit automatically installs it for you. It couldn’t be any easier. Another option is to install plugins manually. Go to, move to the plugins section and download away. In most cases manual installation is also quite simple. Downloads usually come in archives and need to be extracted to either the jEdit settings directory or application directory. The jEdit settings directory is in the same location as your Windows user settings (c:\documents and settings\USER) and the application directory is wherever you installed jEdit to (c:\program files\jEdit). Most plugins come with install instructions, but in general you simply place the jar files along with anything else that comes with the plugin in your jEdit\jars folder. Restart jEdit and the plugIn should automatically start.

    3. Tweaking jEdit Settings

    Even without any plugins jEdit in itself is highly customizable. Go to Utilities->Global Options and you will find a myriad of options allowing you to tweak the application to your heart’s content. Of course, everyone has their own preferences, so there is no real right or wrong here. Here are some of the settings that I use:

    Word Wrap: Soft
    Wrap Margin: 100
    Tap width: 4
    Indent width: 4
    Soft tabs: ON
    Folding mode: Explicit.
    You can encapsulate any text with three curly brackes to create a fold or highlight any text and use Folding->Add Explicit Fold.
    CTRL + EQUALS : Increase Font size
    CTRL + MINUS: Decrease Font Size
    jEdit->Context Menu
    I have removed anything I don’t really use and added “Line Numbers” and “Add Explicit Fold”.
    jEdit->Text Area:
    Highlight current Line: The default color is so close to white that I can barely see it on my monitor. I have mine set to a light blue.
    jEdit->Tool Bar
    “Show tool bar” turned off. I prefer to use keyboard shortcuts and the tool bar just takes up screen estate.

    4. Syntax Highlighting for MEL and Python
    Get it here:
    Everybody needs syntax highlighting for Maya programming. Without it you might as well code in the Script Editor. In jEdit this feature is known as “modes”. You can download the MEL and updated Python modes at highend3d. Simply put the mel.xml and the python.xml in your jEdit/modes folder. I recommend you use the jEdit settings directory (c:\Documents and Settings\USER…). That way you can also copy the catalog file that comes with the archive and put it right along with the .xml files. If you decide to put the files in your application directory then you need to open the catalog file with a text editor (like jEdit, which you should have installed by now, hopefully). Copy the file content and append it to the already existing catalog file in you jEdit/modes folder. After you have copied the files launch jEdit again, go to Utilities->Global Options and set the “Default Edit Mode” to Mel or Python_Maya.

    5. Buffer Tabs
    Get it through the Plugin Manager or download it here:
    This plugin will add a tab pane to your user interface that allows you to quickly switch between different buffers. And then I say buffer I really mean files. So Buffer tabs allows you to see all the files that you have currently opened and switch between them by simply clicking on the tabs. Nifty, eh? By default the tab bar is situated at the bottom of your screen. You can change the location under Plugins->Plugin Options->Buffer Tabs->Location of Buffer Tabs. Personally I prefer to have it at the top, but that’s just me.

    6. Maya Editor

    Get it here:
    This plugin has two very awesome features: First it allows you to directly send code to an open Maya session, have it executed and its results displayed in a second buffer (=another file, remember?). In addition you can also directly access the Maya help directory, highlight code and have jEdit automatically search the Maya command docs. In order to install you need to put the “MayaEditor.jar” in your …jEdit/jars folder and the “mayaEditorMacro.bsh” in your …jEdit/macros folder. The “MayaEditor.mel” contains a MEL script that needs to be run during a running Maya session to allow communication between jEdit and Maya. You need to run this script once before you can start sending code to the Script Editor. The easiest way to have this done automatically whenever Maya starts is to paste the content of ”MayaEditor.mel” into your “userSetup.mel”. This file can be found in your Maya user directory (c:\documents and settings\Maya\scripts). If you don’t have one, you can simply put your “MayaEditor.mel” in the scripts folder and rename it to “userSetup.mel”. With all that said and done you should now be able to directly execute scripts from within jEdit. Highlight any piece of code and use “Plugins->Maya Editor->Execute MEL Range” or use “Execute Buffer” if you want to send the entire file content. I have set hotkeys to speed this up: CTRL+ENTER for Executing MEL Range and CTRL+SHIFT+ENTER to execute the Buffer. When you send code to Maya for the first time jEdit will automatically create a new Buffer (called mayaEditor[…].mel with lots of numbers) that displays Maya’s Script Editor Output. If you like you can split the view (CTRL + 2 or View->Splitting->Split Horizontally) and have the Buffer displayed separately so you can see Maya’s response to your scripts while you code and test it. Make sure you turn off reload notifications under “Utilities->Global Options->General->If open files are changed on disks”, unless you enjoy getting warning messages every time you switch between Maya and jEdit.
    Now that you have the “Send Code” functionality got to work, let’s move on to displaying the Maya docs. Before you can get this to work you will need to download and install the Infoviewer plugin. Get it from or use the Plugin Manager. Proceed with Installation as usual by simply placing all the files in your …/jEdit/jars folder. Once you have the infoviewer up and running you have two options: To display the documentary you can either use the Infoviewer which is a very basic browser or use the favorite browser of your choice. External browsers usually work fine, but cannot be docked inside the jEdit UI. The Infoviewer loads super fast is dockable, but comes with other issues.

    Option 1: Using the Infoviewer.
    What I like about the internal browser is that it loads up extremely fast and you can dock it inside the UI. The latter is a great feature if you don’t have a whole lot of screen estate to spare. However, the infoviewer was obviously not designed to display the Maya docs, as it does so very poorly. You are usually only interested in the commands listing while coding, but the infoviewer displays the fonts for the command index way too small. Don’t bother trying to use “Increase Font Size”, it’s a no-go. However I have found a way to fix this problem by editing some of the html files within the docs (Look at me, trying to HTML code). I have uploaded the fixed files to highend3d and the download should be available within the next few days. Another problem I encountered was setting up the infoviewer’s homepage which can be defined under Plugins->Plugin Options->Info Viewer->Internal Browser. Naturally you want to set this to the Maya Documentation which by default is located under “C:\Program Files\Autodesk\Maya2009\docs\Maya2009\en_US\”. However if you enter this address and proceed to start your infoviewer you will receive an error. It is very important that you prefix your link with “file:/”. In my case that would be “file:/ C:/Program Files/Autodesk/Maya2008/docs/Maya2008/en_US/index.html”.

    Option 2: Using an external Browser
    Using an external browser has the advantage of giving you full access to the Maya documentation without the headaches that the Infoviewer can cause. You will also be able to use the Substring search function, which unfortunately doesn’t work in the Infoviewer at the moment. To set this up simply go to Plugins->Plugin Options->Info Viewer->Choose Browser, pick “External Browser” and under “External Browser Command” enter the installation directory of the browser of your choice (e.g. C:\program files\mozilla firefox\firefox.exe). I use an external browser for my desktop PC where I have a multiple Monitor setup and screen estate isn’t really an issue. I also chose my least favorite browser for browsing the Maya docs. This way I can set the homepage to my maya docs directory and also keep the internet away from me while I work (and it’s just great to finally have a use for that not-so-useful-yet-undeletable-browser).
    No matter what option you pick you still need to tell the Maya Editor Plugin where your docs are on your hard drive. Now you might think: “Hold on a second, didn’t we do that already?” We only setup the directory for the infoviewer, however the Maya Editor still needs to know where to look for the files so you can directly search highlighted for highlighted code in your browser. Go to “Plugins->Plugin Options->Maya Editor” and make sure that the directories are all pointing where they should. In this case there is no “file:/” nonsense involved. You can now highlight any text and use “Plugins->Maya Editor->Display Docs”. I have this keyed to my F1 button (I put the jEdit help to F2).

    7. Dynamic Procedure and Variable Listing

    This plugin is one of my personal favorites. I would move it to number 1 of this list if it wasn’t such a nightmare to install. The idea is to have a dockable window that can display a list of all your variables and procedures that reside in the file that you are currently working on. You can simply click on any list item and jEdit automatically takes to the line where the item was first implemented. There is a download at highend3d called code browser, but don’t bother downloading it if you are using a newer version of jEdit. This plugin has become obsolete and you now need three different plugins to do the job for you. You first need to get “Sidekicks” and “CTagsSidekick”. Both plugins can be obtained through the Download Manager or by going to . If you decide to install it manually you simply put everything in the …/jEdit/jars folder.
    CTagsSideKick also needs Exuberant ctags Version 5.5 or later from Download "Source and binary for Windows 98/NT/2000/XP". I extracted the archive to my personal jEdit folder under c:/documents and settings/USER_NAME/.jedit/ctags. You have make sure to link the plugIn to your ctags folder. Go to Plugins->Plugins Options, under CtagsSideKick go to ctags Path and enter your install path. VERY IMPORTANT: You need to link the entire path to your executive. E.g: c:/documents and settings/USER_NAME/.jedt/ctags/ctags.exe
    If you dont include ctags.exe in your script path it won't work. I found that out the hard way.
    Even with all that done the plugIn still won't work. You need to specify a ctags rule file (or however you want to call it). This file comes with the now obsolete codebrowser plugin from highend3d (I guess you do have a reason to download it now). You can also create your own ctags rule with any text editor. Here is the text that needs to be in that file:
    --regex-mel=/\<string\>[ \t]*([$]+[a-zA-Z0-9_$]+)/\1/var string/
    --regex-mel=/\<int\>[ \t]*([$]+[a-zA-Z0-9_$]+)/\1/var integer/
    --regex-mel=/\<float\>[ \t]*([$]+[a-zA-Z0-9_$]+)/\1/var float/
    --regex-mel=/\<matrix\>[ \t]*([$]+[a-zA-Z0-9_$]+)/\1/var matrix/
    --regex-mel=/\<vector\>[ \t]*([$]+[a-zA-Z0-9_$]+)/\1/var vector/
    --regex-mel=/^global proc([ \t]|string|int|float|matrix|vector|\[\])*([a-zA-Z0-9_]+)/\2/global procedure/
    --regex-mel=/^proc([ \t]|string|int|float|matrix|vector|\[\])*([a-zA-Z0-9_]+)/\2/local procedure/
    --regex-C++=/[ \t]+\b(M[A-Za-z]+)[ \t]+([a-zA-Z0-9_]+)/\1 \2/maya api/
    Save the file out as ctags.cnf. Then rename the file and remove the ".cnf" suffix. Don't ask me why but jEdit doesn't like the suffix. Now where to put the file? The help files say to put it %USERPROFILE. In plain english that means you need to have it under “c:/documents and settings/USER_NAME”. So wherever your windows user profile is located, this is where that file needs to be. NOT in the .jEdit subfolder, NOT in the ctags folder. I also found that out the hard way. All what is left to do in jEdit is to go to “Plugins->Sidekick->Sidekick” and you get your own codebrowser window. I like to have it docked to the side, so what I did is I went to “Utilities->Global Options->Docking” and set Sidekick to “left”. In addition I went to “Plugins->Plugin Options->Sidekick->Parsers” and I set MEL to ctags, so Sidekick automatically uses the right parser.

    8. Follow Up: Code Completetion and Code Snippets
    Stay tuned for more jEdit tutorial goodies coming soon to your local www.
    Last edited by Jennifer; 02-22-2009 at 09:21 AM.
    "The road to hell is paved with works-in-progress."

    My Portfolio
    My Tutorials

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts