Categories
code of the day cotd

Code of the Day: Make Fire

Make Fire 1.0 script by nc16: http://www.creativecrash.com/maya/downloads/scripts-plugins/dynamics/c/make_fire–2

Make Fire 1.0 is a quick and easy script for adding a nice fire fx to a surface object.

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

Functionality: 6
There are very few options (initial size and resolution creation) as well as a simple help option, but the end result produces a nice result attached to a surface object. In some ways the script does not need all the functionality as the fluid node that is created makes it easy to use.
For some systems, if you get the error: “Cannot find procedure “create3DFluid” you may have to source the file before running the script.

// Run the following code before sourcing (or after resourcing the make_fire script)
source “create3DFluid“;

Design: 7
The design is quite straightforward, and at such a small file size does a good job of making it quite easy to use. The functions are separated to make the each entry encapsulated, and does a pretty good job of separating most of the UI from the from the rest of the code, but it would be even nicer if the code was entirely separate (grabbing the UI values and passing them into a separate function rather then within the same function). The script does use a lot of magic numbers which while give a good result, are not quite as maintainable as parameters or variables.

Style: 6.5
The naming conventions are pretty good, but unfortunately the spacing and whitespace usage are quite inconsistent and just becomes a bit muddy. The overall elements and use of comments make it fairly clear to read, and with such a small code base every issue is a bit more magnified since it is hard to consider these anomalies.

Documentation: 7.5
The code documentation is quite straightforward and comments most elements of the code in a helpful way. The header comments are straightforward and to the point and the help menu is useful, even though it uses fairly casual language and format.

Reusability: 7
With only a few functions and very few parameters it would require refactoring to extend or reuse any functionality. In terms of maintainability, the script is tiny, which makes it very easy to maintain/debug or update as necessary.

Overall: 6
The script produces a nice result, although I imagine that some presets would also produce something similar. The attachment to the surface is a fine approach, and overall the script does a nice job. It would be nice to have a few additional options, but otherwise is short and sweet.

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

Leave a Reply

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