so... I have this programming project due , and I just can't seem to fix this bug.
--this is the script I'm using:
file -f -new;
string $window = window -t "General Conditionions" -mnb false -mxb false
-widthHeight 400 110;
columnLayout -adjustableColumn true;
text " ";
text "Please ensure the following conditions are met:";
text "1.) SmoothShade all is turned on";
text "2.) High Quality is turned on";
text "Thank you. Press ESC to pause playback.";
text " ";
button -l "Close Window" -command ("deleteUI -window " + $window) -w 55;
showWindow;
// set up spiral process string
global proc string spiral ( float $ht, float $radius, float $numRounds )
{
string $cone[] = cone -ch off -po 0 -p 0 0.2 0 -hr 0.5 -r 1 -ax 0 -1 0;
scale $radius $ht $radius $cone[0];
string $cos = curveOnSurface -d 1 -uv 0.0 0.0 -uv 1.0 ($numRounds*2.5) $cone[0];
string $duplicatedCrv[] = duplicateCurve -ch off $cos;
delete $cos;
delete $cone[0];
return $duplicatedCrv[0];
}
// creating basic spirals and reversing direction
// this is to have the particles move from the bottom to the top
spiral(40, 10, 10);
spiral(40, -10, 10);
select -r duplicatedCurve1;
rename "curve1" ;
reverseCurve -ch off -replaceOriginal on curve1;
select -r duplicatedCurve2;
rename "curve2" ;
reverseCurve -ch off -replaceOriginal on curve2;
select -r curve1 curve2;
string $selection_list[] = ls -selection;
string $curveSelected;
for ($curveSelected in $selection_list)
{
string $curveSelected = $selection_list[0];
float $startOffset = 0.1;
float $speed = (1.0 / 16.0);
offsetCurve -d $startOffset -n ($curveSelected + "guide");
float $startPoint[] = pointOnCurve -pr 0 -p $curveSelected;
float $startTangent[] = pointOnCurve -pr 0 -nt $curveSelected;
float $startGuide[] = pointOnCurve -pr 0 -p ($curveSelected + "guide");
float $startNormal[];
$startNormal[0] = $startGuide[0] - $startPoint[0];
$startNormal[1] = $startGuide[1] - $startPoint[1];
$startNormal[2] = $startGuide[2] - $startPoint[2];
// set up emitter and its attributes
emitter -pos $startGuide[0] $startGuide[1] $startGuide[2]
-dx $startTangent[0] -dy $startTangent[1] -dz $startTangent[2]
-n ($curveSelected + "emitter") -spd 0.0
-type dir;
particle -n ($curveSelected + "particles");
setAttr ($curveSelected + "particlesShape.expressionsAfterDynamics") true;
select -r ($curveSelected + "particlesShape");
addAttr -ln "speed" -at "float";
setAttr ($curveSelected + "particlesShape.speed") $speed;
addAttr -ln "scaleOffset" -at "float";
setAttr ($curveSelected + "particlesShape.scaleOffset") $startOffset;
connectDynamic -em ($curveSelected + "emitter")
($curveSelected + "particles");
parent ($curveSelected + "emitter") $curveSelected;
string $mainCurveInfoNode = pointOnCurve -ch on
-pr 0 $curveSelected;
string $guideCurveInfoNode = pointOnCurve -ch on
-pr 0 ($curveSelected + "guide");
// create expression for the particles movement alond the curve
string $exprString =
"float $curve_param = " + $curveSelected + "particlesShape.age * " +
$curveSelected + "particlesShape.speed;\n" +
"setAttr " + $mainCurveInfoNode + ".parameter $curve_param;\n" +
"setAttr " + $guideCurveInfoNode + ".parameter $curve_param;\n" +
"float $pos[] = getAttr " + $mainCurveInfoNode + ".position;\n" +
"float $tan[] = getAttr " + $mainCurveInfoNode +
".normalizedTangent;\n" +
"float $normEnd[] = getAttr " + $guideCurveInfoNode +
".position;\n" +
"float $norm[];\n" +
"$norm[0] = $normEnd[0] - $pos[0];\n" +
"$norm[1] = $normEnd[1] - $pos[1];\n" +
"$norm[2] = $normEnd[2] - $pos[2];\n" +
"vector $posvec = <>;\n" +
"vector $tanvec = <>;\n" +
"vector $normvec = unit(<>);\n" +
"vector $norm2vec = cross($tanvec, $normvec);\n" +
$curveSelected + "particlesShape.position = $posvec + \n" +
// The oscillations are muliplied by "particlesShape.age"
// to move the particles further away from the curves as they age.
// '(frame/10)/time' magnifies that change in distance.
"(" + $curveSelected +
"particlesShape.scaleOffset * $normvec * " +
$curveSelected + "particlesShape.age * (frame/10)/time * cos(" +
$curveSelected + "particlesShape.age*20)) + \n" +
"(" + $curveSelected +
"particlesShape.scaleOffset * $norm2vec * " +
$curveSelected + "particlesShape.age * (frame/10)/time * sin(" +
$curveSelected + "particlesShape.age*20));\n";
// set up color ramp window for custom use
// ramp defaults are defined below
string $ramp1 = createNode ramp;
window -t "Ramp Settings" -mxb false;
columnLayout;
rampColorPort -node $ramp1;
showWindow;
// define ramp color defaults
setAttr ramp1.colorEntryList[1].position 0.166;
setAttr ramp1.colorEntryList[1].color -type double3 1 1 0;
setAttr ramp1.colorEntryList[3].position 0.333;
setAttr ramp1.colorEntryList[3].color -type double3 0 1 0;
setAttr ramp1.colorEntryList[4].position 0.501;
setAttr ramp1.colorEntryList[4].color -type double3 0 1 1 ;
setAttr ramp1.colorEntryList[2].position 0.667;
setAttr ramp1.colorEntryList[5].color -type double3 1 0 1;
setAttr ramp1.colorEntryList[5].position 0.833;
setAttr ramp1.colorEntryList[6].position 1;
// create arrayMapper and connect it
radial -pos 0 0 0 -name pushIn -m -2 -att 0 -typ 0 -mxd -1 -vsh
sphere -vex 1-vof 0 0 0 -vsw 360 -tsr 0.5 ;
scale 10 10 10;
connectDynamic -f pushIn ($curveSelected + "particlesShape");
addAttr -ln "rgbPP" -dt vectorArray ($curveSelected + "particlesShape");
arrayMapper -mt ramp1 -target ($curveSelected + "particlesShape")
-destAttr rgbPP -inputV rgbVPP;
// add distance expression to ramp,
// so particles change color a they move away from the emitter
dynExpression -s "rgbVPP = mag( position )/(frame/time);"
-rbd ($curveSelected + "particlesShape");
// set up Point Size slider
setAttr ($curveSelected + "particlesShape.particleRenderType") 3;
addAttr -is true -ln "pointSize" -at long
-min 1 -max 10 -dv 5 ($curveSelected + "particlesShape");
// Attach expression string to the particle object:
dynExpression -rad -s $exprString ($curveSelected + "particles");
dynExpression -c -s $exprString ($curveSelected + "particles");
}
// Set playback range and begin playback from min to max//
currentTime 0;
playbackOptions -minTime 0sec -maxTime 16sec -loop once;
play -f true;
--- sorry, it's really long...
so, I'm having trouble with the offestCurve part (>offsetCurve -d $startOffset -n ($curveSelected + "guide")
. It keep coming up with an error " line 53: Too many arguments. Expected 1, found 0."
anybody know what I can do to fix it?