Maya Rendering Script

This is a mental ray rendering using maya. My components probably have too many faces that even maya software crushes when trying to render out the images. For heaven’s sake, just how difficult is it to take some screen shot of what you already have in the preview mode to the output format. It’s making me sick. Anyways, here’s the solution that helped me a lot from CGTalk. Thanks for whoever came up with this awesome solution.

global proc renderIt()
global string $fileName;
global int $end;
global int $sta;
setAttr -type "string" defaultRenderGlobals.imageFilePrefix $fileName;
setAttr "defaultRenderGlobals.startFrame" $sta;
setAttr "defaultRenderGlobals.endFrame" $end;
setAttr "defaultRenderGlobals.outFormatControl" 0;
setAttr "defaultRenderGlobals.putFrameBeforeExt" true;
setAttr "defaultRenderGlobals.periodInExt" 2;
setAttr "defaultRenderGlobals.animation" 1;
setAttr "defaultRenderGlobals.animationRange" 1;
setAttr "defaultRenderGlobals.extensionPadding" 3;
setAttr "defaultRenderGlobals.byFrameStep" 1;
setAttr "perspShape.mask" 1;
setAttr "perspShape.depth" 0;
currentTime $aa ;
setCurrentRenderer mentalRay;
renderIntoNewWindow render;

print "Rendering completed in tmp directory !";

global int $sta = 0;
global int $end = 25;
global string $fileName;

string $fileNameee = "$fileName = `textField -q -text fileName`";
string $startFrameee = "$sta = `textField -q -text startFrame`";
string $endFrameee = "$end = `textField -q -text endFrame`";

if (`window -exists renderIt`)
deleteUI renderIt;
-resizeToFitChildren on
-sizeable off
columnLayout -columnAttach "both" 10 -rowSpacing 0 -columnWidth 400;

text -label "Filename:";
textField -width 25 -text $fileName -cc $fileNameee fileName;
text -label "Startframe:";
textField -width 25 -text $sta -cc $startFrameee startFrame;
text -label "Endframe:";
textField -width 25 -text $end -cc $endFrameee endFrame;
button -label "Render Scene" -c "renderIt" -bgc 1 0 0;

showWindow renderIt;