Categories
code of the day cotd maya mel

Code of the Day: DK Anim

dkAnim 0.7.0 script by danielk: http://www.creativecrash.com/maya/downloads/scripts-plugins/animation/c/dkanim/

dkAnim 0.7.0 is a MEL script for importing or exporting animation channels, and relies on node names instead of node hierarchies (like the built-in Maya animation transfer).

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

Functionality: 7.5
The script does a good job saving and loading, although it is not very fast (compared with the builtin option). Perhaps the most useful option is the ability to replace certain nodes and add prefixes which would be very beneficial if the model has changed at all (although the .dkanim file that is created is a text file, so likely that could also be modified). The format of the text file is again non-standard, but has some hierarchical structure to it that makes it more flexible to use than straight line by line processing.

Design: 6.5
Most of the code except for the read and write functions are small and self contained. The read and write however because it is a custom format are quite complex and the level of nesting is quite deep for some of the branching statements. There are a few global variables used to pass information around, mostly to keep the refresh state organized. The code also uses quite a number of variables in the read and write code which makes the design more complex.

Style: 6.5
The code formatting is not completely consistent, especially related to the indentations. The code nesting I mentioned does go up to 14 levels deep of a combination of if/else branching and while loops, which can be pretty hard to follow the overall path of the code.

Documentation: 6.5
The header comment really doubles as the documentation as it is quite verbose and gives a lot of information about how the tool was used and why it was created. The in code documentation are pretty much non-existent, except for the occasional line of commented out code and the one comment “//Does File Exist?”.

Reusability: 5.5
The code in a few places is tightly coupled to the UI (and the refresh globals). There are a number of places that look like they could be reusable, but otherwise not too bad. The maintenance or bug fixes on having to work with the read and write logic would be tricky based on their complexity and the use of a custom format.

Overall: 7
The script does a nice job of providing an alternative to Maya’s builtin .anim channel transferring. If you need an option that works purely on the names of the nodes, and has a few additional options for saving information that is not keyed, this could be a useful script to look at.

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

Leave a Reply

Your email address will not be published.