Categories
code of the day cotd

Code of the Day: Rivet Button

Creative crash site again today (will get to the cheese factory soonish), today I looked at the Rivet Button script by bazhutkin: https://www.creativecrash.com/maya/downloads/scripts-plugins/c/rivet-button–2

Simple little script that creates a locator which is constrained to two edges on a polygon or one point on a NURBS surfaces.

Language: MEL
Type: Maya Editor Script
Script Files: 2
Number of lines: 149

Functionality: 8
The functionality does exactly what is described. I think it does a pretty good job in setting up a locator that is easy to parent under, but would be nice to have the option of choosing which node to constrain directly instead of creating a locator and parenting underneath it.

Design: 6.5
The code size is small and compact in terms of total size, but outside of the shelf creation, the main function is just a single function. I realize the focus of making the code base small, but it would be more flexible if the single function was broken up into smaller ones that took parameters instead of hardcoded values. The code also has some duplication, which would benefit from breaking out into a separate function. I also think the code has a logical break between the polygon and NURBS functionality which could also use some separation.

Style: 7.5
The code is fairly well organized and whitespace is used to make the code more easily readable. I am not a huge fan of not indenting the code directly after a function declaration, but since it is otherwise consistent I can not say too much about that style choice. The code is small enough that it doesn’t need many comments, but a few would be a nice to have.

Documentation: 7.5
The documentation is pretty small, but it doesn’t really need to be too complicated. The code does a pretty good job in letting the user know what went wrong, but it still relies on the user to be aware of where to put the code (and image file) and how to invoke it.

Reusability: 8
Calling the base function is trivial, but if it needed to be extended, it would likely benefit from some refactoring. The code base is very small which makes this quite easy to update or change as necessary.

Overall: 7
The functionality is useful and does a pretty good job of doing what it describes. A few extra options (like choosing what is parented), or having some additional offsets available for positioning. Useful quick and easy tool to use for those looking for this specific functionality.

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

Leave a Reply

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