Maya + Atom Text Editor – Not the animation output

atomToMaya

Now I’m not a developer or all that savvy with code, but we’ve all found ourselves at one time or another trying to wrangle a script together to make our lives easier in the world of CG.
As such I feel confident that I’m a very qualified (at the best of times) guy that wrangles code but even I get tired writing the occasional python script in Maya’s script editor, though I will admit that it’s come along way since my inception with Maya in the year 2000 – they’ve added color! Neat. Okay maybe a few other tid-bits as well but nothing that significant. So I started using Notepad ++, really liked it, then I moved onto pyCharm. Once again it was a good program, but within a little while I landed on Atom. As I mentioned in a previous post, an ex-colleague developer recommended it and I think it’s a great tool. There’s also easy connectivity between Atom and Maya which I’ve found isn’t always available or simple. Thanks to David Paul Rosser for the Atom package, you can also find him on Github here.

Atom is a free text editor for many languages, and there are lots of packages that can be added into it making it very versatile and as light weight or bloated as you want it to be. Though be warned – doing searches for ‘Atom + Maya’ generally gives you unsatisfactory results as I’m sure you’re all aware of Maya’s ‘Atom’ animation output file.

This is just a quick run through on how to get Atom and Maya talking on Windows. My laptop runs Fedora and I was able to get it working just the same, except that python is native within Linux.
First off install Maya. Next let’s take a look at installing python – I’ve had mixed results, to this day I find that the x86 (32bit) version is the most stable as there are glitches that crop up in the x64 version. Once you have python installed in the same location as in the video you may or may not need to add environment variables for your PC to recognize it’s location. If you do follow along with the example I use, by adding the path into your system variable be extremely careful you don’t delete or mistype anything (I’ve never done it but I hear things can go horribly wrong, so tread with caution). This may work in your user variables but I’ve never tried, just tossing the idea out there. Another handy note, if you noticed that I popped open the System dialog window without clicking anything it’s because I pushed the ‘windows’ + ‘pause|break’ key.
Once you have the variable set in your system path there’s a good chance you will need to restart (I’m assuming the reason mine worked immediately is that I removed the ;C:Python27 line shortly before recording the video). To confirm that python is installed correctly and the environmental variable is working properly, open a command prompt and type python, if it loads the python interpreter in the command prompt you’ve succeeded. If not I would look around on Google as there are hundreds of examples (I realize that’s not much help but there really are just too many ways to do this).

Next step, get Atom installed. Obviously pick your OS flavor – for this example it is Windows. Once installed go to your settings tab. It’s not always present when you first open Atom so hit the hotkey ‘ctrl’ + ‘,’ to pop it open in a new tab. From there go ahead and click on the install button and type Maya in the search bar. David’s Maya package will materialize (nifty), so go ahead and click install. In case you’re curious to know where it installed (windows users only), have a look in your C:Users(user name).atom packages. Note: if you have your hidden folders enabled you’ll need to flick it off to expose these guys.

Once the Maya package for Atom is installed click on the link itself to find the instructions. David has supplied all the content that needs to be added to the userSetup.py that Maya loads on startup. The video should explain everything you need, including copying the loop back address which everyone has on their machine by default. Once you have that set up go ahead and load Maya, or if Maya was already open you should probably restart the program or try ‘rehash’ in the MEL command line (really though, just restart). Technically you should be ready to roll so throw some commands in Atom and hit ‘ctrl’ + ‘alt’ + ‘r’ to see if the commands are executed in Maya. I have noticed that on occasion you will need to save the file (e.g. – fileName.py) in order for Atom to recognize that it’s a python script you’re writing, otherwise the text is grey and Atom assumes it’s a text file. Atom also has a little window that will pop open with feedback if there is an error. If you hit a snag feel free to contact me, I’d be happy to help as this has been a great editor for me as I delve deeper into python. Also have a look around for a good linter like Pylint or Python Flake8 Lint to help check for python errors as you code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: