PDA

View Full Version : Randomizing CVs of a Curve


BadG3r
02-24-2009, 09:02 AM
Hey guys!

I tried to do a simple thing, but somehow I got this error.

// Error: Error while parsing arguments. //

So, I guess it is how I try to implement the objects name in the moveVertex command. Everything else I checked, so I believe it must be the $obj variable. How can I reference the name in the script?


string $objs[] = `ls -sl`;
string $obj;

for ($obj in $objs) {
$rand = rand (25);
vector $t = dnoise (<<$rand,$rand*2,$rand*4>>);
moveVertexAlongDirection -d ($t) -m ($t) $obj.cv[0:5];
}


igor

benio33
02-24-2009, 09:43 AM
The one below works. Put $maxVertNum for the numer of vertexes in your curve. You can do a function check how many verts are there in your selection if you want but the one below works. Gotta get back to work :)

string $objs[] = `ls -sl`;
$maxVertNum = 20;

for ($counter=0; $counter<$maxVertNum; $counter++) {
$rand = rand (25);
vector $t = dnoise (<<$rand,$rand*2,$rand*4>>);
$mag = mag($t);
$x = $t.x;
$y = $t.y;
$z = $t.z;
moveVertexAlongDirection -d $x $y $z -m $mag ($objs[0] + ".cv[" + $counter + "]");
};

CGTalk Moderation
02-24-2009, 09:43 AM
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.