tciny
02-03-2006, 06:48 PM
I just had a little time to spare :)
It'll create those wobbly lines from the first selected NURBS object.
If you just source the whole thing you'll see how it works on a cylinder and a plane.
Its a pretty ugly hack, but it works so far :)
global proc nurbsToAnimatedCurves( int $samplesU, int $samplesV, float $noiseMulti, float $timeFactor, int $closeCurve )
{
// Query the selection (only the first element is of interest)
string $nodes[];
$nodes = `selectedNodes -dagObjects`;
float $curPos[3], $u, $v;
string $curCurveCommand, $curExpCommand, $newCurveName;
for( $u=0; $u<=$samplesU; $u++ )
{
// Get all points of the current curve and build the command
$curCurveCommand = "curve -d 3 ";
$curExpCommand = "expression -s \"";
for( $v=0; $v<$samplesV; $v++ )
{
$curPos = `pointOnSurface -top true -u ((1.0/$samplesU)*$u) -v ((1.0/$samplesV)*$v) -p $nodes[0]`;
$curCurveCommand += "-p " + $curPos[0] + " " + $curPos[1] + " " + $curPos[2] + " ";
$curExpCommand += $nodes[0] + "nurbsAnimCurve" + $u + ".cp[" + $v + "].xv = " + $curPos[0] + " + (noise((time)/" + $timeFactor + "+" + rand(50) + ") * " + $noiseMulti + "); ";
$curExpCommand += $nodes[0] + "nurbsAnimCurve" + $u + ".cp[" + $v + "].yv = " + $curPos[1] + " + (noise((time)/" + $timeFactor + "+" + rand(50) + ") * " + $noiseMulti + "); ";
$curExpCommand += $nodes[0] + "nurbsAnimCurve" + $u + ".cp[" + $v + "].zv = " + $curPos[2] + " + (noise((time)/" + $timeFactor + "+" + rand(50) + ") * " + $noiseMulti + "); ";
}
$curCurveCommand += ";";
$curExpCommand += "\" -o \"\" -ae 1 -uc all;";
// Create curve and expression
$newCurveName = eval( $curCurveCommand );
if( $closeCurve )
closeCurve -ch 1 -ps 1 -rpo 1 -p 0 $newCurveName;
rename $newCurveName ($nodes[0] + "nurbsAnimCurve" + $u);
eval( $curExpCommand );
}
}
// Test with cylinder
cylinder -n nurbsCyl;
nurbsToAnimatedCurves( 10, 10, 0.1, 2, true );
hide nurbsCyl;
// Test with plane
nurbsPlane -p 3 0 0 -width 5 -n teewurst;
nurbsToAnimatedCurves( 10, 10, 0.15, 0.25, false );
hide teewurst;
CGTalk Moderation
02-03-2006, 06:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.