Categories
code of the day cotd

Code of the Day: MJ PolyTools

Continuing on with the creative crash site today, I wanted to continue a bit more with some asset creation tools, so downloaded the popular MJ Poly Tools by Mikkel Jans: http://www.creativecrash.com/maya/downloads/scripts-plugins/polygon/c/mj-poly-tools

This is a script creates a menu with of mesh manipulation tools including:
Connect Vertices/Edges/Faces
Split Around Vertices/Edges/Faces
Edge Loop Split
Select Ring
Select Loop
Select Outline
Extrude Vertices ( Seperated / Together )
Chamfer Vertices ( Seperated / Together )

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

Functionality: 8.5
The code creates a number of quick and easy to use tools in a straight forward menu. The functionality of the tools when the selection is done right, but does not offer the user much feedback when they do something wrong. Helping the user with some more messages will increase the usability of the tool. More of a nice to have would be if the script checked if the menu was already created before attempting to create it again.

Design: 8
Each element of the menu is broken up into single functions and supported by smaller helper functions in a logical manner. The design is not tightly coupled to the interface and does well to avoid the use of globals or state information and almost runs entirely as stateless functions. Some of the code looks like it could be broken down into a few more logical pieces (such as those that get the selection and filterExpand), but otherwise shows minimal code duplication.

Style: 6
The code unfortunately is quite difficult to read in some places due to spacing and some of the inconsistencies with indentation (or in some cases, no indentation). This makes the code especially hard to read when it is a few nested levels deep and all the brackets for the nesting are in the same leftmost column. The code initially makes use of larger header and footer comments to distinguish between functions, but does not follow this consistently throughout the code. The comments are not entirely consistent with the code, and a number of forward slashes are used to separate parts of functions. The function names vary between camelCase and PascalCase, but are still somewhat logical. The use of whitespace is inconsistent in terms of indenting and spacing.

Documentation: 6.5
The user documentation points to a link that no longer exists http://www.maya3d.dk/MEL/MJPolyTools/MJPolyTools.htmwhich is unfortunate, since I feel that it would help share some insight into what is happening in the code. The code does not include any information about how it is to be used, but does follow the standard “source scriptFileName” MEL paradigm. The code does have some comments, but it would help to have more.

Reusability: 7
Due to the good design of the code into small separate functions, the code could well be reused in other ways as the functions are available to be called directly without going through the user interface. The code may benefit from some cleanup to make it consistent and easier to follow in a few places should any bug fixes be required.

Overall: 7
The functionality is really what shines through on this script, and while some of the tools may now have similar counterparts in later versions of Maya, the tools being in one easy to use menu are quite nice. Overall it seems a useful set of tools, and worth playing around with a bit more.

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

Leave a Reply

Your email address will not be published.