// =========================================================================== // 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. // =========================================================================== proc scriptedPanelRunTimeCmdPanZoom( string $currentPanel ) { string $scriptedType = `scriptedPanel -q -type $currentPanel`; global string $gScriptedModelEditorTypes[]; global string $gScriptedModelEditorList[]; int $typeCount = size( $gScriptedModelEditorTypes ); int $editorCount = size( $gScriptedModelEditorList ); for ( $i = 0; $i < $typeCount; $i ++ ) { if ( $scriptedType == $gScriptedModelEditorTypes[$i] && $i < $editorCount ) { string $camera = `modelEditor -q -camera $gScriptedModelEditorList[$i]`; int $panZoomEnabled = !`camera -q -panZoomEnabled $camera`; camera -e -panZoomEnabled $panZoomEnabled $camera; break; } } } global proc deactivatePanZoom() { global string $gPanZoomCtx; global float $gPanZoomBtnDown; panZoomCtx -e -buttonUp $gPanZoomCtx; float $gPanZoomBtnUp = `timerX -startTime $gPanZoomBtnDown`; if($gPanZoomBtnUp < 0.3) { string $currentPanel = `getPanel -underPointer`; if ("" == $currentPanel) { $currentPanel = `getPanel -withFocus`; } if ("" != $currentPanel) { string $panelType = `getPanel -typeOf $currentPanel`; if ($panelType == "modelPanel") { string $camera = `modelEditor -q -camera $currentPanel`; int $panZoomEnabled = !`camera -q -panZoomEnabled $camera`; camera -e -panZoomEnabled $panZoomEnabled $camera; } else if ($panelType == "scriptedPanel") { scriptedPanelRunTimeCmdPanZoom( $currentPanel ); } } } }