// =========================================================================== // 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: Aug 15 1996 // // Description: // This file creates the window menu // global proc string tearOffPanel (string $panelLabel, string $panelType, int $isScripted) { string $wndName = ""; string $cmdStr; string $whichPanel = `getPanel -withLabel $panelLabel`; // Before Maya 8.5, panel labels were stored with // hard-coded English names. When opening pre-8.5 // scenes with UI configuration into a localized Maya, the // "getPanel -withLabel" cmd above (using a localized value // for $panelLabel) returns NULL, since panels are named // according to the English values read in from the pre-8.5 // file. // // A reasonable fall-back of looking for the EN-named panel // minimizes problems when opening pre-8.5 scenes // with UI configuration information -- but keeps those older // panel labels in English, until the scene is saved in 8.5. // if( $whichPanel == "" ) { string $enLabel = unlocalizedPanelLabel( $panelLabel ); if( $enLabel != $panelLabel ) { $whichPanel = `getPanel -withLabel $enLabel`; } } if ("" != $whichPanel) { $wndName = $whichPanel + "Window"; if (`panel -q -to $whichPanel`) { // // The window is already displayed so just show it // showWindow $wndName; } else { // // There is no window so tear off the panel to make one // if ($isScripted) { $cmdStr = ("scriptedPanel -e -to " + $whichPanel); } else { $cmdStr = ($panelType + " -e -to " + $whichPanel); } eval $cmdStr; } fillEmptyPanes; } else { if ($isScripted) { catch (`scriptedPanel -l $panelLabel -type $panelType -to`); } else { $cmdStr = ($panelType + " -l \""+ $panelLabel +"\" -to;"); eval $cmdStr; } } return $wndName; }