Maya Export Plugin - What is going on with the languages?!

Hi,

So, I am a mature student. Worked as a modeler and animator in the past. Almost completed a two-year game-programming course.

My final project is supposed to be an animation-export plugin.
Problem is, I’ve never worked with Mel, nor Python , in Maya before.

The documents seem to say “This is how to make a python plugin for a new mel-command to print Hello World”… NOW GO BUILD ROME!

But I keep running into issues whereby, half the OpenMaya commands I want to use are in different versions of the API! And something useful simply doesn’t exist in one version or another!

What language/version do I use and how do I even know, when looking at the docs, that I am researching the correct one?!

If I were you I wouldn’t mess around with pymel or openmaya. Just go straight Python until you get a grip on what you are doing. There are only a few things I have run into that straight Python couldn’t handle and those were only available in mel. I still used python though, via the eval command.

I too am a mature student :wink:

If it has to be a plugin.
You’re looking at C++ or Python.

Python has the two APIs, (1.0) maya.OpenMaya is the more complete implementation, but has a lot of rough edges. (2.0) maya.api.OpenMaya is a lot nicer to work with, but is sometimes missing features. And sadly you can’t really mix the two.

If it were me, I’d attempt to do everything with the Python 2.0 API, just because of how much nicer it is to work with.

Now if this is just a script / tool, and not a full on plugin. Much like @SethMeshko said, I wouldn’t worry about the API at all, and just stick either to pymel, or cmds.

I had hoped to create a system with its own windows for setting up naming conventions etc, defining what you are animating, eg: character, with animations X, Y, Z. Save that out, so you can come back in and say "Today I’m woking on Bobby’s Walk Cycle, and the saves would be positioned and named correctly. Then when export time comes, the code would find all .ma files of Bobby, open them, export their anims baked onto the skeleton, and name the skeleton correctly.

But, in a language and api which are new to me, I may have to be happy with just managing to find all joints of Namespace X, and copy their values, frame by frame to like-named joints of namespace Y :confused:

So for that kind of work, a full on API driven plugin would probably be overkill.

Defining a UI is very simple, if a bit cumbersome using the functions available in the cmds namespace. Same thing for loading and exporting files, rather simple using cmds.file but the function itself is a bit cumbersome to use.

The script reference documentation is rather good and comes with a sizable amount of example code.

2 Likes

So, I seem to be doing ok, so far, with 1.0, and a little Pymel.
I have two scripts each doing a thing I need.

Once I have scripts doing, between them, all the things I need, I will set about creating the UI elements and getting buttons to call the scripts.

Wish me luck!

And thanks for the advice!