// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // Creation Date: Feb 26, 2008 // // Procedure Name: // AErenderPassTemplate // // Description: // Creates the attribute editor controls for the renderPass Node // // Input Value: // nodeName // // Output Value: // None // // bring in the necessary procedures for the color profile controls source "colorProfileProcedures"; proc string getParentMenu(string $menuName) { //look for correct parent // string $curParent = `setParent -q`; string $menu = ($curParent+$menuName); return $menu; } //set the attribute "NumChannels" // global proc setNumChannelsAttr(string $menu, string $numChannelsAttr) { int $selectedItem = `optionMenuGrp -q -v $menu`; string $cmd = "setAttr " + $numChannelsAttr +" " + $selectedItem; evalEcho($cmd); } //insert $value into the array //if the $value has existed in the array, it will not be inserted into the array // global proc insertIntArray(int $array[], int $value) { int $i; for($i = 0; $i < size($array); $i++) { if($value == $array[$i]) return; } $array[size($array)] = $value; } //Called by AErenderPassTypesNew andAErenderPassTypesReplace // global proc updateRenderPassTypesMenus(string $menu, string $passIDAttr) { string $buffer[]; tokenize($passIDAttr,".|",$buffer); if(`attributeExists $buffer[1] $buffer[0]` == 0) return; //obtain the render pass types supported by the current renderer // string $renderPassTypes[] = `renderPassRegistry -supportedRenderPasses`; string $renderPassNames[] = getSortedRenderPassTypeList(""); string $passIDValue = `getAttr $passIDAttr`; if(size($passIDValue) != 0) { //after changing renderer from A to B, although the passID's value may be not //supported by B, the pull down menu will also display the passID's value. // if(stringArrayContains($passIDValue, $renderPassTypes) == 0) { string $passName = `renderPassRegistry -passID $passIDValue -passName`; //If the pass does not have a name, display its ID in the menu // if(size($passName) == 0) { $passName = $passIDValue; } $renderPassTypes[size($renderPassTypes)] = $passIDValue; $renderPassNames[size($renderPassNames)] = $passName; } } else { //insert tips when the value of passID is null // string $selectTypes = (uiRes("m_AErenderPassTemplate.kSelectTypes")); stringArrayInsertAtIndex(0, $renderPassNames, $selectTypes); } int $i; //rebuild the menuItems now // setParent -m ($menu+"|OptionMenu"); string $menuItems[] = `optionMenuGrp -q -ils $menu`; int $numMenuItems = size($menuItems); for ($i=0; $i 0) optionMenuGrp -e -v $renderPassNames[0] $menu; } if(size($renderPassNames) <= 1) optionMenuGrp -e -en 0 $menu; else optionMenuGrp -e -en 1 $menu; } global proc setPassIDAttr(string $menu, string $passIDAttr) { //get the nodeName // string $buffer[]; tokenize($passIDAttr,".|",$buffer); string $nodeName = $buffer[0]; string $renderPassTypes[] = `renderPassRegistry -supportedRenderPasses`; string $selectedPass = `optionMenuGrp -q -v $menu`; for ($id in $renderPassTypes) { string $name = `renderPassRegistry -passID $id -passName`; if ($name == $selectedPass) { string $cmd = "setRenderPassType -type " + "\"" + $id + "\" " +$nodeName; evalEcho($cmd); break; } } } global proc AErenderPassTypesNew(string $passIDAttr) { //get the nodeName // string $buffer[]; tokenize($passIDAttr,".|",$buffer); string $nodeName = $buffer[0]; //build the optionMenuGrp // string $menu = `optionMenuGrp -label (uiRes("m_AErenderPassTemplate.kTypes")) TypeMenu`; optionMenuGrp -e -cc ("setPassIDAttr "+$menu+" "+$passIDAttr) $menu; //build optionMenuGrp // updateRenderPassTypesMenus($menu, $passIDAttr); //build the call back mechanisms // string $cmd = "updateRenderPassTypesMenus " + $menu + " "+ $passIDAttr; scriptJob -rp -p $menu -attributeChange defaultRenderGlobals.currentRenderer $cmd; scriptJob -p $menu -attributeChange $passIDAttr $cmd; } global proc AErenderPassTypesReplace(string $passIDAttr) { // get the nodeName // string $buffer[]; tokenize($passIDAttr,".|",$buffer); //get parent // string $menu = getParentMenu("|TypeMenu"); optionMenuGrp -e -cc ("setPassIDAttr "+$menu+" "+$passIDAttr) $menu; //build the optionMenuGrp // updateRenderPassTypesMenus($menu, $passIDAttr); //update the optionMenuGrp and callback mechanisms string $cmd = "updateRenderPassTypesMenus " + $menu + " "+ $passIDAttr; scriptJob -rp -p $menu -attributeChange defaultRenderGlobals.currentRenderer $cmd; scriptJob -p $menu -attributeChange $passIDAttr $cmd; } //will be called by AEnumChannelsNew andAEnumChannelsReplace // global proc updateNumChannelsMenus(string $menu, string $numChannelsAttr) { string $buffer[]; tokenize($numChannelsAttr,".|",$buffer); if(`attributeExists $buffer[1] $buffer[0]` == 0) return; //obtain the numbers of channels supported by the current renderer // int $channelsNums[]; int $numChannelsValue; string $passIDAttr = $buffer[0]+".passID"; string $passIDValue = `getAttr $passIDAttr`; //check $passID // if(size($passIDValue) != 0) { $channelsNums = `renderPassRegistry -passID $passIDValue -supportedChannelCounts`; } //although the current renderer does not support the value of numChannels, //we also display the value. // $numChannelsValue = `getAttr $numChannelsAttr`; insertIntArray($channelsNums, $numChannelsValue); $channelsNums = `sort $channelsNums`; int $i; //rebuild the menuItems now // setParent -m ($menu+"|OptionMenu"); string $menuItems[] = `optionMenuGrp -q -ils $menu`; int $numMenuItems = size($menuItems); for ($i=0; $i