// =========================================================================== // 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: 15 Aug 1997 // // Description: // Add a render attribute to the particle shape. The attribute // description is passed in as attrInfo. The description comes // from the render subclasses. It describes the name, type, min, // max values, and what type of ui to build. // global proc dynAddParticleAttr( string $nodeName, string $attrInfo ) { string $cmd; string $tokenAry[]; int $tokenCnt; int $makeKeyable = 1; tokenize( $attrInfo, ":", $tokenAry ); $tokenCnt = size( $tokenAry ); // Adding a string attr is a special case because we cannot use the // default value (-dv) command. We need to set the attribute // seperately. // if (($tokenCnt >= 3) && ($tokenAry[2] == "textfield")) { $cmd = "addAttr -is true -dt \"string\" -ln \"" +$tokenAry[0]+ "\" " +$nodeName+";"; evalEcho $cmd; $cmd = "setAttr -type \"string\" " + $nodeName+"."+$tokenAry[0] + " \"" + $tokenAry[1] + "\";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "toggleBtn")) { $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at bool -dv "+$tokenAry[1]+" " +$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "intSlider")) { $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at long -min "+$tokenAry[3] +" -max "+$tokenAry[4]+" -dv "+$tokenAry[1]+" " +$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "floatSlider")) { $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at \"float\" -min "+$tokenAry[3] +" -max "+$tokenAry[4]+" -dv "+$tokenAry[1]+" " +$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "intField")) { $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at long -dv "+$tokenAry[1]+" " +$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "vector")) { $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -dt double3 " +$nodeName+";"; evalEcho $cmd; eval( "setAttr -type double3 "+$nodeName+"."+$tokenAry[0]+" 0 0 0;" ); $makeKeyable = 0; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "vectorArray")) { $makeKeyable = 0; $cmd = "addAttr -ln "+$tokenAry[0]+" -dt vectorArray "+$nodeName+";"; evalEcho $cmd; // Add the initial state attribute. // $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt vectorArray "+$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "intArray")) { $makeKeyable = 0; $cmd = "addAttr -ln "+$tokenAry[0]+" -dt Int32Array "+$nodeName+";"; evalEcho $cmd; // Add the initial state attribute. // $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt Int32Array "+$nodeName+";"; evalEcho $cmd; } else if (($tokenCnt >= 3) && ($tokenAry[2] == "floatArray")) { $makeKeyable = 0; $cmd = "addAttr -ln "+$tokenAry[0]+" -dt doubleArray "+$nodeName+";"; evalEcho $cmd; // Add the initial state attribute. // $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt doubleArray "+$nodeName+";"; evalEcho $cmd; } else { $cmd = "addAttr -is true -ln \"" +$tokenAry[0]+ "\" -dv " +$tokenAry[1]+ " " +$nodeName+";"; evalEcho $cmd; } if ($makeKeyable) { setAttr -keyable true ($nodeName+"."+$tokenAry[0]); } } // dynAddParticleAttr //