This snippets adds in new passes… for now, it’s just connecting an Ambient Occlusion pass
string $passPrefix = $charName;
print(“Pass Prefix: ” + $passPrefix + “\n”);
setAttr “defaultRenderGlobals.imageFilePrefix” -type “string” $passPrefix;
string $defaultLICPasses[];
$defaultLICPasses = {“ambientOcclusion.mel”, “diffuseMaterialColor.mel”, “diffuseWithoutShadows.mel”, “reflection.mel”, “shadow.mel”, “specular.mel”};
string $shortPasses[];
$shortPasses = {“AO”, “DIFRAW”, “DIFFNS”, “REFL”, “SHD”, “SPEC”};
int $numDefPasses = size($defaultLICPasses);
print(“Num Default Passes: ” + $numDefPasses + “\n”);
int $j;
//edited to only go through once, so it only adds the ambient occlusion pass
for($j = 0; $j < 1; $j++)
{
createNode renderPass;
string $melScriptPath = “/sww/tools/aw/maya2011-sp1/presets/attrPresets/renderPass/” + $defaultLICPasses[$j];
//print(“Mel Script Path: ” + $melScriptPath + “\n”);
string $noMelPass = `substitute “.mel” $defaultLICPasses[$j] “”`;
//print(“Pass without suffix: ” + $noMelPass + “\n”);
string $capPassName = `capitalizeString($noMelPass)`;
string $renamePass = $passPrefix + $capPassName;
//print(“Rename Pass To: ” + $renamePass + “\n”);
rename “renderPass1” $renamePass;
setRenderPassType -type $shortPasses[$j] $renamePass;
string $addPassName = $renamePass + “.owner”;
print(“Add Pass Name: ” + $addPassName + “\n”);
connectAttr -nextAvailable defaultRenderLayer.renderPass $addPassName;
}
//turns on Alpha channels for each pass
stringĀ $allPasses[] = `ls -type renderPass`;
stringĀ $eachPas;
for ( $eachPass in $allPasses)
{
//print ($eachPass + “\n”);
string $passChan = $eachPass + “.numChannels”;
print ($passChan + “\n”);
setAttr $passChan 4;
}