drosen
11-04-2010, 03:39 PM
Im working on a group project which requires us to procedurally generate trees in Maya. My job is to distribute the leaves throughout the branches. Im trying to create a locator at each branch's vertices (low poly count for the branches) and then randomly building the leaves off each locator. Im having trouble sending out the locators
p, li { white-space: pre-wrap; } int $vtxRand;
string $object = "myObj";
int $i;
int $count[] = `polyEvaluate -v myObj`;
string $counterList[] = `size($count)`;
string $counter = ($object + ".vtx[" + $counterList + "]");
string $vertex[] = `ls $counter`;
for ($currvert in $vertex)
{
spaceLocator;
$arraySizeVertex = `size($vertex)`;
int $vetx = `rand 0 $arraySizeVertex`;
float $vtxPos[] = `pointPosition $vertex[$vetx]`;
move ($vtxPos[0] + `rand(2)`) $vtxPos[1] ($vtxPos[2] + `rand(-1)`);
}
I'm getting the error: p, li { white-space: pre-wrap; } // Error: string $counter = ($object + ".vtx[" + $counterList + "]"); //
// Error: Line 7.53: Illegal operation "+" on data of type string[]. //
Was wondering either what the solution would be or if there is a more elegant way of accomplishing the leaf distribution.
p, li { white-space: pre-wrap; } int $vtxRand;
string $object = "myObj";
int $i;
int $count[] = `polyEvaluate -v myObj`;
string $counterList[] = `size($count)`;
string $counter = ($object + ".vtx[" + $counterList + "]");
string $vertex[] = `ls $counter`;
for ($currvert in $vertex)
{
spaceLocator;
$arraySizeVertex = `size($vertex)`;
int $vetx = `rand 0 $arraySizeVertex`;
float $vtxPos[] = `pointPosition $vertex[$vetx]`;
move ($vtxPos[0] + `rand(2)`) $vtxPos[1] ($vtxPos[2] + `rand(-1)`);
}
I'm getting the error: p, li { white-space: pre-wrap; } // Error: string $counter = ($object + ".vtx[" + $counterList + "]"); //
// Error: Line 7.53: Illegal operation "+" on data of type string[]. //
Was wondering either what the solution would be or if there is a more elegant way of accomplishing the leaf distribution.
