Categories
code of the day cotd maya python

Code of the Day: Playblast Window

Playblast Window 0.0.2 script by Seamus O’Hearn: http://www.creativecrash.com/maya/downloads/scripts-plugins/camera/c/playblast-window

Playblast Window 0.0.2is a simple script UI for creating specific playblast options.

Language: Python
Type: Maya Editor Script
Script Files: 1
Number of lines: 119

Functionality: 4.5
The code only offers a few options, mostly related to size which isn’t a lot considering that many studios want to display certain elements or use certain compressions, formats etc. The code writes specifically to qt, with compression “H.264”, everything off in the display except for polymeshes (with an option for ornaments) and using frame padding = 4. If those are the desired specs (with options for quality and size in the UI), than perhaps the functionality is enough. There do seems to be issues when attempting to add a file path (such as .avi) where the code cuts the last two digits off, the code should instead split on the . or preferably use os.path.splitext. It also looks like the code removes any spaces in directory names, which can invalid paths such as when used for example on a path that include “Program Files”.

Design: 5.5
The code base is quite very small, and the functions are separated into UI, getting the file path and initializing the playblast. The code could be split into a few more functions and do a bit more error checking. Attempting to cancel out of the directory selection generates an error. In the UI there is a large warning mentioning which camera to use which is fine, but instead of the message, setting the camera and panel as options may be more intuitive and reusable.

Style: 5
The code comments itself says “it’s pretty sloppy”, which is honest. Overall, python by its nature does a pretty good job of keeping indentation and formatting similar, but there are a few places where variable names (such as “TheMagicalDirectory“) are a little unusual and may not be entirely clear. The code only saw 12 style errors when run against pep8, but for the size of the file that is approximately 10%.

Documentation: 6.5
The code documentation in the header is pretty good. The code itself seems to be a bit overly commented (two of the functions have every line commented). In a few places the comments are useful, however in other places such as the example below, they are not necessary, and end up just cluttering the code.

#printed statement
print(“Saved To”)

Reusability: 5.5
The code base is tiny so it will be easy to maintain and extend. There are a few places that should have error checks, and the file extension code should be modified as I mentioned.

Overall: 4.5
Overall, the script is just too specific and with a few too many errors on basic use to be too reusable. I imagine that certain studios/artists would use it if there needs exactly matched the specifics of this file, but otherwise needs a few more options for widespread use (perhaps enabling the artist to choose to use the current playblast and/or modelPanel settings to override the builtin script settings).

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

Leave a Reply

Your email address will not be published.