code of the day cotd

Code fo the Day: AKS_LightRay

More creative crash site today, I looked at the AKS_LightRay script by Kilik:–2

This script is a neat little tool for creating light rigs based on existing vertex selection. The built-in option is to use the vertices of a sphere to create a Global Illumination (GI) setup, but could be used on any number of light rigs. The tool uses a ramp or texture for the light color which is a nice feature to create HDR lighting.

Language: MEL
Type: Maya Editor Script
Script Files: 3
Number of lines: 2255

Functionality: 7
The functionality is quick and intuitive to use, and the error messages help guide the user down the correct path. The tool allows the user to create a custom light rig and adjust the ramp and color settings, in a short amount of time. The UI itself however seems to be a little stretched in places making the options hard to read and update. I suspect that since this was written in an older version of Maya certain UI elements may behave differently.

Design: 7
The code is logically separated into different files and for the most part functions. Some of the functions (especially the UI creation) are quite long and would benefit from separation into smaller encapsulated functions. The code does a good job of maintaining the original settings (such as the renderSettings) when performing a task making sure that Maya returns to the previous state. I prefer not to see the use of evals, but when combined with the scriptJob, it is understandable.

Style: 6.5
Some of the spacing and indentation is inconsistent and the indentation of the UI makes it somewhat difficult to understand the structure of the hierarchy. The code has comments which separate out pieces of the UI, but really splitting these into separate functions would make the code a lot easier to read.

Documentation: 8.5
The in code documentation is appropriate, and the package comes with both an install document and a help file which are quite helpful. I found for Maya 2012 the install needed to run aks_lightRay instead of aks_lightray.

Reusability: 6
A few of the functions could be maintainable and reusable, but unfortunately a number of elements (such as the scriptJobs) are tightly coupled with the rest of the naming conventions and structure of the code.

Overall: 7
The functionality is a nice approach to creating a light rig and the results of the ramp and vertex selection for creation are a nice way of creating a light setup quickly. The issues with the UI are a bit of an inconvenience, but I would rather have useful functionality than a pretty UI (and minimal functionality) any day. Interesting in that there are not a lot of tools that seem to work based on vertex selection for creation, and the documentation is rather helpful as well.

Until next time,
Michael Hubbard

Leave a Reply

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