// =========================================================================== // 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. // =========================================================================== // Description: This procedure is called when a hyper graph window // is deleted. // . If the window was closed by the user, then the hyper // graph panel would be deleted, unless it is the default // hyper graph panel. // . If the window was closed by mel because we want to move // the hyper graph panel to a display panel, then // we don't delete the hyper graph panel. // global proc hyperGraphWindowClosed(string $whichPanel) { global int $gKeepHyperGraphWhileClosingWindow; if (!$gKeepHyperGraphWhileClosingWindow) { // Check if it is the default hyper graph panel. // Don't delete the default hyper graph panel. // if ($whichPanel != "hyperGraphPanel1") { // Check if the panel we want to delete exists or not, // before we delete it. // if (`scriptedPanel -exists $whichPanel`) { deleteUI -panel $whichPanel; } } } else { // We kept this hyper graph panel. // Now set the $gKeepHyperGraphWhileClosingWindow back to // default for the next hyper graph window scriptJob. // $gKeepHyperGraphWhileClosingWindow = false; } } // Description: This procedure is for opening hyper graph window // with the given type of view. // A hyper graph window could display the hierarchical view // or the DG view. // global proc hyperGraphWindow(string $whichPanel, string $type) { // If whichPanel was given, then we check if the panel is a // hyepr graph panel. // if ($whichPanel != "") { if (`scriptedPanel -query -type $whichPanel` != "hyperGraphPanel") { string $errorMessage = (uiRes("m_hyperGraphWindow.kNoSuchPanel")); $errorMessage = `format -stringArg $whichPanel $errorMessage`; error($errorMessage); return; } } else { // We don't know whichPanel yet. We need to use the // $type+OpenHyperGraphMode optionVar to determine which // panel to bring up or if new hyper graph panel // needs to be created. // $whichPanel = getHyperGraphPanel($type); if ($whichPanel == "") { // Cannot create a hypergraph panel. // return; } } int $isNewWindow = false; string $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 // scriptedPanel -e -tor $whichPanel; // Make sure the hypergraph panel is of the correct type. // string $hyperGraphEd = $whichPanel + "HyperGraphEd"; if ($type == "DG") { showDGLevel $hyperGraphEd; } else if ($type == "DAG") { showDAGLevel $hyperGraphEd; } $isNewWindow = true; } fillEmptyPanes; // If the window does not have a scriptJob attached to it yet, // attach a script job to be execuated when the window is closed. // if ($isNewWindow) { string $panelControl = `panel -query -control $whichPanel`; string $windowName = match("^[^|]*",$panelControl); scriptJob -runOnce true -uiDeleted $windowName ("hyperGraphWindowClosed \""+$whichPanel+"\""); } }