// =========================================================================== // 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: Oct 26 1999 // // // Description: // This script updates the possibly out of date shelf items. // Go through all the shelf items we have and see if we can // find some with callbacks we know are not valid anymore. // If we do find some, change them, count them and tell the user. // // Usually conditionally called from initShelf.mel based on the // cut ID of the last update. // { // Get a listing of all of the shelves global string $gShelfTopLevel; string $shelves[] = `tabLayout -q -ca $gShelfTopLevel`; string $aShelf; int $someUpdated = 0; for ($aShelf in $shelves) { // Go through all the shelves' items; we only look at // the shelfButtons at this time; toolButtons are the // only other control that could show up in there, // and they don't have the callback type that we // could or would reset. string $shelfItems[] = `shelfLayout -q -ca $aShelf`; string $ctl; string $cmd; for ($ctl in $shelfItems) { // Only deal with "shelfButton"s if( "shelfButton" != `objectType $ctl` ) continue; string $ctlCmd = `shelfButton -q -c $ctl`; string $printMsg = (uiRes("m_updateShelves.kUpdatingShelf")); $printMsg = `format -s $ctl -s $ctlCmd $printMsg`; if( "setToolTo curveContextCV" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveCVToolScript 4" -dcc "curveCVToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveContextCV; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveCVToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveContextEP" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveEPToolScript 4" -dcc "curveEPToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveContextEP; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveEPToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo pencilContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveSketchToolScript 4" -dcc "curveSketchToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo pencilContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveSketchToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo threePointArcContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "threePointArcToolScript 4" -dcc "threePointArcToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo threePointArcContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "threePointArcToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo twoPointArcContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "twoPointArcToolScript 4" -dcc "twoPointArcToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo twoPointArcContext; toolProperyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "twoPointArcToolScript 3" $ctl; $someUpdated +=1; } else if( "setToolTo stitchSrfContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "stitchSrfToolScript 4" -dcc "stitchSrfToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo stitchSrfContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "stitchSrfToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo trimContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "trimToolScript 4" -dcc "trimToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo trimContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "trimToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo roundContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "roundToolScript 4" -dcc "roundToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo roundContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "roundToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo puttyContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "puttyToolScript 4" -dcc "puttyToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo puttyContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "puttyToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo selectPaintContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "selectPaintToolScript 4" -dcc "selectPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo selectPaintContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "selectPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo userPaintContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "userPaintToolScript 4" -dcc "userPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo userPaintContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "userPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo attrPaintContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "attrPaintToolScript 4" -dcc "attrPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo attrPaintContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "attrPaintToolScript 3" $ctl; $someUpdated += 1; } else if( "performExtrude(0)" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performExtrude(0, \"\")" $ctl; $someUpdated += 1; } else if( "performRevolve(0)" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performRevolve(0, \"\")" $ctl; $someUpdated += 1; } else if( "performLoft(0)" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performLoft(0, \"\")" $ctl; $someUpdated += 1; } else if( "performCutCurve 0" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performCutCurve( 0, \"\" )" $ctl; $someUpdated += 1; } else if( "performIntersectCrv 0" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performIntersectCrv( 0, \"\")" $ctl; $someUpdated += 1; } else if( "setToolTo curveAddPtContext " == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveAddPtToolScript 4" -dcc "curveAddPtToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveAddPtContext ; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveAddPtToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveEditorContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveEditorToolScript 4" -dcc "curveEditorToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo curveEditorContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "curveEditorToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo birailOneProfileContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 4 1" -dcc "birailToolScript 3 1" $ctl; $someUpdated += 1; } else if( "setToolTo birailOneProfileContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 3 1" $ctl; $someUpdated += 1; } else if( "setToolTo birailTwoProfileContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 4 2" -dcc "birailToolScript 3 2" $ctl; $someUpdated += 1; } else if( "setToolTo birailTwoProfileContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 3 2" $ctl; $someUpdated += 1; } else if( "setToolTo birailThreePlusProfileContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 4 3" -c "birailToolScript 3 3" $ctl; $someUpdated += 1; } else if( "setToolTo birailThreePlusProfileContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "birailToolScript 3 3" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanUnionContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 4 0" -dcc "nurbsBooleanToolScript 3 0" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanUnionContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 3 0" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanSubtractContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 4 1" -dcc "nurbsBooleanToolScript 3 1" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanSubtractContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 3 1" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanIntersectContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 4 2" -dcc "nurbsBooleanToolScript 3 2" $ctl; $someUpdated += 1; } else if( "setToolTo nurbsBooleanIntersectContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "nurbsBooleanToolScript 3 2" $ctl; $someUpdated += 1; } else if( "setToolTo blendContext" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "blendToolScript 4" -c "blendToolScript 3" $ctl; $someUpdated += 1; } else if( "setToolTo blendContext; toolPropertyWindow" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "blendToolScript 3" $ctl; $someUpdated += 1; } else if( "performRebuildSurface 0" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performRebuildSurface( 0, \"\")" $ctl; $someUpdated += 1; } else if( "performGlobalStitch 0" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performGlobalStitch( 0, \"\")" $ctl; $someUpdated += 1; } else if( "performInsertKnot 0 Surface" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performInsertKnot( 0, "Surface", \"\")" $ctl; $someUpdated += 1; } else if( "performInsertKnot 0 Curve" == $ctlCmd ) { print($printMsg); shelfButton -edit -c "performInsertKnot( 0, "Curve", \"\")" $ctl; $someUpdated += 1; } else if ("PaintSelectionTool" == $ctlCmd) { // We're catching references to the old // Paint Selection Tool, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintSelectTool" $ctl; $someUpdated += 1; } else if ("PaintSelectionToolOptions" == $ctlCmd) { // We're catching references to the old // Paint Selection Tool Options, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintSelectToolOptions" $ctl; $someUpdated += 1; } else if ("AttributePaintTool" == $ctlCmd) { // We're catching references to the old // Attribute Paint Tool, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintAttrTool" $ctl; $someUpdated += 1; } else if ("AttributePaintToolOptions" == $ctlCmd) { // We're catching references to the old // Attribute Paint Tool Options, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintAttrToolOptions" $ctl; $someUpdated += 1; } else if ("PaintSkinWeightsTool" == $ctlCmd) { // We're catching references to the old // Paint SkinWeights Tool, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintSkinWeightsTool" $ctl; $someUpdated += 1; } else if ("PaintSkinWeightsToolOptions" == $ctlCmd) { // We're catching references to the old // Paint SkinWeights Tool Options, and turning them // into the new one. print($printMsg); shelfButton -edit -c "ArtPaintSkinWeightsToolOptions" $ctl; $someUpdated += 1; } else if ("paintColorToolScript 4" == $ctlCmd) { // We're catching references to the old // Paint Textures Tool, and turning them // into the new one. print($printMsg); shelfButton -edit -c "Art3dPaintTool" $ctl; $someUpdated += 1; } else if ("paintColorToolScript 3" == $ctlCmd) { // We're catching references to the old // Paint Textures Tool Options, and turning them // into the new one. print($printMsg); shelfButton -edit -c "Art3dPaintToolOptions" $ctl; $someUpdated += 1; } else if ("PaintWeightsTool" == $ctlCmd) { // We're catching references to the old // Paint Weights Tool, and turning them // into the new one. print($printMsg); shelfButton -edit -c "artAttrToolScript 4 \"cluster\"" $ctl; $someUpdated += 1; } else if ("PaintWeightsToolOptions" == $ctlCmd) { // We're catching references to the old // Paint Weights Tool Options, and turning them // into the new one. print($printMsg); shelfButton -edit -c "artAttrToolScript 3 \"cluster\"" $ctl; $someUpdated += 1; } else { // From Maya 3.0 to 4.0, projectTangentPreset gained a // 9th argument. If we find a shelf item that has 8 args // (and not 9 args), add the 9th (with value 0). // The check for 9 args ensures that from Maya 4.0 to 5.0 // we don't inadvertently add a bogus extra one on. // // $matched8Args will actually match 8 or more args and // $matched9Args will match 9 or more, but the logic still // works out so I won't mess with it. // string $matched8Args = `match "^projectTangentPreset(.*,.*,.*,.*,.*,.*,.*,.*).*" $ctlCmd`; string $matched9Args = `match "^projectTangentPreset(.*,.*,.*,.*,.*,.*,.*,.*,.*).*" $ctlCmd`; if( "" != $matched8Args && "" == $matched9Args ) { // Have to add an extra argument at the end... string $newOne = `substitute "\\)" $ctlCmd ",0)"`; print($printMsg); shelfButton -edit -c $newOne $ctl; $someUpdated += 1; } } } } if( $someUpdated > 0 ) { string $warningMsg = (uiRes("m_updateShelves.kUpadtedShelfItems")); warning(`format -s $someUpdated $warningMsg` ); } }