code of the day cotd

Code of the Day: Puppet Master

Puppet Master 1.7.0 script by blackholestudios:–2

Puppet Master 1.7.0 is a biped rig creator which uses locators to map out the joints.

Language: MEL
Type: Maya Editor Script
Script Files: 1
Number of lines: 4507

Functionality: 7.5
There are only a few options (IK/FK, stretchy spine, strechy arms, strechy legs) and options for naming the character, but the end result produces a nice fairly complex rig. There are a number of additional tools and options once the rig has been created (for setting up different controller (eye, hand, foot etc.) as well as options for moving and rotating the controls.

Design: 4.5
Simply put the main “BuildRig” function totaling 3772 lines and having ~200 unique variables is massive. Unless this was done in an attempt to significantly optimize some piece of the design that I am missing, it makes this script very, very difficult to follow and makes the overall code become incredibly complex from this design. This is not the only function in the program, but it makes me wonder why such a complex lengthy function is used as the rest of the functions seem to have a singular purpose and be better encapsulated.

Style: 5
The code variable names are appropriate, and the code uses comments to help organize areas of the code. The spacing is a little inconsistent however (both tabs and spaces) and a number of places have very large indentations (ending up 32 spaces deep for one level of nesting). The code would benefit from breaking apart the large function (perhaps into separate files even) and there are a number of areas where closing brackets are used at inconsistent column placement to help try to organize logical breaks in the code, but this often makes the reader wonder where the closing bracket for the statement is located when the column spacing of the end bracket does not match up (and is instead lined up with a higher level scoping.

Documentation: 7
The documentation is easy to setup, and there are a number of comments throughout the code (which also serve as logical breaks when reading the function(s)). A little additional commenting would be useful, as especially in areas where there are so many things happening at once. I was unable to find the links to the documentation mentioned in the code, so won’t post them here, but it would be nice to see what additional information was available for this script.

Reusability: 3.5
This script is very difficult to follow with so much going on in the main function, and thus it becomes very difficult to update or maintain. With so many variables at play, and so many attributes being created and set, debugging any issue would become very problematic and may require a lot of print statements (as can seen by the commented out print statement in a few places).

Overall: 6
A few additional options would be nice to have, and I am curious about the vehicle rig mentioned as “Coming Soon”. The use of locators to place the rig points is a good approach, and the end resulting rig is quite complex and interesting. Some additional options would be nice to have, but otherwise this script gets by more on its end results then anything else.

Until next time,
Michael Hubbard

Leave a Reply

Your email address will not be published. Required fields are marked *