// =========================================================================== // 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: 06 Jan 2004 // // Description: // Populates a ramp control widget from the control points described in // an option var. // // global proc setRampAttributeFromOptionVar( string $node, string $rampAttr, string $optionVar ) { string $optionVars[] = `optionVar -q $optionVar`; int $points = `size $optionVars`; int $instances = `getAttr -size ( $node + "." + $rampAttr )`; int $i; for ( $i = $points; $i < $instances; $i++ ) { removeMultiInstance ( $node + "." + $rampAttr + "[" + $i + "]" ); } for ( $i = 0; $i < $points; $i++ ) { string $values[]; tokenize $optionVars[$i] "," $values; float $value = $values[0]; float $position = $values[1]; int $interp = $values[2]; setAttr ( $node + "." + $rampAttr + "[" + $i + "]." + $rampAttr + "_Position" ) $position; setAttr ( $node + "." + $rampAttr + "[" + $i + "]." + $rampAttr + "_FloatValue" ) $value; setAttr ( $node + "." + $rampAttr + "[" + $i + "]." + $rampAttr + "_Interp" ) $interp; } }