Can someone provide a good argument for why Python is the standard for writing tools in Maya? Up until this point I just agreed. Python is easy to learn and read and it also allows you to work outside of Maya and access your os. However, Python was not built for Maya. There are updates to Maya and updates to Python, which can and does break a lot of scripts. You’ll spend hours trying to figure out an error in your script which could be a simple syntax problem or a problem that has nothing to do with the code, but something more internal. MEL is ugly and a pain to write out but you have the benefit of the Maya console to tell you exactly what the commands are, additionally, MEL is Maya, scripts from like 8 years ago still work. Sure, a while loop looks like a for loop and sure the language is limited to Maya but it’s reliable and stands the test of time. I’m still working through the first volume the Art of Rigging and I’ve learned so much about how Maya works and runs by writing out things in MEL. I dunno.
One argument I tend to use for Python over Mel in Maya has to do with the ability to interact with outward facing programs and pipelines directly. Mel affords you fast and flexible interaction with all the tools inside of Maya, but nothing really outside. In games, you tend to need to work with formats like json, or proprietary data formats, and Python generally has amazing support for them. Imagine wanting to take a series of textures on a specific model and then batch convert them to a different format. I don’t know of a way to do this directly from Maya with Mel, but with Python you could query the model, get the textures, then use PIL to convert and reassign the converted images back to the model.
Python also has modules for direct access to the C++ api through the open maya api module. When you need to do some hardcore things, like writing a new deformer, you can start and prototype quickly through the python api and then move the concepts over to C++ when you’re ready.
EDIT: Another thing I would like to add is that writing UIs for tools inside of Mel is super painful, but with PYQT/PySide in python it can be a dream. Also because Maya’s UI is run by QT you can hack it and do some neat stuff for your pipeline as well. The unfortunate part is that we’ll never be able to get away from AE Templates…
To add to what Sariel said. Python inside Maya can import and use almost every library you created for a stand-alone Python app. Especially for pipeline TD, if you plan your library well, the script conforming file structure can be accessible as stand-alone, inside Maya, inside Nuke, inside Modo, etc etc. (I’m assuming Modo 901 will support PySide too.)
Additionally Python string operation is so much easier to use compare to MEL which imo is a nightmare to work with.
Today, even when I want to run simple MEL commands, I’d do it through Python. cmds.mel.eval() or pm.mel.eval()
Python code that is not absolutely Maya specific can easily be repurposed to run outside of the Maya environment and visa versa. This includes UI if you’re using PyQT/PySide or one of the other standard UI libs. I wish Autodesk would convert all the .mel scripts that come with Maya to Python. I suppose a new ASCII format based around Python like structures (EG. JSON) is asking too much.
there is absolutely no reason to write MEL in this day and age. sure, being able to read MEL is an important skill, especially when listening to the output in the script editor.
the benefits of python far, far, far, outweigh the downsides you listed.