Sublime for MEL scripting

posted in: Blog | 0

 

There are a couple of things you need to install in your Sublime before fully utilisiang all the sublime editing features

Step 01:
go to link https://packagecontrol.io/installation#st3

Depending from the Sublime version you are using chose one of two columns. Chances are you are using Sublime 3, check the Sublime window topbar to see the version you are using

Copy that code and lets paste it in Sublime.
To paste it, in Sublime go under view>show console and paste into console that appeared on the bottom of the screen and press Enter.

Restart Sublime.

Step 02:
Second step is installing Packages. Press CTRL + SHIFT + P to open package installer.
and type in install. Then type in JEDI
Once done that, reiterete. Press CTRL + SHIFT + P, type in install but this time type in Maya Sublime.
Using these steps install also Sublime Linter, pep8, py flake 8

Now if you go to view>Syntax you will see MEL option. Code you type in the Subliem will use MEL color coding.

Step 03:

If you want to execute code in Maya from Sublime directly run this code as a PYTHON script.

import maya.cmds as cmds
# Close ports if they were already open under another configuration
try:
cmds.commandPort(name=":7001", close=True)
except:
cmds.warning('Could not close port 7001 (maybe it is not opened yet...)')
try:
cmds.commandPort(name=":7002", close=True)
except:
cmds.warning('Could not close port 7002 (maybe it is not opened yet...)')
# Open new ports
cmds.commandPort(name=":7001", sourceType="mel")
cmds.commandPort(name=":7002", sourceType="python")

 

Once you run this script in maya, you can at any time select text in Sublime and right click Send to Maya. It will run normally as if you ran the script in Script Editor. The great thing about this is if you crash maya during testing you wont risk losing any code.

MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scriptingSublime MEL scripting

Share with friends
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply