// =========================================================================== // 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. // =========================================================================== global proc outlinerStateCallback(string $outlinerObjectName) { if (`workspaceControl -query -exists $outlinerObjectName`) { string $state[] = `workspaceControl -query -stateString $outlinerObjectName`; string $editorNameInit = ""; if ($outlinerObjectName == "Outliner") { $editorNameInit = "global string $gToggledOutlinerLabel;$editorName = `getPanel -withLabel $gToggledOutlinerLabel`;"; } else { int $end = `size($outlinerObjectName)` - `size("Window")`; string $outlinerPanelName = `substring $outlinerObjectName 1 $end`; $editorNameInit = "$editorName = \"" + $outlinerPanelName + "\"; "; } string $stateString = ""; if (`size($state[0])` > 0) { $stateString = "{ " + $editorNameInit + $state[0] + "; } "; } else { // This case happens when switching to a workspace for the first time. // The toggled outliner state needs to be resetted to it's initial state // This also happens when duplicating the outliner. It will use the default state. global string $gToggledOutlinerInitialState; $stateString = "{ " + $editorNameInit + $gToggledOutlinerInitialState + "; } "; } evalDeferred($stateString); } } global proc outlinerStateCallbackSave(string $outlinerObjectName) { string $outlinerPanelName = ""; if ($outlinerObjectName == "Outliner") { global string $gToggledOutlinerLabel; $outlinerPanelName = `getPanel -withLabel $gToggledOutlinerLabel`; } else { // outliners object names are panelName+"Window" -> outlinerPanel#Window // only get the panel name int $end = `size($outlinerObjectName)` - `size("Window")`; $outlinerPanelName = `substring $outlinerObjectName 1 $end`; } string $newState = `outlinerEditor -query -stateString $outlinerPanelName`; workspaceControl -edit -stateString $newState $outlinerObjectName; }