global proc int getEdges(string $tnode, vector $data[], int $world) {
print("getEdges world = " + $world + "\n");
string $shapes[] = `listRelatives -shapes $tnode`;
if(size($shapes) > 1)
return 0;
int $count = size($data);
int $num_edges[] = `polyEvaluate -e $tnode`;
string $shape = $shapes[0];
string $buffer[], $edge_info[];
string $edge_str, $vertex_str;
float $pnt[];
for($n = 0; $n < $num_edges[0]; $n++) {
$edge_str = $shape + ".e[" + $n + "]";
$edge_info = `polyInfo -edgeToVertex $edge_str`;
$numTokens = tokenize($edge_info[0], $buffer);
if($numTokens >= 4) {
$vertex_str = $shape + ".vtx[" + $buffer[2] + "]";
if($world)
$pnt = `pointPosition -world $vertex_str`;
else
$pnt = `pointPosition -local $vertex_str`;
$data[$count++] = <<$pnt[0], $pnt[1], $pnt[2]>>;
$vertex_str = $shape + ".vtx[" + $buffer[3] + "]";
if($world)
$pnt = `pointPosition -world $vertex_str`;
else
$pnt = `pointPosition -local $vertex_str`;
$data[$count++] = <<$pnt[0], $pnt[1], $pnt[2]>>;
}
}
return $num_edges[0];
}