C++ Tooling in Maya
- #maya #tools #cpp
- 296 words, Read time 1 minute, 29 seconds
So I picked up a gig building a plugin for Maya, and since apparently I was enough of a badass in NOMU to be trusted with something similar, I wanted to walk in on day one living up to expectations (what a professional I am). So I spent a while learning how tool development for Maya actually works.
Maya scripts in its own language called MEL, but it also exposes a C++ API, and a compiled C++ plugin on Windows ships as a .mll rather than a .dll. Same idea as a DLL, but just a different extension target. Which leads to the real question: how do you set up a project that spits out a Maya-compatible .mll?
After downloading the most bloated IDE known to mankind (hello, Microsoft), I made a C++ project and started bending it into shape. Build for x64, since Maya is a 64-bit app. Set the output extension to .mll. Then came the version-sensitive part: picking the Windows SDK and MSVC compiler that match my Maya version, which I need to look up here. From there, point the include and library paths at my Maya install and link against its libraries. Add the initializePlugin and uninitializePlugin entry points Maya calls on load and unload, plus the preprocessor defines it expects.
Lastly, a module file so Maya knows where my stuff lives. I hit a few bumps writing it, but patiently reading the docs and peeking at plugins Maya already loads sorted it out. Then my "hello world" fired on initialize, and it worked.
It was nowhere near as smooth as those tidy sentences make it sound. But the painful part is hopefully behind me. All that is left now is to head into the headers and actually dig my head in.