Creative crash site again today with the PoseLib script by seith: https://www.creativecrash.com/maya/downloads/scripts-plugins/c/poselib
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)
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.
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.
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.
The documentation online at: http://seithcg.com/wordpress/?page_id=19 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:
Before calling the MEL main function:
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.
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,
One reply on “Code of the Day: PoseLib”
Yay, I got an overall mark of 9! I pass! 😀