Categories
code of the day cotd maya mel

Code of the Day: DP Transfer Skeleton Keys

dp Transfer Skeleton Keys 1.0.6script by diegopri: http://www.creativecrash.com/maya/downloads/scripts-plugins/character/c/dp-transfer-skeleton-keys

dp Transfer Skeleton Keys 1.0.6is a tool for transferring skeletal animation from one skeleton to another. The skeleton needs to have the same hierarchy, but does not require identical naming.

Language: MEL
Type: Maya Editor Script
Script Files: 4
Number of lines: 1517

Functionality: 8
The functionality is quite polished from everything in setting up the functionality as an extra menu item in the Skeleton menu to the results of the binding. While a few more options in copying the animation might be nice, the fact that it doesn’t rely on naming conventions (instead just skeleton hierarchy) is very nice and likely to be quite flexible for other rigs (parts of the skeleton can be copied separately). In Maya 2012 there are a few warnings/errors that the script had issues with, but the functionality appeared to still work with these errors (below):

// Error: displayString identifier “m_ChaSkeletonsMenu.kRetargeting” does not exist. //

// Error: menuItem: Object ‘globalSnapEnableItem‘ not found. //

Design: 7.5
The separation of UI from the transferring code into separate files is nicely handled, and the overall design is pretty straightforward. There are a few places where the code passed in a string value that is built up to be finally used as an eval which is a little bit error prone, and may benefit from a slightly different approach that instead gathered variables and applied them directly (at least to do some error checking before calling an eval directly). The code also makes use of a number of global variables, and in a few places, magic number and string values.

Style: 7
The code formatting is pretty consistent and quite readable. There are a few places where both the naming conventions and formatting vary slightly, but overall seems to be quite well organized. The internal functionality however in a few places looks like it makes heavy use of if/else statements, to handle up to 30 different types.

Documentation: 8
The code documentation is somewhat light besides the headers there is very little code documentation, except in places where a certain magic number for the types (which would do well to be documented and moved to either a function or constant value). The code does come with a readme and a useful example file to show off the functionality.

Reusability: 6.5
The separation of UI and the rest of the code is a great step, however some of the design decisions and style commitments (building up a string eval and 30 statement if statements) could prove to be more challenging to maintain, upgrade or debug than some other designs would. The fact that there are already errors in the code shows it is has issues on newer versions, yet still seems robust enough to still work (despite the errors).

Overall: 8
The code is quite a useful approach to transferring animation, and the fact that it does not rely on names is a very good idea. There will of course be those people that argue naming conventions when used properly will help be more flexible binding in different ways, but likely if the skeletons are that different, the results will not be that useful anyway. This package is well polished, and while there are a few issues, the end result would be useful for many workflows.

Until next time,
Michael Hubbard
https://michaelhubbard.ca

Leave a Reply

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