// =========================================================================== // 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: 17 July 1996 // // // Procedure Name: // fitAllPanels // // Description: // Procedure to do a view fit in all panes. Currently this script // can be used on model, graph and hypergraph // panes, and the view can be fit // to either selected or all objects depending on the fitType // argument. // // Input Arguments: // fitType can be either "-all" or "-selectedNoChildren" or "-selected". // // Return Value: // None. // global proc fitAllPanels ( string $fitType ) { string $panels[]; int $i; // Handle all model panes $panels = `getPanel -type modelPanel`; // If you use animate roll int $animate = 0; $animate = `optionVar -q animateRollFitAll`; for ($i = 0; $i < size($panels); $i++) { string $panel = $panels[$i]; string $camera = `lookThru -q $panel`; if ($camera != "") { // If the user presses 'f' with nothing selected or 'a', AND the viewport has filtering // we should apply the filtering. if( `modelEditor -q -isFiltered $panel` && ($fitType == "-all" || size( `ls -sl`) == 0)) { // We have slightly intedeterminate behaviour if we have multiple views of the // same camera with different filtering (as the camera can only have one state, // but different panels can have different views of the scene). // viewFit -panel $panel -animate $animate $camera; } else if ($fitType == "-all") { viewFit -all -animate $animate $camera; } else if ($fitType == "-selectedNoChildren" && size( `ls -sl`) != 0) { fitPanelWithoutChildren ( $animate, "", $camera, 1 ); } else { viewFit -animate $animate $camera; } } } // Handle all hypergraph panes $panels = `getPanel -type hyperPanel`; for ($i = 0; $i < size($panels); $i++) { if ($fitType == "-all") hyperGraph -e -frameGraph $panels[$i]; else hyperGraph -e -frame $panels[$i]; } // Handle all scripted panel panes $panels = `getPanel -type scriptedPanel`; for ($i = 0; $i < size($panels); $i++) { string $scriptedType = `scriptedPanel -q -type $panels[$i]`; switch ($scriptedType) { case "graphEditor": string $graphEd = ($panels[$i]+"GraphEd"); if ($fitType == "-all") { animCurveEditor -e -lookAt all $graphEd; } else { animCurveEditor -e -lookAt selected $graphEd; } break; case "hyperGraphPanel": string $hyperGraphEd = ( $panels[$i] + "HyperGraphEd"); if ($fitType == "-all") { hyperGraph -e -frameGraph $hyperGraphEd; } else { hyperGraph -e -frame $hyperGraphEd; } break; case "profilerPanel": if (`profilerTool -q -exists`) { if ($fitType == "-all") { profilerTool -e -frameAll; } else { profilerTool -e -frameSelected; } } break; case "nodeEditorPanel": if ($fitType == "-all") { nodeEditor -e -frameAll `editorNameFromPanel $panels[$i]`; } else { nodeEditor -e -frameModelSelection `editorNameFromPanel $panels[$i]`; } break; case "dopeSheetPanel": string $dopeSheetEd = ( $panels[$i] + "DopeSheetEd" ); if( $fitType == "-all" ) { dopeSheetEditor -edit -lookAt all $dopeSheetEd; } else { dopeSheetEditor -edit -lookAt selected $dopeSheetEd; } break; case "polyTexturePlacementPanel": string $texWindowEd = $panels[$i]; if( $fitType == "-all" ) { textureWindow -edit -frameAll $texWindowEd; } else { textureWindow -edit -frameSelected $texWindowEd; } break; case "clipEditorPanel": string $traxWindowEd = clipEditorNameFromPanel( $panels[$i] ); if( $fitType == "-all" ) { clipEditor -edit -lookAt all $traxWindowEd; } else { clipEditor -edit -lookAt selected $traxWindowEd; } break; case "sequenceEditorPanel": string $seqWindowEd = clipEditorNameFromPanel( $panels[$i] ); if( $fitType == "-all" ) { clipEditor -edit -lookAt all $seqWindowEd; } else { clipEditor -edit -lookAt selected $seqWindowEd; } break; } } }