// =========================================================================== // 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. // =========================================================================== // Description: This procedure is used to get the render resolution. // proc int[] getGlobalsResolution() { // // Render globals item. // string $globals[] = `ls -renderGlobals`; int $res[2] = { 640, 480 }; if( size($globals[0]) > 0 ) { string $connect[] = `listConnections ($globals[0] + ".resolution")`; if( size($connect[0]) > 0 ) { $res[0] = `getAttr ($connect[0] + ".width" )`; $res[1] = `getAttr ($connect[0] + ".height" )`; } } return $res; } // Description: This procedure is used to make the resolution // submenu under the menus // . "render window --> Options --> Test Resolution" // . or the "main window --> Render --> Test Resolution". // global proc renderWindowMakeResolutionItem ( string $subMenuName, string $panelName ) { global int $gRenderViewResolutions[]; popupMenu -e -deleteAllItems $subMenuName; setParent -m $subMenuName; // // Use panel resolution item. // int $testRes = `optionVar -q renderViewTestResolution`; int $panelBool = ( $testRes == 0 ); int $fullBool = ( $testRes == 1 ); int $res[] = `getGlobalsResolution`; menuItem -label (uiRes("m_renderWindowMakeResolutionItem.kCameraPanel")) -checkBox $panelBool -c "setTestResolutionVar(0)"; string $renderSettingString = (localizedUIMisc("Render Settings")); $renderSettingString += " (" + $res[0] + "x" + $res[1] + ")"; menuItem -label $renderSettingString -checkBox $fullBool -c "setTestResolutionVar(1)"; menuItem -divider 1; $renderSettingString = (uiRes("m_renderWindowMakeResolutionItem.kPercentageSettings")); for ($i = 2 ; $i < size($gRenderViewResolutions) ; $i++ ) { $x = $res[0] * $gRenderViewResolutions[$i]; $y = $res[1] * $gRenderViewResolutions[$i]; $x /= 100; $y /= 100; int $perc = $gRenderViewResolutions[$i]; menuItem -label `format -s $perc -s $x -s $y $renderSettingString` -checkBox ($testRes == $i) -c ("setTestResolutionVar("+$i+")"); if ($i == 5) { menuItem -divider 1; } } }