At our last Stolen Notebook team meeting I described the workings of snmaterial and it’s seperated UI system. Denrei immediately asked if I had built snmaterial into Maya. An excellent question. I said no, but I wondered why I hadn’t.
Integrating a scriptable command line tool into your content creation tool is simple. If your content creation tool has a scripting language (most do) and can execute system commands, you’re all set.
At Stolen Notebook we use Maya for content creation. Maya’s scripting language, MEL, can be used to do a variety of things, not least of which is UI scripting. After getting acclimated to MEL’s syntax and UI system I had created a MEL UI interface for snmaterial directly in Maya. The MEL UI interface for snmaterial looks similar to the python interface.
Creating the UI script in Maya allows direct access to a few useful Maya commands that can be run on the current scene. Most importantly, I can export the current scene to Collada, a feat otherwise impossible without having to run a batch mode of Maya or compile the Maya API into the tool itself. The Material Exporter is accessible from the ‘Catharsis’ menu which is created when our custom Maya plugin is loaded. On export the script does the following:
- Exports the scene to a temporary collada file
- Generates snmaterial system command
- Runs the snmaterial command on the collada file
Chalk up another victory for command line tools.