// =========================================================================== // 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: 22 Aug 2000 // // Description: // This script demonstrates the use of UI Components. // proc createStatusLine(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Status Line"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createShelf(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Shelf"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createLayerBar(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Layer Bar"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createWorkArea(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $workArea = `text -label "Work Area" -align "center"`; formLayout -edit -attachForm $workArea "top" 0 -attachForm $workArea "left" 0 -attachForm $workArea "bottom" 0 -attachForm $workArea "right" 0 $parent; } proc createTimeLine(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Time Line"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createPlaybackRange(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Playback Range"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createCommandLine(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `textField -text "Command Line"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createHelpLine(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `textField -text "Help Line" -editable false`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createToolbox(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $component = `button -label "Tools"`; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createChannelBox(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $widthControl = `separator -width 160`; string $component = `scrollLayout`; columnLayout; textFieldGrp -label "Channel 1" -columnWidth2 70 60; textFieldGrp -label "Channel 2" -columnWidth2 70 60; textFieldGrp -label "Channel 3" -columnWidth2 70 60; textFieldGrp -label "Channel 4" -columnWidth2 70 60; textFieldGrp -label "Channel 5" -columnWidth2 70 60; textFieldGrp -label "Channel 6" -columnWidth2 70 60; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createAttributeEditor(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $widthControl = `separator -width 250`; string $component = `scrollLayout`; columnLayout; floatSliderGrp -label "Attribute 1" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; floatSliderGrp -label "Attribute 2" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; floatSliderGrp -label "Attribute 3" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; floatSliderGrp -label "Attribute 4" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; floatSliderGrp -label "Attribute 5" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; floatSliderGrp -label "Attribute 6" -field true -columnWidth3 70 50 100 -columnAttach 3 "both" 0; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } proc createOptionBox(string $parent) // // Description: // This procedure is called whenever you want to create the content for // the corresponding UI Component. // // Arguments: // parent - The parent control layout. Must be a formLayout. // { // Ensure the argument layout is the correct type. // string $requiredType = "formLayout"; if ($requiredType != `objectTypeUI $parent`) { error -showLineNumber true ("Argument must be a " + $requiredType); return; } setParent $parent; string $widthControl = `separator -width 120`; string $component = `scrollLayout`; columnLayout; checkBoxGrp -label "Option 1" -columnWidth2 70 20; checkBoxGrp -label "Option 2" -columnWidth2 70 20; checkBoxGrp -label "Option 3" -columnWidth2 70 20; checkBoxGrp -label "Option 4" -columnWidth2 70 20; checkBoxGrp -label "Option 5" -columnWidth2 70 20; checkBoxGrp -label "Option 6" -columnWidth2 70 20; formLayout -edit -attachForm $component "top" 0 -attachForm $component "left" 0 -attachForm $component "bottom" 0 -attachForm $component "right" 0 $parent; } global proc UIComponentExampleWindowUpdateDisplayMenu() // // Description: // Update the state of the menu that also controls the visibility of the // UI components in the window. // // This procedure needs only be called when the menu is about to be // shown (ie. via the menu -postMenuCommand command). It would be best if // this menu is not tear offable because while torn off a menu does not // get messages to update itself. // { int $visible; // Get the visibility of all the components and update the corresponding // menu item. // $visible = isUIComponentVisible("Example Status Line"); menuItem -edit -checkBox $visible UIComponentExampleWindowStatusLineMenuItem; $visible = isUIComponentVisible("Example Shelf"); menuItem -edit -checkBox $visible UIComponentExampleWindowShelfMenuItem; $visible = isUIComponentVisible("Example Layer Bar"); menuItem -edit -checkBox $visible UIComponentExampleWindowLayerBarMenuItem; $visible = isUIComponentVisible("Example Time Line"); menuItem -edit -checkBox $visible UIComponentExampleWindowTimeLineMenuItem; $visible = isUIComponentVisible("Example Playback Range"); menuItem -edit -checkBox $visible UIComponentExampleWindowPlaybackRangeMenuItem; $visible = isUIComponentVisible("Example Command Line"); menuItem -edit -checkBox $visible UIComponentExampleWindowCommandLineMenuItem; $visible = isUIComponentVisible("Example Help Line"); menuItem -edit -checkBox $visible UIComponentExampleWindowHelpLineMenuItem; $visible = isUIComponentVisible("Example Toolbox"); menuItem -edit -checkBox $visible UIComponentExampleWindowToolboxMenuItem; $visible = isUIComponentVisible("Example Channel Box"); menuItem -edit -checkBox $visible UIComponentExampleWindowChannelBoxMenuItem; $visible = isUIComponentVisible("Example Attribute Editor"); menuItem -edit -checkBox $visible UIComponentExampleWindowAttributeEditorMenuItem; $visible = isUIComponentVisible("Example Option Box"); menuItem -edit -checkBox $visible UIComponentExampleWindowOptionBoxMenuItem; } global proc int UIComponentExampleWindowStatusLineStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createStatusLine($layout); } } else { } return true; } global proc int UIComponentExampleWindowShelfStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createShelf($layout); } } else { } return true; } global proc int UIComponentExampleWindowLayerBarStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createLayerBar($layout); } } else { } return true; } global proc int UIComponentExampleWindowTimeLineStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createTimeLine($layout); } } else { } return true; } global proc int UIComponentExampleWindowPlaybackRangeStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createPlaybackRange($layout); } } else { } return true; } global proc int UIComponentExampleWindowCommandLineStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createCommandLine($layout); } } else { } return true; } global proc int UIComponentExampleWindowHelpLineStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createHelpLine($layout); } } else { } return true; } global proc int UIComponentExampleWindowToolboxStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createToolbox($layout); } } else { } return true; } global proc int UIComponentExampleWindowChannelBoxStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createChannelBox($layout); } } else { } return true; } global proc int UIComponentExampleWindowAttributeEditorStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createAttributeEditor($layout); } } else { } return true; } global proc int UIComponentExampleWindowOptionBoxStateChange( int $newState, string $layout) // // Description: // This procedure is called whenever the visibility of the // corresponding UI component changes. // // If necessary, you can use this procedure to create the // UI component content the first time the component is made // visible. // // Arguments: // newState - The new visibility state of the component. Will // be true if the component is about to be shown, // false if the component is about to be hidden. // // layout - The parent layout for the UI component content. // // Returns: // True if you want to allow the visibility state change. Return // false if you want to prevent the change. // { if ($newState) { // // If the component has not been created yet then do it now. // if (0 == `layout -query -numberOfChildren $layout`) { createOptionBox($layout); } } else { } return true; } // // Description: // Create a window demonstrating how to set up UI Components. // // Simply execute the command "source UIComponentsExample.mel". // { // Delete the window if it already exists. You don't typically do // this for regular windows but it is quite handy during prototyping // UI and you continually source the same script over and over again. // This will allow you to use the same window and prevent a // proliferation of default windows called "window1", "window2", // "window3", etc. // if (`window -exists UIComponentsExampleWindow`) { deleteUI -window UIComponentsExampleWindow; } // Create the window with a menu bar. // $window = `window -menuBar true -title "UI Components Example Window" UIComponentsExampleWindow`; // ---------------------------------------------------------------------- // // Set up a "Display" menu that will also allow the user to control // the visibility of the UI Components. // $displayMenu = `menu -tearOff false -label "Display"`; $statusLineMenuItem = `menuItem -checkBox true -label "Status Line" UIComponentExampleWindowStatusLineMenuItem`; $shelfMenuItem = `menuItem -checkBox true -label "Shelf" UIComponentExampleWindowShelfMenuItem`; $layerBarMenuItem = `menuItem -checkBox true -label "Layer Bar" UIComponentExampleWindowLayerBarMenuItem`; $timeLineMenuItem = `menuItem -checkBox true -label "Time Line" UIComponentExampleWindowTimeLineMenuItem`; $playbackRangeMenuItem = `menuItem -checkBox true -label "Playback Range" UIComponentExampleWindowPlaybackRangeMenuItem`; $commandLineMenuItem = `menuItem -checkBox true -label "Command Line" UIComponentExampleWindowCommandLineMenuItem`; $helpLineMenuItem = `menuItem -checkBox true -label "Help Line" UIComponentExampleWindowHelpLineMenuItem`; menuItem -divider true; $toolboxMenuItem = `menuItem -checkBox true -label "Toolbox" UIComponentExampleWindowToolboxMenuItem`; menuItem -divider true; $channelBoxMenuItem = `menuItem -checkBox true -label "Channel Box" UIComponentExampleWindowChannelBoxMenuItem`; $attributeEditorMenuItem = `menuItem -checkBox true -label "Attribute Editor" UIComponentExampleWindowAttributeEditorMenuItem`; $optionBoxMenuItem = `menuItem -checkBox true -label "Option Box" UIComponentExampleWindowOptionBoxMenuItem`; // ---------------------------------------------------------------------- // Set up the top level layouts for your window. Form layouts are not // only the best way to do this but also explicitly required by the // interface to UI Components. // // First, create the top level form layout. // // Next, create one formLayout for each component you need. // $mainForm = `formLayout`; // Horizontal components. // $statusLine = `formLayout -parent $mainForm`; $shelf = `formLayout -parent $mainForm`; $layerBar = `formLayout -parent $mainForm`; $timeLine = `formLayout -parent $mainForm`; $playbackRange = `formLayout -parent $mainForm`; $commandLine = `formLayout -parent $mainForm`; $helpLine = `formLayout -parent $mainForm`; // This form will be the parent for all the vertical components. // $middleForm = `formLayout -parent $mainForm`; // Vertical components. // $toolbox = `formLayout -parent $middleForm`; $channelBox = `formLayout -parent $middleForm`; $attributeEditor = `formLayout -parent $middleForm`; $optionBox = `formLayout -parent $middleForm`; // The work area represents the non component area of your // window, ie. where you put your models views, panels or // whatever. // $workArea = `formLayout -parent $middleForm`; // ---------------------------------------------------------------------- // Create the component bars. Supply a unique name for the component // bar, the formLayout you created for the bar, plus the position // of the bar that is one of: "top", "left", "bottom", or "right". // createUIComponentBar("Example Top Component Bar", "top"); createUIComponentBar("Example Bottom Component Bar", "bottom"); createUIComponentBar("Example Left Component Bar", "left"); createUIComponentBar("Example Right Component Bar", "right"); // ---------------------------------------------------------------------- // Create the components. // $statusLineForm = createUIComponent( "Example Top Component Bar", "Example Status Line", $statusLine); $shelfForm = createUIComponent( "Example Top Component Bar", "Example Shelf", $shelf); $layerBarForm = createUIComponent( "Example Top Component Bar", "Example Layer Bar", $layerBar); $timeLineForm = createUIComponent( "Example Bottom Component Bar", "Example Time Line", $timeLine); $playbackRangeForm = createUIComponent( "Example Bottom Component Bar", "Example Playback Range", $playbackRange); $commandLineForm = createUIComponent( "Example Bottom Component Bar", "Example Command Line", $commandLine); $helpLineForm = createUIComponent( "Example Bottom Component Bar", "Example Help Line", $helpLine); $toolboxForm = createUIComponent( "Example Left Component Bar", "Example Toolbox", $toolbox); $channelBoxForm = createUIComponent( "Example Right Component Bar", "Example Channel Box", $channelBox); $attributeEditorForm = createUIComponent( "Example Right Component Bar", "Example Attribute Editor", $attributeEditor); $optionBoxForm = createUIComponent( "Example Right Component Bar", "Example Option Box", $optionBox); // ---------------------------------------------------------------------- // Indicate to the Component UI code the "work areas" for your window. // A work area is the non-component form layout for a given orientation. // In this example the horizontal work area is the middleForm, which // contains *all* the vertical components. The vertical work area is // simply the workArea form. // // The component UI needs to know about this formLayout to properly // handle form attachments when hiding or showing components. // setUIComponentWorkArea("Example Top Component Bar", $middleForm); setUIComponentWorkArea("Example Bottom Component Bar", $middleForm); setUIComponentWorkArea("Example Left Component Bar", $workArea); setUIComponentWorkArea("Example Right Component Bar", $workArea); // ---------------------------------------------------------------------- // Set up callbacks so your window will be notified when the // visibility state of components changes. // // You may not require these callbacks. In fact, in most cases // you probably don't need to know when your components change // visibility state. The callbacks are included them here for // demonstration purposes. In fact, the procedures attached to // these callbacks actually create the Component UI when the // component is made visible for the first time. // // As an alternative you could create all your components when // the window is created with direct calls to the following // local procedures: // // proc createStatusLine(string $parent) // proc createShelf(string $parent) // proc createLayerBar(string $parent) // proc createWorkArea(string $parent) // proc createTimeLine(string $parent) // proc createPlaybackRange(string $parent) // proc createCommandLine(string $parent) // proc createHelpLine(string $parent) // proc createToolbox(string $parent) // proc createChannelBox(string $parent) // proc createAttributeEditor(string $parent) // proc createOptionBox(string $parent) // setUIComponentStateCallback("Example Status Line", "UIComponentExampleWindowStatusLineStateChange"); setUIComponentStateCallback("Example Shelf", "UIComponentExampleWindowShelfStateChange"); setUIComponentStateCallback("Example Layer Bar", "UIComponentExampleWindowLayerBarStateChange"); setUIComponentStateCallback("Example Time Line", "UIComponentExampleWindowTimeLineStateChange"); setUIComponentStateCallback("Example Playback Range", "UIComponentExampleWindowPlaybackRangeStateChange"); setUIComponentStateCallback("Example Command Line", "UIComponentExampleWindowCommandLineStateChange"); setUIComponentStateCallback("Example Help Line", "UIComponentExampleWindowHelpLineStateChange"); setUIComponentStateCallback("Example Toolbox", "UIComponentExampleWindowToolboxStateChange"); setUIComponentStateCallback("Example Channel Box", "UIComponentExampleWindowChannelBoxStateChange"); setUIComponentStateCallback("Example Attribute Editor", "UIComponentExampleWindowAttributeEditorStateChange"); setUIComponentStateCallback("Example Option Box", "UIComponentExampleWindowOptionBoxStateChange"); // ---------------------------------------------------------------------- // Create the main content for your window. // createWorkArea($workArea); // ---------------------------------------------------------------------- // Attach commands to the menu items that will toggle the visibility // state of the UI Components. // menu -edit -postMenuCommand ("UIComponentExampleWindowUpdateDisplayMenu") $displayMenu; menuItem -edit -command ("toggleUIComponentVisibility \"Example Status Line\"") $statusLineMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Shelf\"") $shelfMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Layer Bar\"") $layerBarMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Time Line\"") $timeLineMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Playback Range\"") $playbackRangeMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Command Line\"") $commandLineMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Help Line\"") $helpLineMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Toolbox\"") $toolboxMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Channel Box\"") $channelBoxMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Attribute Editor\"") $attributeEditorMenuItem; menuItem -edit -command ("toggleUIComponentVisibility \"Example Option Box\"") $optionBoxMenuItem; // Now make all the form attachments. // formLayout -edit -attachForm $toolbox "top" 0 -attachForm $toolbox "left" 0 -attachForm $toolbox "bottom" 0 -attachNone $toolbox "right" -attachForm $workArea "top" 0 -attachControl $workArea "left" 0 $toolbox -attachForm $workArea "bottom" 0 -attachControl $workArea "right" 0 $channelBox -attachForm $channelBox "top" 0 -attachNone $channelBox "left" -attachForm $channelBox "bottom" 0 -attachControl $channelBox "right" 0 $attributeEditor -attachForm $attributeEditor "top" 0 -attachNone $attributeEditor "left" -attachForm $attributeEditor "bottom" 0 -attachControl $attributeEditor "right" 0 $optionBox -attachForm $optionBox "top" 0 -attachNone $optionBox "left" -attachForm $optionBox "bottom" 0 -attachForm $optionBox "right" 0 $middleForm; formLayout -edit -attachForm $statusLine "top" 0 -attachForm $statusLine "left" 0 -attachNone $statusLine "bottom" -attachForm $statusLine "right" 0 -attachControl $shelf "top" 0 $statusLine -attachForm $shelf "left" 0 -attachNone $shelf "bottom" -attachForm $shelf "right" 0 -attachControl $layerBar "top" 0 $shelf -attachForm $layerBar "left" 0 -attachNone $layerBar "bottom" -attachForm $layerBar "right" 0 -attachControl $middleForm "top" 0 $layerBar -attachForm $middleForm "left" 0 -attachControl $middleForm "bottom" 0 $timeLine -attachForm $middleForm "right" 0 -attachNone $timeLine "top" -attachForm $timeLine "left" 0 -attachForm $timeLine "right" 0 -attachControl $timeLine "bottom" 0 $playbackRange -attachNone $playbackRange "top" -attachForm $playbackRange "left" 0 -attachForm $playbackRange "right" 0 -attachControl $playbackRange "bottom" 0 $commandLine -attachNone $commandLine "top" -attachForm $commandLine "left" 0 -attachForm $commandLine "right" 0 -attachControl $commandLine "bottom" 0 $helpLine -attachNone $helpLine "top" -attachForm $helpLine "left" 0 -attachForm $helpLine "bottom" 0 -attachForm $helpLine "right" 0 $mainForm; // Set up an initial visibility state for all the components. // int $initialStatusLineState = true; int $initialShelfState = true; int $initialLayerBarState = false; int $initialTimeLineState = false; int $initialPlaybackRangeState = false; int $initialCommandLineState = true; int $initialHelpLineState = false; int $initialToolboxState = true; int $initialChannelsState = true; int $initialAttributesState = false; int $initialOptionsState = false; if ($initialStatusLineState) { toggleUIComponentVisibility "Example Status Line"; } if ($initialShelfState) { toggleUIComponentVisibility "Example Shelf"; } if ($initialLayerBarState) { toggleUIComponentVisibility "Example Layer Bar"; } if ($initialTimeLineState) { toggleUIComponentVisibility "Example Time Line"; } if ($initialPlaybackRangeState) { toggleUIComponentVisibility "Example Playback Range"; } if ($initialCommandLineState) { toggleUIComponentVisibility "Example Command Line"; } if ($initialHelpLineState) { toggleUIComponentVisibility "Example Help Line"; } if ($initialToolboxState) { toggleUIComponentVisibility "Example Toolbox"; } if ($initialChannelsState) { toggleUIComponentVisibility "Example Channel Box"; } if ($initialAttributesState) { toggleUIComponentVisibility "Example Attribute Editor"; } if ($initialOptionsState) { toggleUIComponentVisibility "Example Option Box"; } showWindow $window; }