// =========================================================================== // 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: May 7 1997 // // Description: // This script is called after file open/new on startup to make // sure that the UI construction went okay, and if not to clean up. // { global string $gMainPane; if (`paneLayout -ex $gMainPane`) { // // Make sure that the main pane was finally managed. // paneLayout -e -manage true $gMainPane; } // set the name of the proc to call when you need to exit from // the current tool // contextInfo -esc "escapeCurrentTool"; // Check which renderer is the preferred renderer. // evalDeferred -lowestPriority "setupRendererSceneOpenedCallback"; // Set up default decimal places for universal manipulator linearPrecision 3; // Setup default filter for "Echo All" mode of script editor commandEcho -filter {"setLastFocusedCommand", "buildScriptEditor", "handleScriptEditorAction", "verifyCommandPopupMenus"}; source fileDialogFilterTypes; initCrashPanel(); } // Define the callback that is needed for the file command to // turn off anything 'dangerous' on file i/o // global proc fileCmdCallback () { // Prevent nested calls as one file command may trigger another file command through notifications global int $gFileCmdCallbackCount = 0; if ($gFileCmdCallbackCount++ == 0) { global string $gSelect; global string $gCurrentSacredTool; global string $gPreFileCmdCallbackTool; $gCurrentSacredTool = $gSelect; $gPreFileCmdCallbackTool = `currentCtx`; // Ignore resetting the script paint tools. These tools require setup // via UI (dialog box, etc) and just restoring the tool is not enough. if (size($gPreFileCmdCallbackTool) && `contextInfo -exists $gPreFileCmdCallbackTool` && `contextInfo -c $gPreFileCmdCallbackTool` == "artUserPaint" ) { $gPreFileCmdCallbackTool = ""; } // Go to the safe (select) tool escapeCurrentTool; // Make sure that playback is off global int $gPreFileCmdCallbackPlayState; if (`exists play`) { $gPreFileCmdCallbackPlayState = `play -query -state`; if ( $gPreFileCmdCallbackPlayState ) { play -state off; } } } } // Puts back what fileCmdCallback changes // global proc fileCmdRestoreCallback () { // Prevent nested calls as one file command may trigger another file command through notifications global int $gFileCmdCallbackCount; if (--$gFileCmdCallbackCount == 0) { global string $gPreFileCmdCallbackTool; global int $gPreFileCmdCallbackPlayState; if (size($gPreFileCmdCallbackTool) && `contextInfo -exists $gPreFileCmdCallbackTool`) { setToolTo $gPreFileCmdCallbackTool; } if (`exists play` && $gPreFileCmdCallbackPlayState) { play -state $gPreFileCmdCallbackPlayState; } } } // // Called by TtimePort's deleteAll method. If a deleteAll was run, then // it is not auto save and we can clear the pre file cmd playback state // so that we do not start a new scene in playback mode // global proc clearPreFilePlayState() { global int $gPreFileCmdCallbackPlayState; $gPreFileCmdCallbackPlayState = false; } // Called by TFileCmd's handleFileNewFlag and handleFileOpenFlag method. If a file -open // or file -new was run, then the tool would reset to selectSuperContext global proc clearPreFileSetToolState() { global string $gPreFileCmdCallbackTool; global int $gQuadDrawClearDots; $gPreFileCmdCallbackTool = ""; $gQuadDrawClearDots = true; } global proc int quadDrawClearDots() { global int $gQuadDrawClearDots; return $gQuadDrawClearDots; } global proc setQuadDrawClearDots(int $clearDots) { global int $gQuadDrawClearDots; if($gQuadDrawClearDots != $clearDots){ $gQuadDrawClearDots = $clearDots; } } // Assign the callback to the file command file -c "fileCmdCallback" "fileCmdRestoreCallback";