Do an automated batch process

I am trying to write a script (not very good in it) - something like an automated process in maya but I need some insights as I am not sure if it is feasible.

Basically, the following steps are the steps I did to publish an animated rig for crowd purposes and from Step 2-4, it initially has its own UI and it is using proprietary modules/scripts

  1. New Maya Scene
  2. Import in rig(s)
  3. Import and apply animation curves onto the rig
  4. Publish the scene

While the above is tasked for a single maya scene/ publish, I will actually need to do this for a lot of scenes / publishing

And so, was wondering if anyone has done anything similar before, or could someone give me a few advice on how I should approach it?

P.S: So far, I have writtten up an UI in which it allows the user to import in the latest rig version. Have yet to proceed to step 3 or 4 though

If you want to batch process things, it’s a good idea to completely split the functionality from the GUI. The GUI can send commands to the script, but the script should work equally well from the command line. If all you scripts are written that way, automation is really easy – if you mix GUI code and functional code, though, you always end up with problems. This is the way most of maya is designed - and that’s no accident.

There’s nothing very hard about what you’re proposing to do here, the only question is what’s involved with the publish step – if that involves custom tools or scripts that you did not write yourself you may have to do some research to make sure that step can be done without using GUI.

For step three I’m note sure if the is a nice way to export animation curves and import them back in. If anyone knows that would be awesome. I would simply import the scene that has the animation curves in the the current rig scene, copy animation curves, and past them onto the rig, using copyKeys command.

I can think of a few ways to copy keys onto a rig outside of this, depending on the requirements for import (same exact rig? Mapping to a new one?) you could also store the information out about a curve in a class structure via pickling, then rebuild your curve from that information. You could also do this via some human readable text format, depending on the amount of data that you need to save.

If your data is heavy, the methodology that you explained might be the best as both maya binaries and/or fbx files store and load very efficiently. If you need to do remapping of any kind, you’ll need to write some glue code to handle the data mapping to your rig.