// =========================================================================== // 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. // =========================================================================== // // // Original Creation Date: 08 Nov 2000 // separated out from initChanelsLayers 21 Nov 2008 // // Description: // This script initializes the Layer Editor. // Initialization involves determining the initial preferences, // creating the UI and setting the initial visibility. // global proc createLayers(string $parent) // // Description: // Create the Layer Editor component area. // // The actual content for this UI isn't created here just // the parent structure and layout to contain them. // // Arguments: // $parent - Parent layout. Must be a form layout. // { global string $gLayerEditorForm; // Default width of Channel Box / Layer Editor. // global int $gLayersWidth = 230; $gLayersWidth = `optionVar -q workspacesNarrowPanelInitialWidth`; // Bail if parent layout is not correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { string $errorMsg = (uiRes("m_initLayers.kArgumentError")); error (`format -s $requiredType $errorMsg`); return; } $gLayerEditorForm = "LayerEditorForm"; formLayout -parent $parent $gLayerEditorForm; eval ("source layerEditor"); formLayout -edit -attachForm $gLayerEditorForm "top" 0 -attachForm $gLayerEditorForm "left" 0 -attachForm $gLayerEditorForm "bottom" 0 -attachForm $gLayerEditorForm "right" 0 $parent; } global proc updateLayers() // // Description: // Update theLayer Editor area. // // Call this method to make sure the state of the // Layer Editor buttons are in sync with the actual state of these // components. This is only needed for the main (docked) window, // NOT for the separate Layer Editor window. // { //no longer neccessary } global proc showLayers(int $visible) // // Description: // Show the Layer Editor. // // This method manages the visibility of the // Layer Editor. // { global string $gLayersForm; // name of editor in main window global string $gLayerEditorForm; // Set the correct parent. // setParent $gLayersForm; if(`formLayout -exists $gLayerEditorForm`) { formLayout -e -parent $gLayersForm $gLayerEditorForm; formLayout -edit -attachForm $gLayerEditorForm "top" 0 -attachForm $gLayerEditorForm "left" 0 -attachForm $gLayerEditorForm "bottom" 0 -attachForm $gLayerEditorForm "right" 0 $gLayersForm; } setLayersVisible( $visible ); } global proc setLayersVisible(int $visible) // // Description: // Set the visibility of the Layer Editor. // // Arguments: // $visible - Visibility for the Layer Editor. // { int $currentlyVisible = isUIComponentVisible("Layer Editor"); if ($visible && !$currentlyVisible || !$visible && $currentlyVisible) { toggleUIComponentVisibility "Layer Editor"; } } global proc raiseLayers() // // Description: // Raise the Layer Editor to the top of its dock widget area // if it is visible and not floating (if floating, will set // it to have focus) // { string $component = getUIComponentDockControl("Layer Editor", false); workspaceControl -edit -restore $component; } global proc int isLayersRaised() // // Description: // Returns whether or not the Layer Editor is visible and // either floating or at the top of its dock widget area. // { string $component = getUIComponentDockControl("Layer Editor", false); return `workspaceControl -q -raise $component`; } // // Description: // This code is executed when this script file is sourced. // // Create the Layer Editor area. // { global string $gLayersForm; if(`optionVar -query channelsLayersSeparate`) { // Create the Layer Editor. // createLayers($gLayersForm); } // Set the initial width. // string $component = getUIComponentDockControl("Layer Editor", false); workspaceControl -edit -initialWidth $gLayersWidth -minimumWidth $gLayersWidth -widthProperty "preferred" $component; // Set the initial visibility. // setLayersVisible(`optionVar -query layersVisible`); }