Code Thumbnails

Update - The thumbnailer script now works with all three thumbnail sizes. Just pass in #small, #medium, or #large (defaults to #medium if ommitted) to create thumbnails of the indicated size.

Screenshot of code thumbnails
A screenshot showing what code thumbnails look like.

Director is good at presenting you with visual thumbnails of graphics assets for management using the cast window, but the thumbnails it uses for script items arent's so easy on the eye. Also, the script type divisions are crude at best - if you have member type icons turned on, you get a visual differentiation between movie, behavior, and parent scripts, and that's about it.

A better way to organize scripts is based on a color scheme that works to apply color labels to particular types of scripts for your project. For instance, if you're using a model-view-controller model, it might be handy to color-code the models, views, and controller scripts separately.

Unfortunately, there's no easy way to do this in Director. Until now. Below is a little script that will create thumbnails for your scripts to make them easier to browse.

It works by scanning through all the script members in your casts and checking their names against a list of predefined prefixes. In my case, I used "Model:", "View:", "Controller:", "Utility:" and others. When it finds members with known prefixes, it looks up the related colors, renders the thumbnail, and applies it.

To use it yourself, first make sure you have installed the awesome and free Silkscreen small-format font, as this is the font the thumbnails use. Then, just cut and paste the below code into a movie script member, tweak the prefixes and colors if desired, and invoke the makeThumbnails() command. Whenever you add a new script with a given prefix, run it again to bring everything up to date.

If you're worried about the filesize overhead of these thumbnails, all you have to do is invoke clearThumbnails() before your final publish, and it will clear out the thumbnails. You can strip out and recreate the thumbnails at will using these routines.

As usual, this is just a quick-and-dirty script that helps you during authoring. You can probably improve on the script considerably if you want some other features. For instance, perhaps your workflow uses suffixes instead of prefixes. Just don't spend too much time on it - this script is supposed to save you time!

Made on Mac