code of the day cotd maya mel

Code of the Day: AutoTangent

AutoTangent 1.0.3 script by martin freitag:

AutoTangent 1.0.3is a script for changing selected Graph Editor Keys to a smooth tangent.

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

Functionality: 6.5
There are only two main options (flattening start and end keys, and a slider for setting the softness), yet the functionality is very helpful, and in some ways feels like it should be built into Maya as a default option. The results are good, the keys smooth nicely without overshooting.

Design: 6
The code is broken up into a number of functions, the UI is small and compact and the code does not use too many variables (one global variable). There are a few magic numbers (specifically 3.0) that doesn’t seem to have much documentation on why it was used either. The error checking handles most cases generally. The main function is fairly long and could have a few areas broken up into smaller pieces to make them more reusable and smaller more robust code base.

Style: 5.5
The formatting is a little inconsistent and the spacing and indentation (especially on the comments) do not seem to follow a consistent standard. There are areas of the code (mostly print statements) that are commented out, which just clutters up the code base.

Documentation: 6.5
The header documentation is decent and some of the comments in the code are pretty good. For being a small file it is not too bad, although it would make for a nicer read if there was not any commented code left in the script.

Reusability: 5
The code is tightly coupled to the UI, and the use of global variables means than no function is capable of reuse without the rest of the code base. Maintainability wise, the code base is tiny, so would be easy to update or modify any bugs as required.

Overall: 6.5
Quick and helpful little script for quickly modifying animation key tangents. In some ways I would not be surprised to see this functionality eventually built into Maya, as it sounds like other packages (like MAX) already have a similar function. It can be a useful little script for now.

Until next time,
Michael Hubbard

Leave a Reply

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