// =========================================================================== // 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: May 2000 // // // // Procedure Name: // artFluidAttrVerifyGrid // // Description: // You can't paint a fluid property unless that // property is simulated using either a DynamicGrid // or a StaticGrid. If the user tries to paint a non- // grid property, pop up a confirm box // // This script is tied to the paintFluids tool via: // // artFluidAttrCtx -e -beforeStrokeCmd "artFluidAttrVerifyAttributeGrid" // // in artFluidAttrToolScript.mel, which creates the tool. // // Return Value: // None. // global proc artFluidAttrVerifyGrid( string $current) { string $create[]; if( !`exists activeFluidsVerifyGrid` ) { source "fluidsVerifyGrid.mel"; } if( `activeFluidsVerifyGrid $current $create` ) { return; } string $createDynamic = $create[0]; string $createStatic = $create[1]; // User is trying to paint an attribute that is NOT a grid-valued // attribute. Pop up confirm box and give him the option to // change it... // string $gridTypes; string $buttons; // Only need "Yes" button, since there's no choice for // Static grids on these attributes... // string $setToDynamic = (uiRes("m_artFluidAttrVerifyGrid.kSettoDynamic")); string $cancel = (uiRes("m_artFluidAttrVerifyGrid.kCancel")); string $setToStatic = (uiRes("m_artFluidAttrVerifyGrid.kSettoStatic")); if( size( $createStatic ) == 0 ) { $gridTypes = (uiRes("m_artFluidAttrVerifyGrid.kDynamic")); $buttons = ( "-button \"" + $setToDynamic + "\" " + "-button \"" + $cancel + "\" " + "-cancelButton \"" + $cancel + "\" " + "-defaultButton \"" + $setToDynamic + "\" " + "-dismissString \"" + $cancel + "\" " ); } else { $gridTypes = (uiRes("m_artFluidAttrVerifyGrid.kDynamicOrStatic")); $buttons = ( "-button \"" + $setToDynamic + "\" " + "-button \"" + $setToStatic + "\" " + "-button \"" + $cancel + "\" " + "-cancelButton \"" + $cancel + "\" " + "-defaultButton \"" + $setToDynamic + "\" " + "-dismissString \"" + $cancel + "\" " ); } string $currentUI = `substitute "and" $current " and "`; if( !`exists getActiveFluidShapes` ) { source "getFluidShape.mel"; } string $selFluids[] = `getActiveFluidShapes`; string $title = (uiRes("m_artFluidAttrVerifyGrid.kCanNotPaint")); $title = `format -s $currentUI -s $selFluids[0] $title`; string $msg = (uiRes("m_artFluidAttrVerifyGrid.kPaintAttributeMsg")); $msg = `format -s $gridTypes $msg`; string $confirmCmd = ( "confirmDialog -title \"" + $title + "\" -message \"" + $msg + "\" " + $buttons ); string $response = eval( $confirmCmd ); if( $response == $setToDynamic ) { evalEcho( $createDynamic ); } else if( $response == $setToStatic ) { evalEcho( $createStatic ); } }