Automated Hand Rigging Tool for Maya
The last fall semester of my undergraduate career I found myself taking both a Rigging class and a Scripting for Animators class. The final project for the scripting class was to make a tool that we could actually use. Since this was due around the same time my hands needed to be rigged for the other class, I thought that it would be a good use of a practical application!
The source code can be found on my Github. Depending on the version of Maya, there may be a few bugs. This was made for Maya 2016. The formatting looks a little weird on Github, but when brought into Maya, should line up properly.
Starting with the window display, and the design behind it. This part was a ton of fun, trying to figure out all of the mathematics of pixel location. After getting a few buttons on the display, I took a screenshot of the window, and imported it into Photoshop. This is where I designed the look of my window.
The Hand button and subsequent finger buttons create locators. After the hand locator is created, it must be moved to the wrist of the character. Once there, the finger buttons can be created. They use the wrists global location to set a new relative location.
After the locators for the fingers are created, the locators must be moved to the characters specific finger joint location.
The control button (number 3) uses a previous control designed by the user, or a new one may be created. To use the preset hand control, select the Control Create button.
These buttons add the fingers created, to the attributes in the control shape. There are a few other features added like ‘close fist,’ and ‘open fist.’
When these things are set and ready, you can then create the joints. This button places joints at the locator positions and removes the locators.
The proper folder structure is applied to the joints and you have a fully functioning hand!
My specific character only needed three fingers, however I made sure that all five fingers work without any problems. There was a portion of the code that I was working on to create and add additional fingers if needed; however due to time constraints on the project this was never fully finished. A workaround for this is to add an additional pinky and it will create ‘pinky1’ if there is a character with more than five fingers.
Mirroring the Hand
Woof. This part was the most challenging portion of the code to successfully get working. The initial version mirrored everything and renamed everything appropriately, however the rotation axis were all messed up!
It wasn’t that they were all flipped, it was that the RightPointerJoint1 would be flipped from the LeftPointerJoint1; and then the RightPointerJoint2 was not only flipped, but inversely flipped from the RightPointerJoint1. This left RightPointerJoint3 double inverted from RightPointerJoint1 and actually went inside the hand. It was all sorts of frustration!
This was no simple fix either. It also explained why I had several problems with my other rigs; and after learning this I was able to fix a lot of problems! Don’t forget to delete history before mirroring!
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
This line of code is essential to the mirroring hand process!