I've been quite busy this last couple of weeks, and not posting very regularly, but I wanted to take some time out and share something with you all. Basically the poject I am working on at the moment will involve many characters, at least 15 'hero' characters and any number of background chars (possibly hundreds...) So with that in mind I really wanted to have a look at taking out the 'grunt' labour of rigging characters and also having some consistency on the rigs (ie. naming conventions and control handles etc)
So I started writing some MEL scripts that would do all of this for me - and this is the result of my labours. The AutoRig Shelf *sounds of trumpets, waving of banners and flags, fireworks etc etc*
Ok it may not look like much, but with it I can rig a character and have it ready for skinning about 20 minutes after I receive the model. So for me it is priceless, but for you it is free! There are many downloadable maya rigs but they are not always easy to adapt to your own mesh - that's where this script can come in pretty handy if you are not too keen on rigging yourself.
Now as some of you may know I haven't been with Maya for very long, 7 weeks in fact, so I won't pretend that the 4 scripts on this shelf are particularly well written. Also, this is a very simple rig with no fancy spline spine or IK/FK switch etc (since I just wanted to prove to myself with v1.0 that I could do it) But it has already become very useful at work when we wanted to place and pose some characters for a few render tests.
Now before I begin to show you how all this goes together I will describe the contents of the zip (zipped using Winace) which you can download here.
Two MEL shelves: One that I know works for 6.5 and one for 6.0PLE (The reason for this is that I made it at work using 6.5 but my PLE edition at home seemed to have trouble reading the shelf)
4 text documents: As backup in case you cannot open the shelves (These are the actual scripts that can be copy/pasted into Maya's Script Editor, enabling you to create your own shelf)
J.ma: Which is a mayaAscii file that the first script reads from - Although I made this in 6.5 I saved it as a mayaAscii and jigged it a little so it should be ok for Maya 5.0 onwards
Copy the relevent shelf to the Maya shelf folder (normally found in 'C:/Documents and Settings/USER/My Documents/Maya/VERSION/prefs/)
Copy the mayaAscii file to your preferred location (but make a note of this as you will need to tell the first script where to find it)
Now you need to open the Script Editor and MMB (Middle mouse button) Drag and drop this to the Script Editor. Change the file pathnames to the location of the mayaAscii file (as highlighted in the following image). You can then execute this script but before you do I'd suggest highlighting the whole lot and then MMB drag it back to the shelf (so you can use it again) (Hmm now that I have written this I see that there was other, perhaps less confusing, ways of doing this... but I hope it's clear enough!
STAGE - 1
So now that you have altered the startup script - execute it and you will have half a skeleton, read from the mayaAscii file 'J.ma' as seen in the following image. The reason I chose to have Maya import a file was to help with naming conventions (There are ways to place locators and have Maya draw your joints for you... but as yet I don't know how to do that)
At this stage you can now arrange the half skeleton to fit into your mesh. I'd suggest scaling the model up to roughly fit the skeleton - not the other way around... at the end of the script I have arranged it all nice and neat so you can scale the whole lot once it is rigged and skinned
When you are happy with one half, execute the second script labelled 'Mirror'. This script does what it says on the tin. It also renames the new joints, aligns the whole skeleton and changes the rotation order of some joints. From here you can now execute the third script 'CTRL' and you will be confronted with a confusing array of control shapes and locators - something like this.
Now... While I would like to have all those shapes automatically snap to the relevant joints I don't quite know how to do this in MEL yet (if anyone can point me in the right direction that would be great). So this next step is a little labour intensive as you need to manually snap those shapes to where they need to be (they are placed roughly in the right place
) It's a fairly painless process but for those that are not too familiar with Maya, use the move tool, hold down 'V' and MMB drag the shape to the joint. (see the following image). It should be fairly obvious as to where to put these controls - they are all named to the corresponding joint. [NOTE - don't snap the foot control shapes to the ankle joint. Move the foot shape to the desired position then press your [INSERT] key (so you are now moving the pivot point) then you can snap the pivot to the ankle joint)]
STAGE 2a - Some important bits!
You will also notice three locators in the scene - There are also number of 'null' nodes which I used as helper objects. For the HLP_Eye_Aim locators you can simply align them to the center of your characters eyes (which you can later parent to these Helper locators)
Another important location is the HLP_Arm_Parent_Object which should be snapped to the J:joint_neck_base (see image)
And perhaps the most critical is the null nodes for the feet. You can't see them in the viewport as they are just empty groups, but if you open up the Outliner you will see a list of 8 of them. To make things simple here is an image to see exactly where they need to be placed 4 for each foot (and make sure you have the helpers with '_R' on the right foot!
AGAIN a quick apology for all of this (this sort of thing can be done automatically with MEL but as I mentioned earlier... I'm not quite there yet!)
STAGE 3 - The Rig
Once all the controls, helpers and null objects are placed correctly, execute the script labelled 'v1_1'
And that's it! This is the bulk of the script that adds IK to the legs, parents the null nodes correctly and connects it to the attibutes of the foot control, assigns expressions for the wrist twist... parents everything... locks attributes... cleans up the scene etc etc etc. And you are now ready to start skinning!
Not sure there is any more to add. You'll notice that the extra attributes on the Hand controls are not connected yet (that's not an error... just me preparing for v1.2
I hope you followed it all, it was pretty long winded (hopefully I'll cut out the whole snapping thing with the next update). If you have any problems loading the shelves, find bugs, or if you need more detail in the instructions let me know on this thread.