global proc alienRenderRegionInfo () { if (!`objExists mentalrayGlobals` ) { warning "Node mentalrayGlobals doesn't exists."; return; } int $rectY; int $rectX; int $rectWidth; int $rectHeight; if (`attributeExists "regionRectX" mentalrayGlobals`) { $rectY = `getAttr mentalrayGlobals.regionRectY`; $rectX = `getAttr mentalrayGlobals.regionRectX`; $rectWidth = `getAttr mentalrayGlobals.regionRectWidth`; $rectHeight = `getAttr mentalrayGlobals.regionRectHeight`; } else { $rectY = 0; $rectX = 0; $rectWidth = 0; $rectHeight = 0; } if (`window -ex renderRegionInfo`) deleteUI renderRegionInfo; window -title "render Region Info" renderRegionInfo; formLayout rcl1; separator -style "in" sep1; intFieldGrp -numberOfFields 1 -label "Bottom" -extraLabel "px" -value1 $rectY -cw1 20 rectY; intFieldGrp -numberOfFields 1 -label "Left" -extraLabel "px" -value1 $rectX rectX; intFieldGrp -numberOfFields 1 -label "Width" -extraLabel "px" -value1 $rectWidth width; intFieldGrp -numberOfFields 1 -label "Heitht" -extraLabel "px" -value1 $rectHeight height; separator -style "in" sep2; symbolButton -image "region_dx.bmp" -c "preset(0)" reg_sx; symbolButton -image "region_full.bmp" -c "preset(1)" reg_fu; symbolButton -image "region_sx.bmp" -c "preset(2)" reg_dx; symbolButton -image "region_fromRenderView.bmp" -c "regionFromRenderView" reg_rv; separator -style "in" sep3; button -l "Query" -align "center" -c query -w 40 but1; button -l "Apply" -align "center" -c apply -w 40 but2; button -l "Node" -align "center" -c "select -r mentalrayGlobals;" -w 40 but3; separator -style "in" sep4; formLayout -e -af sep1 "top" 5 -af sep1 "left" 0 -af sep1 "right" 0 -af rectY "left" -90 -ac rectY "top"5 sep1 -af rectX "left" -90 -ac rectX "top"5 rectY -af width "left" -90 -ac width "top"5 rectX -af height "left" -90 -ac height "top"5 width -ac sep2 "top" 5 height -af sep2 "left" 0 -af sep2 "right" 0 -af reg_sx "left" 6 -ac reg_sx "top" 5 sep2 -ac reg_fu "left" 6 reg_sx -ac reg_fu "top" 5 sep2 -ac reg_dx "left" 6 reg_fu -ac reg_dx "top" 5 sep2 -ac reg_rv "left" 6 reg_dx -ac reg_rv "top" 5 sep2 -ac sep3 "top" 5 reg_rv -af sep3 "left" 0 -af sep3 "right" 0 -af but1 "left" 15 -ac but1 "top"5 sep3 -ac but2 "left" 9 but1 -ac but2 "top"5 sep3 -ac but3 "left" 9 but2 -ac but3 "top"5 sep3 -ac sep4 "top" 5 but2 -af sep4 "left" 0 -af sep4 "right" 0 rcl1; showWindow renderRegionInfo; } global proc apply() { if (!`attributeExists "regionRectX" mentalrayGlobals`) { addAttr -ln regionRectX -at long mentalrayGlobals; addAttr -ln regionRectY -at long mentalrayGlobals; addAttr -ln regionRectWidth -at long mentalrayGlobals; addAttr -ln regionRectHeight -at long mentalrayGlobals; } //get the vars $rectY = `intFieldGrp - q -value1 rectY`; $rectX = `intFieldGrp - q -value1 rectX`; $rectWidth = `intFieldGrp - q -value1 width`; $rectHeight = `intFieldGrp - q -value1 height`; //set the attr setAttr "mentalrayGlobals.regionRectY" $rectY; setAttr "mentalrayGlobals.regionRectX" $rectX; setAttr "mentalrayGlobals.regionRectWidth" $rectWidth; setAttr "mentalrayGlobals.regionRectHeight" $rectHeight; } global proc query() { if (!`attributeExists "regionRectX" mentalrayGlobals`) { addAttr -ln regionRectX -at long mentalrayGlobals; addAttr -ln regionRectY -at long mentalrayGlobals; addAttr -ln regionRectWidth -at long mentalrayGlobals; addAttr -ln regionRectHeight -at long mentalrayGlobals; } //get the attr $rectY = `getAttr mentalrayGlobals.regionRectY`; $rectX = `getAttr mentalrayGlobals.regionRectX`; $rectWidth = `getAttr mentalrayGlobals.regionRectWidth`; $rectHeight = `getAttr mentalrayGlobals.regionRectHeight`; //set the vars intFieldGrp -e -value1 $rectY rectY; intFieldGrp -e -value1 $rectX rectX; intFieldGrp -e -value1 $rectWidth width; intFieldGrp -e -value1 $rectHeight height; } global proc preset(int $presetNumber) { switch($presetNumber) { case 0: //left camera intFieldGrp -e -value1 198 rectY; intFieldGrp -e -value1 404 rectX; intFieldGrp -e -value1 826 width; intFieldGrp -e -value1 509 height; break; case 1: //full frame intFieldGrp -e -value1 0 rectY; intFieldGrp -e -value1 0 rectX; intFieldGrp -e -value1 0 width; intFieldGrp -e -value1 0 height; break; case 2: //right camera intFieldGrp -e -value1 198 rectY; intFieldGrp -e -value1 50 rectX; intFieldGrp -e -value1 826 width; intFieldGrp -e -value1 509 height; break; } } global proc regionFromRenderView() { string $leftRG = getAttr ("defaultRenderGlobals" + ".left"); string $rghtRG = getAttr ("defaultRenderGlobals" + ".rght"); string $botRG = getAttr ("defaultRenderGlobals" + ".bot"); string $topRG = getAttr ("defaultRenderGlobals" + ".top"); int $leftDistance = $leftRG; int $rightDistance = $rghtRG; int $bottomDistance = $botRG; int $topDistance = $topRG; int $width = ($rightDistance - $leftDistance) + 1; int $height = ($topDistance - $bottomDistance) + 1; intFieldGrp -e -value1 $bottomDistance rectY; intFieldGrp -e -value1 $leftDistance rectX; intFieldGrp -e -value1 $width width; intFieldGrp -e -value1 $height height; }