Wow, it seems this script has attracted quite a bit of attention
Here is a fixed version that will allow rendering in multiple renderers, as well as work in Maya 2011!
// Batch rendering workaround - John Mather (NextDesign)
string $filename = "render";
string $cameraName = "persp";
int $startFrame = 1;
int $endFrame = 3;
string $directory = (`workspace -q -rd` + "images/");
for ($i = $startFrame; $i <= $endFrame; $i++)
// Old version
// render -x `getAttr defaultResolution.width` -y `getAttr defaultResolution.height` $cameraName;
// New version - supports MR and other renderers!
renderWindowRender redoPreviousRender renderView;
string $concatFilename = $directory + $filename + "." + $i;
if (`getApplicationVersionAsFloat` >= 2011)
// Thanks to nowayfra on creativecrash for his workaround
catch(eval(renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`)));
renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);
print ("Saved " + $concatFilename + "\n");
print ("Completed rendering of " + ($endFrame - $startFrame) + " frames.\n");
P.s. Many thanks goes out to nowayfra on CreativeCrash for his Maya 2011 fix! (http://www.creativecrash.com/forums/...on_post_306312
Edit: Fixed a small bug that would stop all frames from being rendered.
Imagination is more important than knowledge.