Pages

Saturday, January 28, 2012

Code of the Day: Non Photo Realistic Shading Maya

Non Photo Realistic Shading Maya 0.7.0 script by yinako: http://www.creativecrash.com/maya/downloads/scripts-plugins/rendering/misc/c/non-photo-realistic-shading-maya

Non Photo Realistic Shading Maya 0.7.0
is a script to setup shading networks for a anime/toon look, by using a series of ramps.

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

Functionality: 6.5
The script offers a few options: name of the shader, bright and dark colors, the number of color bands, shading type and building the specular. Some additional options would be nice (such as choosing a few extra colors (perhaps highlight color, a few middle colors and shadow color) but otherwise can give some good results with what is available.

Design: 6
The script is only two functions (one for UI, one for processing UI and creating the shader network). The first function is fine, but the second function may benefit from being broken up into separate functions. The creation and joining of the specular node could easily have been a separate function instead of a long if statement. By having everything in the main process function, it introduces a lot of variables as well for such a small script.

Style: 6.5
The code is well commented, and makes good use of whitespace and appropriate variable names. It would benefit from creating separate functions instead of using comment blocks to separate logic, but in such a small script it is hard to rate that too heavilty. There are a few magic numbers (especially in the creation of the spec ramp) which may be nice to add as options to the UI instead of being hardcoded into the script.

Documentation: 7.5
The documentation is easy to follow and provides a good amount of information. The source code has quite good comments as well, and makes it easy to follow what the code is doing as the comments are pretty descriptive.

Reusability: 7.5
The script is tiny and thus would be very simple to maintain, however it would require some additional work to extend functionality, and would benefit from some additonal separation of logic. The creation of the shading network is fairly self contained (as the function takes no parameters), however, it would be fairly easy to refactor this code to make it more extendable, based simply on the size of the code base.

Overall: 6.5
The script is small but gives a nice starting point for anime/cartoon shading using ramps. Likely it would be more useful with a few more options, but as it stands, the results are pretty good, and would work for a certain look.

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

Friday, January 27, 2012

Code of the Day: AniMan

AniMan 1.4 script by manus: http://www.creativecrash.com/maya/downloads/scripts-plugins/animation/c/-animan

AniMan 1.4 is a toolset for creating procedural and rig skeletons through a UI interface. It has a number of options that are unique to the tool, such as adding wing, tentacle or tail rigs, options to create 2 or 4 arm rigs and a few more options. It is also interesting in that the majority of functionality is not a completely separate interface but is built into the ChannelBox.

Language: MEL
Type: Maya Editor Script
Script Files: 137
Number of lines: 23164

Functionality: 7.5
There are lots of functions and a number of unique features which is interesting to see. Unfortunately, with so many things in the tool, it does not give very much information about how to guide the user, and the error messages are not very clear about what mistakes where made (usually involving something like a "Error: No object matches name: " which sometimes causes the progress bar to also freeze). The tool also has a pose library which also would benefit from some better debug messages to help guide the user in what mistakes they are making (or where in the code to look).

Design: 6.5
The code is broken up into a number of files, and while I do think this is a better design than a monolithic approach, it seems like a number of files only contain a single function, and in some cases the function body is a single line. While the focus on small functions is ideal, so is grouping logical functions together in the same file. For example, all standalone string manipulation functions, all LegIK, or BackFK, or ArmIK could be grouped together in the same file, especially since there is a number of areas of code duplication between the files.

Style: 7.5
The code style is pretty good, although I find the commenting structure a bit odd (where the comments are not nested with the same spacing as the rest of the code), but otherwise fine. The code does make use of mostly small functions and does a good job of commenting the code internal workings, and uses good descriptive names for variables and functions.

Documentation: 6.5
The code documentation is good, but with the website down, it makes it more difficult to understand how the functionality is supposed to be used. Overall, the code gives some good info into the structure, but would also benefit from giving some more explicit error messages to the user to help guide what went wrong.

Reusability: 7
The script would likely be easy to maintain once you had a better handle on what every file does. The code base isn't huge, and for the most part has a number of areas that could easily be reused. Global variables are kept to a minimum and there is a good separation of logic between the UI and rest of the functionality. As I mentioned there is a bit of code duplication which may result in the same bug fix in a number of places, but otherwise is fine.

Overall: 7
The tool offers a number of intersting functions and has some powerful features. This is a toolset that does require a bit of a learning curve to figure out how it is supposed to be used, but the results are interesting and does offer some unique attributes not seen in other pieces. With a little more guideance to minimize user's ability to make an error (or guiding them through their mistakes) it would be quite a useful tool, although I realize the ChannelBox approach might not be everyone's favorite.

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

Thursday, January 26, 2012

Code of the Day: Pose 2 Shelf

Pose 2 Shelf 1.1 script by boymaya: http://www.creativecrash.com/maya/downloads/scripts-plugins/c/pose-2-shelf

Pose 2 Shelf 1.1 is a script that allows the artist to save either selection information or set attribute information as a button on the shelf.

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

Functionality: 7
There are really only two major functions in the UI (with the option of adding a label), but the script is quite powerful in that it gives a nice and quick to use result.

Design: 8
The code has a bit of duplication in the creation of the shelf buttons and moving some of the additional checking code could be even more concise and reusable if the duplicate code in creating the shelfbutton was moved to a separate function. Otherwise the code does a good job in keeping the logic into appropriate functions and encapsulates the functionality well in each of these.

Style: 8
The code style is pretty structured and the use of whitespace and comments is quite consistent. There are a few places where a bit more or less empty lines may help improve the spacing of the code, but otherwise it is quite well done. A few additional comments in the code would be nice, but otherwise is quite good.

Documentation: 6.5
The code documentation is ok is simple and effective. Some additional comments in the code would be nice, and while the use of ALL CAPS in the documentation is a little unusual, it is eye catching for those that only glance casually at the content.

Reusability: 8.5
The script is tiny and powerful, with a little additional refactoring, it is likely this script could be even smaller and more powerful. Maintenance on this code would be very easy, as it is quite logical and is great in it separation of interface and the rest of the code logic.

Overall: 8.5
The code is pretty powerful and offers a nice option for those looking for something lighter and simpler than the complex selection and pose libraries from other solutions. If you need to create a lot of selections or poses it may not be the best approach as the shelf will grow very quickly, but for quick and rapid use, it is very nicely done.

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

Wednesday, January 25, 2012

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
http://michaelhubbard.ca

Tuesday, January 24, 2012

Code of the Day: Puppet Master

Puppet Master 1.7.0 script by blackholestudios: http://www.creativecrash.com/maya/downloads/scripts-plugins/character/c/puppet-master--2

Puppet Master 1.7.0 is a biped rig creator which uses locators to map out the joints.

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

Functionality: 7.5
There are only a few options (IK/FK, stretchy spine, strechy arms, strechy legs) and options for naming the character, but the end result produces a nice fairly complex rig. There are a number of additional tools and options once the rig has been created (for setting up different controller (eye, hand, foot etc.) as well as options for moving and rotating the controls.

Design: 4.5
Simply put the main "BuildRig" function totaling 3772 lines and having ~200 unique variables is massive. Unless this was done in an attempt to significantly optimize some piece of the design that I am missing, it makes this script very, very difficult to follow and makes the overall code become incredibly complex from this design. This is not the only function in the program, but it makes me wonder why such a complex lengthy function is used as the rest of the functions seem to have a singular purpose and be better encapsulated.

Style: 5
The code variable names are appropriate, and the code uses comments to help organize areas of the code. The spacing is a little inconsistent however (both tabs and spaces) and a number of places have very large indentations (ending up 32 spaces deep for one level of nesting). The code would benefit from breaking apart the large function (perhaps into separate files even) and there are a number of areas where closing brackets are used at inconsistent column placement to help try to organize logical breaks in the code, but this often makes the reader wonder where the closing bracket for the statement is located when the column spacing of the end bracket does not match up (and is instead lined up with a higher level scoping.

Documentation: 7
The documentation is easy to setup, and there are a number of comments throughout the code (which also serve as logical breaks when reading the function(s)). A little additional commenting would be useful, as especially in areas where there are so many things happening at once. I was unable to find the links to the documentation mentioned in the code, so won't post them here, but it would be nice to see what additional information was available for this script.

Reusability: 3.5
This script is very difficult to follow with so much going on in the main function, and thus it becomes very difficult to update or maintain. With so many variables at play, and so many attributes being created and set, debugging any issue would become very problematic and may require a lot of print statements (as can seen by the commented out print statement in a few places).

Overall: 6
A few additional options would be nice to have, and I am curious about the vehicle rig mentioned as "Coming Soon". The use of locators to place the rig points is a good approach, and the end resulting rig is quite complex and interesting. Some additional options would be nice to have, but otherwise this script gets by more on its end results then anything else.

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

Monday, January 23, 2012

Code of the Day: AutoSave

AutoSave 1.0.4 script by NicoMaya: http://www.creativecrash.com/maya/downloads/scripts-plugins/interface-display/c/auto-save

AutoSave 1.0.4 is an option for enabling a scriptJob to fire on "selection change" or "recent command change" and options for how many hours, minutes and seconds to perform and autosave.

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

Functionality: 8
The options are useful, and the ability to set such specific increments of time makes the script quite useful for artists that have different work schedules, or allowing it to be tweaked for certain types of work. The use of scriptJobs is expected here, and the code base is quite good about checking for its use.

Design: 7
The structure of the code is quite organized, although a few functions appear to do a little bit more (or in some cases less) than I would expect. The code base is quite organized, although in a few cases I felt that the use of eval may not be necessary, and would make the code a bit easier to follow.

Style: 8
The code is quite organized, and the use of whitespace makes the code easy to follow. There are a few areas (such as the use of cases with 0, 1, 2) that could be a bit more descriptive, but the variable names are descriptive and appropriate. A few areas of the code would benefit from additional comments. but the overall structure helps reveal the structure of the code.

Documentation: 8
The documentation is quite easy to follow and has information for various operating systems, which is helpful. It would be helpful to have additional comments within the code, but the code base is quite small and functions fairly descriptive so it is not quite as necessary.

Reusability: 8
The use of scriptJobs and evals makes the code more difficult to reuse in parts, but a few areas are quite logical and would be easy to maintain. Additional comments would help make the code easier to maintain, but with the code base being so small, it would not be much of a problem.

Overall: 7.5
The functionality is quite helpful for those looking for an auto save, and has some nice features in setting the time which would certainly help different people who work at different speeds. Some additional options for doing auto incremental saves would be nice to have. The use of selection or tool change is a good approach, although in python a threaded approach may also be an optional and perhaps more consistently timed way to approach the problem.

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

Sunday, January 22, 2012

Code of the Day: Tree Generator

Tree Generator 1.4 script by nitisara: http://www.creativecrash.com/maya/downloads/scripts-plugins/modeling/misc/c/tree-generator

Tree Generator is a nice option for random generation of NURBS trees. There are quite a number of options to create the trunk, roots, branch and adding leaves from a Maya.

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

Functionality: 9.5
The tool creates a number of options to create a nice tree, with quite a number of options to generate the random tree. The code does generate a lot of NURBs objects, which would be nice to either combine or have options to generate polygons instead. The tool allows quite a bit of functionality in terms of customization and extension, and it allows custom leaves to be created and used. The option of loading and saving presets is especially powerful, and the tool comes with a number of useful options for creating trees.

Design: 7
The code base is fairly small but powerful. The code does however make use a significant amount of global variables (counted at least 66), and would benefit somewhat from additional encapsulation. The tool creates a new scene each time which is a little unusual, and while the animation in producing the tree is neat to see, I would prefer that the tool have options to disable this as well. Some of the code seems to do quite a lot, and some smaller more encapsulated functions would help benefit the structure.

Style: 8.5
The code makes quite good use of whitespace and the variable names were quite appropriate and easy to follow. In a few cases the same variable name was used for different values (mostly in loop iterators) but otherwise is pretty good.

Documentation: 9
The documentation is quite helpful and explains all of the options in the UI. There Readme.txt was helpful and gave a good overview of the overall functionality of the code.

Reusability: 6
The code is tightly coupled to the UI and has a significant number of global variables (although most are treated as constants). The code makes use of a number of switch statements which is what makes the code more difficult to extend or change.

Overall: 9
The functionality produces a nice result, although with a few tweaks additional options on the type produced (combined polygon mesh would be nice), and the ability to turn off the animations (to speed up the end result), it would be even more impressive. It would also be helpful if the tool allowed branches and leaves to be created without roots, as they are not always necessary.

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