code of the day cotd

Code of the Day: PoseLib

Creative crash site again today with the PoseLib script by seith:

This script allows keyable attributes to be saved to an XML file and reapplied to the object (or different objects with the same named attributes). The script offers quite a number of options for the creation and management of the pose.

Language: MEL and Python
Type: Maya Editor Script
Script Files: 2
Number of lines: 3194 (MEL) + 678 (Python) = 3872 (Total)

Functionality: 9.5
The functionality is quite extensive and offers a lot of options for creating, renaming, editing, replacing or moving poses. The tool also does a render of the selection allowing the artist to save out logical snapshots of each of the poses (as well as allowing them to choose background and icon colors). Overall quite a lot of functionality packed into this tool.

Design: 6.5
I understand the use of python seems primarily for the use of the XML modules (which MEL does not have), but it is still a little more difficult to read code that is spread over two languages. The MEL script makes quite a lot of uses of global variables, and the python code has some additional flags (for handling the MacGruff user), which complicates the overall design. Some functions make use of a lot of global variables (~20) which can make a function too complex.

Style: 7
The code style in python is for the most part following the standards, although it would benefit from following a few more of the guidelines of PEP8 for naming and commenting. The MEL script is very long, and a number of parts of the code are commented out, which makes the code even longer and complicates reading.

Documentation: 8
The documentation online at: is very thorough and gives a good indication of the available options and functionality available in these scripts. Most of the code has decent comments as well. One thing that would be important to mention is that after placing the scripts, you have to call the python import:

import poseLibModule

Before calling the MEL main function:


Reusability: 6
The code base is fairly large for one MEL file and complex in that it is dealing with two different languages. Some of the MEL code functions are small enough to be reusable, but a lot of the code uses either a lot of global variables or relies on a UI hierarchy to be too reusable.

Overall: 9
The functionality is very thorough and seems to have grown into a mature and useful tool. This is quite a nice feature set in terms of options and flexibility. For those interested in storing poses, this is one of the nicer sets of functionality I have seen. Some of the options (such as the icon color information) are nice features to have and show a dedication to creating a useful tool.

Until next time,
Michael Hubbard

One reply on “Code of the Day: PoseLib”

Leave a Reply

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