MEL, Python and PyMEL, Part 2

After my post yesterday, a friend emailed me to remind me that coding with PyMEL isn’t always sunshine and rainbows:

I read your post about PyMEL, and just wanted to add that we’ve found some cases where PyMEL is *very* slow compared to Python (which is often a touch slower than straight MEL). Like, orders of magnitude slower.

Treating objects like objects is great, and is very useful in a lot of cases – but watch out for inner loops where you use PyMEL functions and/or create PyMEL objects.

…PyMEL is cool.  It really is a good idea, but it may need some implementation improvements, and since Autodesk isn’t officially developing it (just blessing it), it may never get the 40-hours-a-week love it really needs.

He’s right, and it’s worth noting. The slides I linked to in the last post touch on that, and I’ve experienced it as well. I would hesitate to use PyMEL in cases where you you have to iterate over points in a mesh, or with particles. If you’re writing a tool where speed is an issue, it’s worth knowing how to use vanilla Python in Maya, or even straight up MEL.

But for rigging tools, the speed hit isn’t terribly detrimental, and it’s a small price to pay for having shorter cleaner code, Maya node classes, and not having to manage node name strings. But there is room for improvement, and hopefully it will only get better and more integrated.

Share Button
This entry was posted in Maya, MEL, Python. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *