// =========================================================================== // 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: 31 April 1997 // // Procedure Name: // buildCameraToggleMenu // // Description: // Display of menu of toggles for the current camera. // // Input Arguments: // parent - menu name to build menu items for // panel - name of panel this menu is associated with // // Return Value: // None. // global proc buildCameraToggleMenu( string $parent, string $panel ) { setParent -m $parent; // If menu has not been created yet, create it now // if (`menu -q -numberOfItems $parent` == 0) { menuItem -label (uiRes("m_buildCameraToggleMenu.kPerspective")) -c ("CameraModeToggle") -checkBox on cameraPerspItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kUndoableMovement")) -checkBox on cameraJournalItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kIgnore2dPanZoom")) -checkBox on cameraIgnorePZItem; menuItem -divider true; radioMenuItemCollection; menuItem -ltVersion "2017" -label (uiRes("m_buildCameraToggleMenu.kNoGate")) -radioButton on cameraNoGateItem; menuItem -ltVersion "2017" -label (uiRes("m_buildCameraToggleMenu.kFilmGate")) -radioButton off cameraFileGateItem; menuItem -ltVersion "2017" -label (uiRes("m_buildCameraToggleMenu.kResolutionGate")) -radioButton off cameraResGateItem; menuItem -divider true; menuItem -ltVersion "2017" -label (uiRes("m_buildCameraToggleMenu.kGateMask")) -checkBox off cameraGateMaskItem; menuItem -divider true; menuItem -label (uiRes("m_buildCameraToggleMenu.kFieldChart")) -checkBox on cameraFieldChartItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kSafeAction")) -checkBox on cameraSafeActionItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kSafeTitle")) -checkBox on cameraSafeTitleItem; menuItem -divider true; menuItem -label (uiRes("m_buildCameraToggleMenu.kFilmOrigin")) -checkBox on cameraOriginItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kFilmPivot")) -checkBox on cameraPivotItem; menuItem -divider true; radioMenuItemCollection; menuItem -label (uiRes("m_buildCameraToggleMenu.kFill")) -radioButton on cameraFillItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kHorizontal")) -radioButton off cameraHorzItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kVertical")) -radioButton off cameraVertItem; menuItem -label (uiRes("m_buildCameraToggleMenu.kOverscan")) -radioButton off cameraOverscanItem; } updateCameraToggleMenu ($parent, $panel); } global proc updateCameraToggleMenu( string $parent, string $panel ) { string $customEditor = `getCustomViewEditorFromPanel( $panel )`; string $currentEditor; string $current; if (size($customEditor)) { $current = `modelEditor -q -camera $customEditor`; $currentEditor = $customEditor; } else { $current = `modelPanel -q -camera $panel`; $currentEditor = `modelPanel -q -modelEditor $panel`; } string $fullCameraShape[] = `listRelatives -shapes -fullPath $current`; if(size($fullCameraShape) == 0) { //if we failed, try to find tranform, then look for shape again string $transforms[] = `listTransforms $current`; $fullCameraShape = `listRelatives -shapes -fullPath $transforms[0]`; } menuItem -edit -checkBox `camera -q -journalCommand $current` -c ("camera -e -journalCommand #1 "+$current) cameraJournalItem; string $newState; int $ipz = `modelEditor -q -ignorePanZoom $currentEditor`; if ($ipz == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $ipz -c ("modelEditor -e -ignorePanZoom " + $newState + $currentEditor) cameraIgnorePZItem; int $dfg = `camera -q -displayFilmGate $current`; int $dr = `camera -q -displayResolution $current`; menuItem -edit -radioButton (!$dfg && !$dr) -c ("camera -e -displayFilmGate off -displayResolution off "+ "-overscan 1.0 "+$current) cameraNoGateItem; menuItem -edit -radioButton $dfg -c ("camera -e -displayFilmGate on -displayResolution off "+ "-overscan 1.3 "+$current) cameraFileGateItem; menuItem -edit -radioButton $dr -c ("camera -e -displayFilmGate off -displayResolution on "+ "-overscan 1.3 "+$current) cameraResGateItem; int $dgm = `camera -q -displayGateMask $current`; if ($dgm == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dgm -c ("camera -e -displayGateMask " + $newState + $current+"; "+ "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraGateMaskItem; int $dfc = `camera -q -displayFieldChart $current`; int $dsa = `camera -q -displaySafeAction $current`; int $dst = `camera -q -displaySafeTitle $current`; int $dfo = `camera -q -displayFilmOrigin $current`; int $dfp = `camera -q -displayFilmPivot $current`; if ($dfc == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dfc -c ("camera -e -displayFieldChart " + $newState + $current+"; "+ "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraFieldChartItem; if ($dsa == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dsa -c ("camera -e -displaySafeAction " + $newState + $current+"; "+ "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraSafeActionItem; if ($dst == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dst -c ("camera -e -displaySafeTitle " + $newState + $current+"; "+ "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraSafeTitleItem; if ($dfo == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dfo -c ("camera -e -displayFilmOrigin " + $newState + $current +"; " + "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraOriginItem; if ($dfp == 1) { $newState = "off "; } else { $newState = "on "; } menuItem -edit -checkBox $dfp -c ("camera -e -displayFilmPivot " + $newState + $current +"; " + "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") cameraPivotItem; string $ff = `camera -q -filmFit $current`; menuItem -edit -radioButton ($ff == "fill") -c ("camera -e -filmFit fill "+$current) cameraFillItem; menuItem -edit -radioButton ($ff == "horizontal") -c ("camera -e -filmFit horizontal "+$current) cameraHorzItem; menuItem -edit -radioButton ($ff == "vertical") -c ("camera -e -filmFit vertical "+$current) cameraVertItem; menuItem -edit -radioButton ($ff == "overscan") -c ("camera -e -filmFit overscan "+$current) cameraOverscanItem; }