// =========================================================================== // 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: 10 Nov 1998 // // Description: // Procs for creating the Component Editor Window. // // //////////////////////////////////////////////////////////////////////////////// // Procedure Name: // compEdPrecisionPrompt // // Description: // Prompts user to enter a new integer for the number of decimal // points to show. // // Return Value: // None. // global proc compEdPrecisionPrompt (string $compEdName) { string $parent = `componentEditor -q -parent $compEdName`; string $tokens[]; tokenize ($parent,"|",$tokens); int $oldPrecision = `optionVar -query CEPrecision`; int $newPrecision = precisionPrompt ($tokens[0], $oldPrecision, 15); if ($newPrecision > 0) { componentEditor -edit -pre $newPrecision $compEdName; optionVar -iv CEPrecision $newPrecision; } } global proc buildCompEdContextHelpItems(string $nameRoot, string $menuParent) // // Description: // Build context sensitive menu items for the hyper graph. // // Input Arguments: // $nameRoot - name to use as the root of all item names // $menuParent - the name of the parent of this menu // // Return Value: // None // { menuItem -label (uiRes("m_componentEditorWindow.kHelpOnComponentEditor")) -enableCommandRepeat false -command "showHelp ComponentEditor"; } proc CEinitOptionVars() { // autoupdate = default to on // if (! `optionVar -exists CEAutoUpdate`) { optionVar -iv CEAutoUpdate 1; } if (! `optionVar -exists CEShowAllCols`) { optionVar -iv CEShowAllCols 1; } if (! `optionVar -exists CESortAlpha`) { optionVar -iv CESortAlpha 1; } if(! `optionVar -exists CEShowPathName`) { optionVar -iv CEShowPathName 1; } } proc CEsyncWindowToOptionVars(string $compEdName) { CEinitOptionVars(); int $autoUpdate = `optionVar -q CEAutoUpdate`; if ($autoUpdate == `componentEditor -q -li $compEdName`) { componentEditor -e -li ($autoUpdate==0) $compEdName; } int $hideZeroCols = `optionVar -q CEShowAllCols`; if ($hideZeroCols != `componentEditor -q -hzc $compEdName`) { componentEditor -e -hzc $hideZeroCols $compEdName; } int $sortAlpha = `optionVar -q CESortAlpha`; if ($sortAlpha != `componentEditor -q -sa $compEdName`) { componentEditor -e -sa $sortAlpha $compEdName; } int $showPathName = `optionVar -q CEShowPathName`; if ($showPathName != `componentEditor -q -hpn $compEdName`) { componentEditor -e -hpn $showPathName $compEdName; } } global proc compEdForceLoad(string $compEdName) { int $previousVal = `componentEditor -q -li $compEdName`; // force a load componentEditor -e -li false $compEdName; if ($previousVal == 1) { componentEditor -e -li true $compEdName; } } // // Procedure Name: // buildCompEdMenus // // Description: // Build all of the menus needed for the component editor window // // Input Arguments: // string $compEdName - the name of the component editor // // Return Value: // None // global proc buildCompEdMenus(string $compEdName, string $tabLayout ) { // initialize any uninitialized optionVars // CEinitOptionVars(); // assume that the menu parent is properly set. // menu -label (uiRes("m_componentEditorWindow.kOptions")) -tearOff true -postMenuCommandOnce true -familyImage "menuIconOptions.png"; int $autoUpdate = `optionVar -q CEAutoUpdate`; string $mitem = `menuItem -label (uiRes("m_componentEditorWindow.kAutoUpdate")) -checkBox $autoUpdate -annotation (uiRes("m_componentEditorWindow.kAutoUpdateAnnot")) -command ("compEdMenuCmd CEMIAutoUpdate " + $compEdName) "CEMIAutoUpdate"`; int $showCols = `optionVar -q CEShowAllCols`; menuItem -label (uiRes("m_componentEditorWindow.kHideZeroColumns")) -checkBox $showCols -command ("compEdMenuCmd CEMIShowAllCols " + $compEdName) -annotation (uiRes("m_componentEditorWindow.kHideZeroColumnsAnnot")) "CEMIShowAllCols"; // sort alphabetically or hierarchically? // int $sortAlpha = `optionVar -q CESortAlpha`; menuItem -label (uiRes("m_componentEditorWindow.kSortAlphabetically")) -checkBox $sortAlpha -command ("compEdMenuCmd CEMISortAlpha " + $compEdName) -annotation (uiRes("m_componentEditorWindow.kSortAlphabeticallyAnnot")) "CEMISortAlpha"; int $showPathName = `optionVar -q CEShowPathName`; menuItem -label (uiRes("m_componentEditorWindow.kShowPathName")) -checkBox $showPathName -command ("compEdMenuCmd CEMIShowPathName " + $compEdName) -annotation (uiRes("m_componentEditorWindow.kShowPathNameAnnot")) "CEMIShowPathName"; menuItem -label (uiRes("m_componentEditorWindow.kChangePrecision")) -annotation (uiRes("m_componentEditorWindow.kChangePrecisionAnnot")) -command ("compEdPrecisionPrompt " + $compEdName); menuItem -label (uiRes("m_componentEditorWindow.kRememberThisLayout")) -c ("componentEditorRememberWindow \"" + $compEdName + "\" \"" + $tabLayout + "\"" ) CEMIRememberWindow; menuItem -label (uiRes("m_componentEditorWindow.kDeleteCurrentLayout")) -c ("componentEditorRemoveTab \"" + $compEdName + "\" \""+$tabLayout+"\"") CEMIDeleteTab; setParent -menu ..; menu -label (uiRes("m_componentEditorWindow.kLayout")) -tearOff true -postMenuCommandOnce true -familyImage "menuIconOptions.png"; menuItem -label (uiRes("m_componentEditorWindow.kLoadSelectedComponents")) -annotation (uiRes("m_componentEditorWindow.kLoadSelectedComponentsAnnot")) -command ("compEdMenuCmd CEMILoad " + $compEdName) "CEMILoad"; menuItem -label (uiRes("m_componentEditorWindow.kShowSelectedColumns")) -annotation (uiRes("m_componentEditorWindow.kShowSelectedColumnsAnnot")) -command ("compEdMenuCmd CEMIShowSelectedColumns " + $compEdName) "CEMIShowSelectedColumns"; menuItem -label (uiRes("m_componentEditorWindow.kShowSelectedObjects")) -annotation (uiRes("m_componentEditorWindow.kShowSelectedObjectsAnnot")) -command ("compEdMenuCmd CEMIShowSelectedObjects " + $compEdName) "CEMIShowSelectedObjects"; menuItem -label (uiRes("m_componentEditorWindow.kShowAllColumns")) -command ("compEdMenuCmd CEMIShowAll " + $compEdName) "CEMIShowAll"; setParent -menu ..; // Add support for the Context Sensitive Help Menu. // addContextHelpProc $compEdName "buildCompEdContextHelpItems"; } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // compEdMenuCmd // // Description: // The command called by all comp ed menus // // Input Arguments: // string $itemName - the nema of the menuItem // string $compEdName - the name of the component editor // // Return Value: // None // global proc compEdMenuCmd(string $itemName, string $compEdName) { if( `menuItem -exists $itemName` ) { if ($itemName == "CEMIAutoUpdate") { int $isChecked = `menuItem -q -checkBox $itemName`; componentEditor -e -li ($isChecked == 0) $compEdName; optionVar -iv CEAutoUpdate $isChecked; } else if ($itemName == "CEMILoad") { compEdForceLoad($compEdName); } else if ($itemName == "CEMIShowSelectedColumns") { componentEditor -e -ss true $compEdName; } else if ($itemName == "CEMIShowSelectedObjects") { componentEditor -e -so $compEdName; } else if ($itemName == "CEMIShowAll") { componentEditor -e -ss false $compEdName; } else if ($itemName == "CEMIShowAllCols") { int $isChecked = `menuItem -q -checkBox $itemName`; componentEditor -e -hzc $isChecked $compEdName; optionVar -iv CEShowAllCols $isChecked; } else if ($itemName == "CEMIShowPathName") { int $isChecked = `menuItem -q -checkBox $itemName`; if($isChecked) { componentEditor -e -hpn false $compEdName; } else { componentEditor -e -hpn true $compEdName; } optionVar -iv CEShowPathName $isChecked; } else if ($itemName == "CEMISortAlpha") { int $isChecked = `menuItem -q -checkBox $itemName`; componentEditor -e -sa $isChecked $compEdName; optionVar -iv CESortAlpha $isChecked; } } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // setTabOpType // // Description: // Set the given componentEditor to the currentTabIndex-1 th // opeartionType, or to a hardcoded given value. // // Input Arguments: // string $tabLayoutName - name of the tab layout in the window // string $compEdName - name of the component editor in the window // int $set - if not -1, will set the tabLayout to that number. // if -1, will query the tabLayout. So When the editor first // comes up, set will be a saved value, allowing the editor // the last tab it was open to. The -1 is used as a parameter // when this command is added as tab changed command. // // Return Value: // None // global proc setTabOpType(string $tabLayoutName, string $compEdName, int $set) { if (`tabLayout -exists $tabLayoutName`) { int $currentTab = $set; if( $set == -1) { $currentTab = `tabLayout -q -selectTabIndex $tabLayoutName`; } optionVar -intValue "CEoperationType" $currentTab; // subtract 1 since tabs are a 1-based index, and // component editor uses a zero based index. // $currentTab -= 1; // for safety's sake, verify that the current tab is valid. // int $maxTabs = `componentEditor -q -operationCount $compEdName`; if($currentTab <= $maxTabs) { componentEditor -e -operationType $currentTab $compEdName; } // Some tabs can't be customized string $tabNames[] = `tabLayout -q -tabLabel $tabLayoutName`; string $currentTabName = $tabNames[$currentTab]; if(( $currentTabName == (uiRes("s_TpolyUIBasketStrings.rPolygonsTabLabel"))) // "Polygons" || ($currentTabName == (uiRes("s_TpolyUIBasketStrings.rAdvPolygons"))) // "AdvPolygons" || ($currentTabName == (uiRes("s_TdynamicsUIBasketStrings.rParticles"))) ) // "Particles" { menuItem -e -en false CEMIRememberWindow; } else { menuItem -e -en true CEMIRememberWindow; } // Disable deleting the default tabs if( $currentTab > 6 ) { menuItem -e -en true CEMIDeleteTab; } else { menuItem -e -en false CEMIDeleteTab; } } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // updateComponentEditorSliderRange // // Description: // Callback for when a value is changed in one of the fields that // controls the slider's range // // Input Arguments: // $slider - the slider used to edit groups of values in the component // editor // $minField - field for setting the min value of the slider // $maxField - field for setting the max value of the slider // // Return Value: // None // global proc updateComponentEditorSliderRange( string $slider, string $minField, string $maxField ) { float $min, $max; $min = `floatField -q -value $minField`; $max = `floatField -q -value $maxField`; if ( $max > $min ) { floatSlider -e -minValue $min -maxValue $max $slider; // Update option vars // optionVar -fv "componentEditorSliderMin" $min; optionVar -fv "componentEditorSliderMax" $max; } else { warning (uiRes("m_componentEditorWindow.kSliderMaximumMustBeGreater")); } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // initComponentEditorSlider // // Description: // Set up the optionVars and initialize the slider range // // Input Arguments: // $slider - the slider used to edit groups of values in the component // editor // $minField - field for setting the min value of the slider // $maxField - field for setting the max value of the slider // // Return Value: // None // proc initComponentEditorSlider( string $slider, string $minField, string $maxField ) { float $min, $max; // Retrieve min value for slider // if ( !`optionVar -exists "componentEditorSliderMin"` ) { optionVar -fv "componentEditorSliderMin" 0.0; } $min = `optionVar -q "componentEditorSliderMin"`; // Retrieve max value for slider // if ( !`optionVar -exists "componentEditorSliderMax"` ) { optionVar -fv "componentEditorSliderMax" 1.0; } $max = `optionVar -q "componentEditorSliderMax"`; string $cmd = "updateComponentEditorSliderRange( \"" + $slider + "\", \"" + $minField + "\", \"" + $maxField + "\");"; floatField -e -changeCommand $cmd -value $min $minField; floatField -e -changeCommand $cmd -value $max $maxField; updateComponentEditorSliderRange( $slider, $minField, $maxField ); } // // Procedure Name: // buildComponentEditorTab // // Description: // Build a tab widget with the given label // // Input Arguments: // string $tabLayout - name of the tab layout in the window // int $idx - the index of new tab // string $label - name of the new tab // // Return Value: // none global proc buildComponentEditorTab( string $tabLayout, int $idx, string $label ) { string $newTabWidget = "compEdTabChild" + $idx; if ( !`formLayout -exists $newTabWidget` ) { setParent $tabLayout; formLayout $newTabWidget; separator -style "none"; setParent ..; setParent ..; string $tabCmd = "tabLayout -e -tl " + $newTabWidget + " \"" + $label + "\" " + $tabLayout; eval $tabCmd; } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // buildComponentEditorControls // // Description: // Build the component editor controls. Assumes a parent // MenuBarLayout has already been created. // // Input Arguments: // None // // Return Value: // None // global proc string buildComponentEditorControls(string $whichPanel) { string $parent = `setParent -q`; string $panel; if(size($whichPanel) == 0) { // find and isolate the part of the parent name containing // the unique name of the panel // string $tokens[]; tokenize ($parent,"|",$tokens); int $numTokes = `size $tokens`; int $j; for ($j = 0; $j < $numTokes; $j++) { string $mtchStr = `match $tokens[$j] "componentEditorPanel"`; int $num = `size $mtchStr`; if( $num == 0 ) { break; } } $panel = $tokens[$j]; } else { $panel = $whichPanel; } // Get the decimal precision // int $precision; if (!`optionVar -exists CEPrecision`) { optionVar -iv CEPrecision 3; } $precision = `optionVar -q CEPrecision`; // make the editor, but don't parent it yet // if (!`selectionConnection -exists ($panel + "CESelCon")`) { string $spam = `selectionConnection -activeList -parent $parent ($panel + "CESelCon")`; } else { selectionConnection -e -parent $parent ($panel + "CESelCon"); } string $edName = ($panel + "ComponEditor"); if(!`componentEditor -exists $edName`) { $edName = `componentEditor -unParent -pre $precision -mainListConnection ($panel + "CESelCon") $edName`; } else { componentEditor -e -unParent -mainListConnection ($panel + "CESelCon") $edName; } string $mainForm = `formLayout compEdForm`; string $tabLayout = `tabLayout -parent $mainForm compEdTab`; tabLayout -e -cc ("setTabOpType " + $tabLayout + " " + $edName + " -1") $tabLayout; setParent ..; // make the menus // buildCompEdMenus($edName, $tabLayout ); string $frameL = `frameLayout -p $mainForm -l "" compEdFrame`; string $compFormLayout = `formLayout`; int $isChecked = `optionVar -q CEAutoUpdate`; componentEditor -e -lockInput (!$isChecked) -parent $compFormLayout $edName; string $floatField = `floatField -width 75`; string $floatSliderMinField = `floatField -precision 2 -width 40`; string $floatSliderMaxField = `floatField -precision 2 -width 40`; string $floatSlider = `floatSlider`; componentEditor -e -floatSlider $floatSlider -floatField $floatField $edName; initComponentEditorSlider( $floatSlider, $floatSliderMinField, $floatSliderMaxField ); setParent ..; setParent ..; string $btnForm = `formLayout buttonForm`; string $rbtn = `button -p $btnForm -label (uiRes("m_componentEditorWindow.kLoadComponents")) -command ("compEdMenuCmd CEMILoad " + $edName) reloadBtn`; // close button won't exist in a non torn-off panel // only make it if we're in a window. // string $tokens[]; tokenize($parent,"|",$tokens); if($tokens[0] != "MayaWindow") { // Qt 4.8 with Alien widgets has some unwanted behaviour finding widgets under mouse // hide the window befoe deleting it,to prevent crash. MAYA-4487 string $cbtn = `button -p $btnForm -label (uiRes("m_componentEditorWindow.kClose")) -c ("window -edit -vis 0 " + $tokens[0] + "; evalDeferred( \"deleteUI -window " + $tokens[0] + "\")") closeBtn`; } setParent ..; setParent ..; setParent ..; // now construct a command to set the tab labels // // get the tab labels // string $labels[] = `componentEditor -q -operationLabels $edName`; // now create children of the tab layout // setParent $tabLayout; int $i, $numTabs = size($labels); for( $i = 0; $i < $numTabs; $i++ ) { formLayout ("compEdTabChild" + $i); separator -style "none"; setParent ..; } setParent ..; string $tabCmd = "tabLayout -e"; for ($i = 0; $i < $numTabs; $i++ ) { $tabCmd += (" -tl compEdTabChild" + $i + " \"" + $labels[$i] + "\""); } $tabCmd += " " + $tabLayout; // now set the labels // eval $tabCmd; // now set the tab type to the last remembered one // int $currentOp = `optionVar -q "CEoperationType"`; if($currentOp > 0 && $currentOp < $numTabs) { setTabOpType($tabLayout,$edName,$currentOp); tabLayout -e -selectTabIndex $currentOp $tabLayout; } else { // Call the backup version, to ensure all params and ghosting is taken care of setTabOpType($tabLayout,$edName,-1); } // lastly, do the form attachments // formLayout -e -af compEdTab "top" 0 -af compEdTab "left" 0 -af compEdTab "right" 0 -an compEdTab "bottom" -ac compEdFrame "top" 0 compEdTab // -af compEdFrame "top" 0 -af compEdFrame "right" 0 -af compEdFrame "left" 0 -af compEdFrame "bottom" 30 -an buttonForm "top" -af buttonForm "left" 3 -af buttonForm "right" 3 -af buttonForm "bottom" 3 $mainForm; formLayout -e -af reloadBtn "top" 0 -af reloadBtn "left" 0 -ap reloadBtn "right" 1 50 -af reloadBtn "bottom" 0 $btnForm; formLayout -e -af $edName "top" 0 -af $edName "left" 0 -af $edName "right" 0 -ac $edName "bottom" 5 $floatField -af $floatField "left" 0 -af $floatField "bottom" 2 -an $floatField "right" -an $floatField "top" -ac $floatSliderMinField "left" 10 $floatField -af $floatSliderMinField "bottom" 2 -an $floatSliderMinField "right" -an $floatSliderMinField "top" -ac $floatSlider "left" 0 $floatSliderMinField -ac $floatSlider "right" 0 $floatSliderMaxField -an $floatSlider "bottom" -aoc $floatSlider "top" 4 $floatSliderMinField -af $floatSliderMaxField "right" 0 -af $floatSliderMaxField "bottom" 2 -an $floatSliderMaxField "top" -an $floatSliderMaxField "left" $compFormLayout; if($tokens[0] != "MayaWindow") { formLayout -e -af closeBtn "top" 0 -ap closeBtn "left" 1 50 -af closeBtn "right" 0 -af closeBtn "bottom" 0 $btnForm; } CEsyncWindowToOptionVars($edName); scriptJob -p $parent -e "SceneOpened" ( "componentEditorSceneCB " + $edName + " " +$tabLayout ); return $edName; } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // componentEditorRememberWindow // // Description: // Post a dialogue, allowing the user to specify the new tab name, then create it // // Input Arguments: // string $editor - name of the component editor in the window // string $tabLayout - name of the tab layout in the window // // Return Value: // none // global proc componentEditorRememberWindow( string $compEd, string $tabLayout ) { string $remember = (uiRes("m_componentEditorWindow.kRemember")); string $cancel = (uiRes("m_componentEditorWindow.kCancel")); string $result = `promptDialog -title (uiRes("m_componentEditorWindow.kRememberLayout")) -message (uiRes("m_componentEditorWindow.kEnterName")) -messageAlign "left" -button $remember -button $cancel -defaultButton $remember -cancelButton $cancel -dismissString $cancel`; if ($result == $remember) { eval("componentEditorRemember \"" + $compEd + "\" \"" + $tabLayout + "\" \"" + `promptDialog -query -text` + "\""); } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // componentEditorRemember // // Description: // This creates a new tab in the component editor, based on the current selection. // // Input Arguments: // string $editor - name of the component editor in the window // string $tabLayout - name of the tab layout in the window // string $tabTitle - name of the new tab // // Return Value: // None global proc componentEditorRemember( string $editor, string $tabLayout, string $tabTitle ) { string $labels[] = `componentEditor -q -operationLabels $editor`; // Check for duplicate labels for ($label in $labels) { if( $label == $tabTitle ) { string $errorMsg = (uiRes("m_componentEditorWindow.kTabNameExists")); string $errorDisp = `format -s $tabTitle $errorMsg`; error ($errorDisp); return; } } string $entries[] = `componentEditor -q -sl $editor`; if( size( $entries ) > 0 ) { int $currentOp = `optionVar -q "CEoperationType"`; string $base = $labels[$currentOp-1]; // Extract the information from the set to build the tab string $nameTemplate = "CompEdTabSet_" + $tabTitle; string $newSet = `sets -name $nameTemplate $entries`; addAttr -ln "tabName" -dt "string" $newSet; string $tabAttr = $newSet + ".tabName"; setAttr $tabAttr -type "string" $tabTitle; addAttr -ln "baseName" -dt "string" $newSet; string $baseAttr = $newSet + ".baseName"; setAttr $baseAttr -type "string" $base; // Build the tab's data string $ceCmd = "componentEditor -e -newTab \"" + $base + "\" \"" + $tabTitle + "\" \"" + $newSet + "\" \"" + $editor + "\""; eval $ceCmd; // Build it's UI int $newIdx = `componentEditor -q -oc $editor`; buildComponentEditorTab( $tabLayout, $newIdx, $tabTitle ); // Set the new tab as current setTabOpType( $tabLayout, $editor, $newIdx ); tabLayout -e -selectTabIndex $newIdx $tabLayout; //int $newIdx = `componentEditor -q -oc $editor`; // int $newCEIdx = $newIdx - 1; // componentEditor -e -ot $newCEIdx $editor; } else { error (uiRes("m_componentEditorWindow.kNoItemsSelected")); } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // componentEditorRemoveTab // // Description: // This removes the current tab in the spread sheet editor. // // Input Arguments: // string $tabLayoutName - name of the tab layout in the window // string $compEdName - name of the component editor in the window // // Return Value: // None // global proc componentEditorRemoveTab(string $editor, string $tabLayout) { // First, get the label associated with the current tab. // string $tabNames[] = `tabLayout -q -tabLabel $tabLayout`; // If there is only one tab left, you can't remove it. // if ( size($tabNames) <= 7 ){ error (uiRes("m_componentEditorWindow.kCannotRemoveDefaultTabs")); return; } int $currentOp = `optionVar -q "CEoperationType"`; string $labels[] = `componentEditor -q -operationLabels $editor`; // Component editor indices are 0 based string $tabName = $labels[$currentOp - 1]; // Now delete the unwanted tab's UI // string $tabId = `tabLayout -q -st $tabLayout`; deleteUI $tabId; // and remove it's data string $tabSet = "CompEdTabSet_" + $tabName; componentEditor -e -removeTab $tabSet $editor; if( objExists( $tabSet ) ) { // Avoid errors if set has already been deleted delete $tabSet; } // Set the preivous, to the left, tab as current int $newIdx = $currentOp - 1; setTabOpType( $tabLayout, $editor, $newIdx ); tabLayout -e -selectTabIndex $newIdx $tabLayout; } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // componentEditorSceneCB // // Description: // When a new scene is loaded the old custom tabs must be deleted, and the new ones loaded // // Input Arguments: // string $tabLayoutName - name of the tab layout in the window // string $compEdName - name of the component editor in the window // // Return Value: // None // global proc componentEditorSceneCB( string $edName, string $tabLayout ) { // // Remove any tabs left over from the last scene // string $labels[] = `tabLayout -q -ca $tabLayout`; int $num = size( $labels ); while ( `tabLayout -q -nch $tabLayout` > 7 ) { tabLayout -e -sti 8 $tabLayout; string $tabId = `tabLayout -q -st $tabLayout`; deleteUI $tabId; } // get the custom tab sets, and build them string $customTabs[] = `ls -type objectSet "*CompEdTabSet_*"`; int $tabCnt = size( $customTabs ); int $i; for ($i = 0; $i < $tabCnt; $i++ ) { string $tabAttr = $customTabs[$i] + ".tabName"; string $tabName = `getAttr $tabAttr`; string $baseAttr = $customTabs[$i] + ".baseName"; string $baseName = `getAttr $baseAttr`; // Additional checking to make sure we've found a valid set if( size( $tabName ) > 0 && size ($baseName ) > 0 ) { componentEditor -e -newTab $baseName $tabName $customTabs[$i] $edName; } } // get the tab labels // $labels = `componentEditor -q -operationLabels $edName`; // now create children of the tab layout, the first 7 items (the default tabs) already exist // int $numTabs = size($labels); for( $i = 7; $i < $numTabs; $i++ ) { buildComponentEditorTab( $tabLayout, $i, $labels[$i] ); } } //////////////////////////////////////////////////////////////////////////////// // // Procedure Name: // componentEditorWindow // // Description: // Build the component editor window // // Input Arguments: // None // // Return Value: // Name of the component editor // global proc string componentEditorWindow() { string $edName; if ( !`window -exists componentEditorWin` ) { window -title (uiRes("m_componentEditorWindow.kComponentEditor")) -iconName (uiRes("m_componentEditorWindow.kComponents")) componentEditorWin; // now create a menuBarLayout // string $compEdMenLayout = `menuBarLayout compEdMenLayout`; $edName = `buildComponentEditorControls ""`; } else { $edName = "componentEditorWinComponEditor"; } showWindow componentEditorWin; return $edName; }