// =========================================================================== // 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: 2001 // // // // // // attrPresetEditWin nodeType // // // None. // // // Opens the attribute preset editor window. This allows // one to delete presets for a given node type. // The initial node type to display must be specified. // // // attrPresetEditWin "transform"; // attrPresetEditWin "brush"; // global string $gApeWinPresetList = ""; global string $gApeWinNodeType = ""; global proc deleteSelectedAttrPresets(){ global string $gApeWinPresetList; global string $gApeWinNodeType; if( "" == $gApeWinPresetList ){ return; } if( "" == $gApeWinNodeType ){ return; } string $nodeType = $gApeWinNodeType; string $ppath = `internalVar -userPrefDir`; $ppath = substitute( "prefs", $ppath, "presets/attrPresets"); $ppath = $ppath + $nodeType; string $selectedPresets[] = `textScrollList -q -si $gApeWinPresetList`; string $preset; for( $preset in $selectedPresets ){ sysFile -delete ($ppath + "/" + $preset + ".mel" ); } if( size($selectedPresets) > 0 ){ updateAPEWinNodetype( $nodeType ); } } // // reset the nodetype being displayed by the attrPresetEditWin // global proc updateAPEWinNodetype( string $nodeType ){ global string $gApeWinPresetList; global string $gApeWinNodeType; if( !`window -exists attrPresetEditWin` ) { return; } if( "" == $gApeWinPresetList ){ return; } $gApeWinNodeType = $nodeType; string $title = (uiRes("m_attrPresetEditWin.kEditPresetsOptionTitle")); string $windowTitle = `format -s $nodeType $title`; window -e -t $windowTitle attrPresetEditWin; string $ppath = `internalVar -userPrefDir`; $ppath = substitute( "prefs", $ppath, "presets/attrPresets"); $ppath = $ppath + $nodeType; textScrollList -e -ra $gApeWinPresetList; string $fileList[]; int $numTokens = getPresetFiles($fileList, $ppath); // create Directory for current node type if ($numTokens > 0 && !($numTokens == 1 && $fileList[0] == "unknown")) { string $file; for ( $file in $fileList ) { // only show .mel files if( size( match( ".mel", $file ) ) ){ string $presetName = `substitute ".mel" $file ""`; textScrollList -e -append $presetName $gApeWinPresetList; } } } } // // Open the attribute Preset Editor // global proc attrPresetEditWin( string $nodeType ) { global string $gApeWinPresetList; global string $gApeWinNodeType; if( !`window -exists attrPresetEditWin` ) { string $titleText = (uiRes("m_attrPresetEditWin.kEditPresetsTitle")); string $windowTitle = `format -s $nodeType $titleText`; string $iconName = (uiRes("m_attrPresetEditWin.kEditPresets")); window -t $windowTitle -iconName $iconName -w 410 -h 150 attrPresetEditWin; formLayout fl; setParent -m ..; $gApeWinPresetList = `textScrollList -allowMultiSelection true psetList`; separator -horizontal true shelfSeparator; button -annotation (uiRes("m_attrPresetEditWin.kDeleteSelectedAnnot")) -label (uiRes("m_attrPresetEditWin.kDelete")) -c "deleteSelectedAttrPresets()" deleteAttrPresetButton; button -label (uiRes("m_attrPresetEditWin.kClose")) -c "window -e -visible false attrPresetEditWin" closeAttrPresetEdButton; formLayout -e -af shelfSeparator "left" 0 -af shelfSeparator "right" 0 -ac shelfSeparator "bottom" 5 closeAttrPresetEdButton -af psetList "top" 5 -af psetList "left" 5 -af psetList "right" 5 -ac psetList "bottom" 5 shelfSeparator -af deleteAttrPresetButton "left" 5 -af deleteAttrPresetButton "bottom" 5 -ap deleteAttrPresetButton "right" 3 50 -an deleteAttrPresetButton "top" -ap closeAttrPresetEdButton "left" 2 50 -af closeAttrPresetEdButton "bottom" 5 -af closeAttrPresetEdButton "right" 5 -an closeAttrPresetEdButton "top" fl; } updateAPEWinNodetype( $nodeType ); showWindow attrPresetEditWin; }