// =========================================================================== // 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: 20 Feb 2002 // // Description: // This is a helper script to set fluid gradient types // using the corresponding option box values. // global proc doFluidGradients( int $version, string $args[] ) { if(( $version < 1 ) || ( size( $args ) < 8 )) { error(uiRes("m_doAppendHairCache.kIncorrectVersion")); return; } if( !`exists getActiveFluidShapes` ) { source getFluidShape.mel; } string $fluids[] = getActiveFluidShapes(); if( size( $fluids ) == 0 ) { error(uiRes("m_doDeleteFluidsPB.kNoFluidsSelected")); return; } int $doDensity = $args[0]; int $densityType = $args[1]; int $doVelocity = $args[2]; int $velocityType = $args[3]; int $doTemperature = $args[4]; int $temperatureType = $args[5]; int $doFuel = $args[6]; int $fuelType = $args[7]; if( !( $doFuel || $doTemperature || $doVelocity || $doDensity ) ) { error((uiRes("m_doFluidGradients.kSelectFluidProperty"))); return; } string $densityValues, $densityEnables; string $velocityValues, $velocityEnables; string $temperatureValues, $temperatureEnables; string $fuelValues, $fuelEnables; // Have enough values for the setAttr cmd to work on // all active fluids. // for( $f in $fluids ) { // "3" is the setAttr value for gradient. // $densityEnables += "3 "; $velocityEnables += "3 "; $temperatureEnables += "3 "; $fuelEnables += "3 "; // Have to add three since the option box values // are 1-based and the first gradient method ATTR // value is 4... // $densityValues += ($densityType + 3) + " "; $velocityValues += ($velocityType + 3) + " "; $temperatureValues += ($temperatureType + 3) + " "; $fuelValues += ($fuelType + 3) + " "; } if( $doDensity ) { evalEcho( "setAttr \".densityMethod\" " + $densityEnables ); evalEcho( "setAttr \".densityGradient\" " + $densityValues ); } if( $doVelocity ) { evalEcho( "setAttr \".velocityMethod\" " + $velocityEnables ); evalEcho( "setAttr \".velocityGradient\" " + $velocityValues ); } if( $doTemperature ) { evalEcho( "setAttr \".temperatureMethod\" " + $temperatureEnables ); evalEcho( "setAttr \".temperatureGradient\" " + $temperatureValues ); } if( $doFuel ) { evalEcho( "setAttr \".fuelMethod\" " + $fuelEnables ); evalEcho( "setAttr \".fuelGradient\" " + $fuelValues ); } }