Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Saumur, France
    Posts
    1,347

    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 www.jedit.org 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 www.jedit.org, 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:

    jEdit->Editing:
    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.
    jEdit->Shortcuts:
    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: http://www.highend3d.com/maya/downlo...Mode-2464.html
    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:
    http://plugins.jedit.org/plugins/?BufferTabs
    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:
    http://www.highend3d.com/maya/downlo...ugin-3732.html
    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 www.jedit.org 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 www.jedit.org . 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 http://ctags.sourceforge.net. 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:
    Code:
    --langdef=mel
    --langmap=mel:.mel
    
    --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

  2. #2
    Join Date
    Dec 2008
    Posts
    22
    Nice.
    Someone stickie this!

  3. #3
    Join Date
    May 2006
    Location
    the netherlands
    Posts
    20
    hmm could you make a tutorial for eclipse also?
    So much to learn, so little time

  4. #4
    Join Date
    Mar 2009
    Posts
    1

    Nice Post..Code Snippet for Mel Solution

    Thanks for the great article. I installed the jEdit and got everything working.

    I hope you got your code snippet thing.If not then, there is a plugin called SuperAbbrev that provides the same functionality. Just that you have to slowly build the snippet library. If there is some pre built snippet library for Mel, then do post a link.

    Thanks again.

  5. #5
    Join Date
    Oct 2009
    Posts
    1
    This post was a godsend but the ONLY thing i'm not able to get working is the cTags/SideKick business. I've set it up on both my mac and my pc and sidekick indeed runs but it get 0 output in the window. Only thing i get is the name of the mel script. Unfortunate too because i was REALLY looking for that functionality. Its almost as if ctags isn't running right. I did point it to the correct place as i get no errors when i run sidekick (i do get errors if i point it to a wrong path).

    Additionally i put the ctags file under users/my name/ (root thereof) as i'm on windows 7... wonder if that is perhaps the issue.

    Anyone else having any issues getting this to work?

  6. #6
    Join Date
    Nov 2009
    Posts
    1

    please help!

    hi. i went through the entire process and i cannot get jedit to work with maya (installed the plug ins, copied the macro, ran the mel script in maya...) i dont seem to be getting any errors, just nothing happens when i execute a mel or python range.

    i have 64 bit windows 7 home premium...could this be an issue? any ideas would be greatly appreciated.

  7. #7
    Join Date
    Feb 2007
    Posts
    57
    Thanks a million for this tut.
    Using Python and 2011, the execute command causes jEdit to lock up (WinXP x64, JRE build 1.6.0_20-b02).
    I realize that things have changed in 2011, so I can live without that, but what I'd like to get working is the display of the Python Docs. The Mel Docs are working fine using infoViewer internal, but nothing happens when I try to display pythonDocs.
    Mel path is C:\Program Files\Autodesk\Maya2011\docs\Maya2011\en_US\Comman ds\
    Py path is C:\Program Files\Autodesk\Maya2011\docs\Maya2011\en_US\Comman dsPython\
    Any suggestions?
    Thanks.

    Also, a couple updates of the instructions in this thread:
    The font size of the infoViewer can be increased - see the help file. Some heading text displays improperly.
    If you set the Maya Help docs as the Homepage of the infoViewer, it won't display correctly as the index uses Flash.
    Not sure what is meant by "Substring search function" but you can use the help function on individual commands and they will be displayed in the infoViewer
    Last edited by PixelDroid; 07-20-2010 at 12:26 PM.

  8. #8
    Join Date
    Feb 2007
    Posts
    57
    Maxya has been great, but development has stopped due to changes in Maya 2011.
    I've switched to jEdit (Windows) and have pretty much everything working except:
    1) Executing code from jEdit - this causes jEdit to hang.
    2) Opening the Python Docs from within jEdit. This doesn't work, so I just open the Mel docs and click the Python link.
    3) Copy code from jEdit and paste into Script Editor doesn't work. A workaround is to use clipMate and auto convert the clipboard to text only.

  9. #9
    Join Date
    Jul 2007
    Posts
    16
    I am the author of most of the jEdit/Maya plugins you find on Creative Crash. It would have been nice to mention that there was already a tutorial explaining all of the above info on that website. But in any case just so you know, I am no longer actively developing for jEdit. The Eclipse IDE is a much more fully featured tool to use with Maya and Python development. You can also find plugins and tutorials of mine on Creative Crash.

  10. #10
    Join Date
    Sep 2016
    Location
    Argentina
    Posts
    2
    nice and really helpful
    3 D TO ALL
    marceloluisbruno@gmail.com
    indeep-studio (skype)
    http://3dtoall.com/

Posting Permissions

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