// =========================================================================== // 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 int outlinerVisibilityStateChange( int $newState, string $layout) { evalDeferred("restoreLastPanelWithFocus();updateEditorToggleCheckboxes();updateDefaultOutlinerState();"); return true; } global proc setOutlinerVisible(int $visible) { initOutlinerPanel(); string $component = getUIComponentDockControl("Outliner", false); setUIComponentVisibility($component, $visible); } global proc attachOutlinerToForm() { global string $gToggledOutlinerLabel; string $outlinerPanel = `getPanel -withLabel $gToggledOutlinerLabel`; if (`outlinerPanel -query -exists $outlinerPanel`) { global string $gOutlinerForm; if(!`formLayout -q -exists $gOutlinerForm`) { formLayout $gOutlinerForm; } // Make sure the toggled outliner is still parented to the layout. outlinerPanel -edit -parent $gOutlinerForm $outlinerPanel; formLayout -edit -attachForm $outlinerPanel "top" 0 -attachForm $outlinerPanel "left" 0 -attachForm $outlinerPanel "bottom" 0 -attachForm $outlinerPanel "right" 0 $gOutlinerForm; } } proc saveInitialState() { // Save the initial outliner state // This state will be used to reinitialize the outliner when // carrying an outliner through a workspace change. // i.e. The toggled outliner is modified in Maya-Classic, // the user switches to another workspace for the first time // therefore we need to set the initial state to the outliner // so we don't carry the outliner state through the workspace switch global string $gToggledOutlinerLabel; global string $gToggledOutlinerInitialState ; string $panel = `getPanel -withLabel $gToggledOutlinerLabel`; $gToggledOutlinerInitialState = `outlinerEditor -query -stateString $panel`; } global proc initOutlinerPanel() { global int $gOutlinerPanelNeedsInit; if($gOutlinerPanelNeedsInit) { $gOutlinerPanelNeedsInit = false; string $component = getUIComponentDockControl("Outliner", false); if($component == "") { // If the toggled outliner was deleted using the deleteUI command, // the control will also be deleted and will need to be recreated. // workspaceControl -loadImmediately true -uiScript "global string $gOutlinerForm; formLayout $gOutlinerForm;" -label `localizedPanelLabel("Outliner")` -initialWidth `optionVar -q workspacesNarrowPanelInitialWidth` -minimumWidth `optionVar -q workspacesNarrowPanelInitialWidth` -widthProperty "preferred" -duplicatable true "Outliner"; } global string $gOutlinerForm; global string $gToggledOutlinerLabel = "ToggledOutliner"; string $includeLabel = "global string $gToggledOutlinerLabel ; "; string $uiScript = "outlinerPanel -menuBarVisible true "; // default state, this was previously in buildNewSceneUI.mel, applying // this state to the outliner if no other state was set string $editorConfig = "outlinerEditor -e " + "-mainListConnection \"worldList\" " + "-selectionConnection \"modelList\" " + "-showShapes 0 " + "-showReferenceNodes 1 " + "-showReferenceMembers 1 " + "-showAttributes 0 " + "-showConnected 0 " + "-showAnimCurvesOnly 0 " + "-autoExpand 0 " + "-showDagOnly 1 " + "-ignoreDagHierarchy 0 " + "-expandConnections 0 " + "-showCompounds 1 " + "-showNumericAttrsOnly 0 " + "-highlightActive 1 " + "-autoSelectNewObjects 0 " + "-doNotSelectNewObjects 0 " + "-transmitFilters 0 " + "-showSetMembers 1 " + "-setFilter defaultSetFilter " + "-showTimeEditor 1 " + "$panelName;"; string $uiScriptForm = "{ " + $includeLabel + "string $panelName = `" + $uiScript + "-label $gToggledOutlinerLabel -parent " + $gOutlinerForm + "`;" + $editorConfig + " }"; eval ($uiScriptForm) ; attachOutlinerToForm(); saveInitialState(); int $wasVisible = `optionVar -q LastStateOutlinerVisibility`; // The UI script edit is to allow the tab duplication in Maya // If this is not done, the UI script will be the layout one workspaceControl -edit -uiScript ($uiScript + "-label " + "panelLabel " + $component) -visible $wasVisible -initCallback "outlinerStateCallback" "Outliner"; setUIComponentStateCallback( "Outliner", "outlinerVisibilityStateChange"); } } { global int $gOutlinerPanelNeedsInit; $gOutlinerPanelNeedsInit = true; // Set the initial height of Outliner. // string $outlinerControl = getUIComponentDockControl("Outliner", false); if ($outlinerControl != ""){ workspaceControl -e -initialWidth `optionVar -q workspacesNarrowPanelInitialWidth` -minimumWidth `optionVar -q workspacesNarrowPanelInitialWidth` -widthProperty "preferred" -duplicatable true $outlinerControl; evalDeferred("initOutlinerPanel();"); } }