// batchRenderRI.mel
// See also batchrender.py, batchdatabase.py and batchrif.py
// Specifying rifs must be done with care, for example,
// batchRenderRI("rif_it ; rif_AB.Rif(1,2)", 1,1);
// or
// batchRenderRI("rif_it.Rif() ; rif_AB.Rif( 1,2 )", 1,1);
// or
// batchRenderRI("rif_it.Rif() ; rif_AB.Rif( [1,2] )", 1,1);
//
// Rif modules, such as rif_AB, that accepts one or
// more inputs MUST do so via a list. The __init__ method shown below uses
// a single input called arg_list.
//
// class Rif(prman.Rif):
// def __init__(self, ri, arg_list):
// # code omitted
//
//
// Started: 22 Jan 2013
// Edited: 15 Aug 2014.
// Uses "untitled" if the scene has not been saved. In preparation
// for RMS19/RIS we now use rmanGetGlobals to return either,
// renderManGlobals (Reyes) or renderManRISGlobals (RIS)
// 25 Sept 2016.
// Can now handle render layers.
// Malcolm Kesson
global proc batchRenderRI(string $rifstr, int $genrib, int $do_render)
{
string $projPath = `workspace -q -rootDirectory`;
string $sceneName = `file -q -sceneName -shortName`;
string $scene = "'" + (size($sceneName) == 0 ? "untitled" : $sceneName) + "'";
string $proj = "'" + $projPath + "'";
int $begin = `getAttr "defaultRenderGlobals.startFrame"`;
int $end = `getAttr "defaultRenderGlobals.endFrame"`;
int $anim = `getAttr "defaultRenderGlobals.animation"`;
int $index = `getAttr renderLayerManager.currentRenderLayer`;
string $layers[] = `listConnections renderLayerManager`;
string $layer = $layers[$index];
string $preferredRman = `rmanGetGlobals`;
int $motion = `getAttr ($preferredRman + ".rman__torattr___motionBlur")`;
// Single frame mode...
if($anim == 0) {
$begin = `currentTime -q`;
$end = `currentTime -q`;
if($motion) {
print("Motion blur is active.\n");
setAttr "defaultRenderGlobals.endFrame" ($end + 1);
}
}
$rifs = "'" + $rifstr + "'";
print("Current Rman " + $preferredRman + "\n");
print("Scene Name: " + $scene + "\n");
print("Project Path: " + $proj + "\n");
print("Start Frame: " + $begin + "\n");
print("End Frame: " + $end + "\n");
print("Render Layer: " + $layer + "\n");
print("Immdiate Render: " + $do_render + "\n");
print("Rif Module(s): " + $rifs + "\n");
//------------------
// Uncomment one or both of the next two lines if you wish to avoid the use of
// RenderMan Look Files and/or zipped archives.
//rman setPref DisableRifShaderAttachment 1;
//rman setPref DisableCacheInZip 1;
//------------------------
// Generate the ribs...
if($genrib == 1)
rman genrib -layer $layer;
string $args = $scene + "," + $proj + "," + $begin + "," + $end + ",\"" +
$layer + "\"," + $do_render + "," + $rifs;
$batchstr = "import batchrender\n";
$batchstr += "reload(batchrender)\n";
$batchstr += "batch = batchrender.BatchRender(" + $args + ")";
print("Executing python: \n" + $batchstr + "\n");
python($batchstr);
}