Categories
code of the day cotd

Code of the Day: FileTextureManager

Continuing on with more creative crash site today (more game programmer code at some point), I looked at the TextueFileManager script by Crow Yeh|Feng Ye: https://www.creativecrash.com/maya/downloads/scripts-plugins/c/filetexturemanager

This script has functionality to analyze a Maya scene’s current textures and move and update texture paths. This includes renaming each texture path with a variety of prefix, suffix, replace strings and pathing options.

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

Functionality: 8.5
The code offers quite a lot of functionality in organizing and renaming textures. The options are quite straightforward and easy to use, and have nice options for copying, moving and renaming textures quickly and efficiently.

Design: 6.5
The code does make use of a couple of global variables that might be able to be encapsulated in a different way. The UI is closely coupled with some parts of the functionality and a number of functions have a lot of functionality. Some of the functions are quite long and complex, and would benefit from smaller functions with a singular purpose. Some additional error checking would appropriate in a number of cases. Some of the nesting of loops and if statements can get quite deep (over 10 levels deep in at least one case).

Style: 6.5
Some elements of the code are nicely organized, however the use of whitespace is a little inconsistent. The indentation of functions and nesting is a little unusual, and is not uniform throughout the code base. Some elements do attempt to show the UI hierarchy which is somewhat helpful, but coupled with a very long function makes some of the code difficult to read and understand.

Documentation: 9
For the most part the documentation is very straightforward and easy to understand. The comments within the code are also helpful, and the inclusion of a help section in the UI is very useful. The header documentation is clear, helpful and well organized.

Reusability: 7
There are a number of functions that can be used in isolation, which also helps with maintainability. Unfortunately, a number of major functions that would be candidates for specific reuse are tightly coupled with the UI, or are simply too long and complex to be candidates for reuse.

Overall: 8
This tool set offers a nice set of options for manipulating textures and texture paths. This tool would especially be useful for people who have to update texture paths to new naming conventions, and a similar feature set would really be helpful to run in a batch mode. Overall, there are a nice set of options and the functionality are really what make this script useful.

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

Leave a Reply

Your email address will not be published.