LordMcGoat
11-08-2005, 09:25 PM
Hi,
I'm trying to write a script to keyframe all the vertex positions of an object for animation. The trouble is, the script also needs to hand move all the vertices to a given position before keyframing, and needs to do this for everyframe.
I can't seem to write anything that won't crash my computer if done for more than a few frames. What I have at the moment is:
proc bakeVerts()
{
int $i,$j;
int $finTime = 200;
currentTime -edit 0;
for($i=0;$i<$finTime;$i++)
{
geomMove();
for($j=0;$j<$maxVerts;$j++)
{
setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 polySurface31.vtx[$j];
}
currentTime -edit ($i+1);
}
}
Where the geomMove function is:
proc geomMove()
{
float $location[2];
for($i=0;$i<=$maxVerts;$i++)
{
$location = `pointPosition ("locator"+($i+1))`;
select -r polySurface31.vtx[$i];
move $location[0] $location[1] $location[2];
}
}
Any ideas on how I can do this better? I mean I don't mind it being slow, since it has to key every vertex for every frame (incidentally, there are 1616 verts on the mesh im applying the script to), as long as it doesn't crash my computer.
Thanks
I'm trying to write a script to keyframe all the vertex positions of an object for animation. The trouble is, the script also needs to hand move all the vertices to a given position before keyframing, and needs to do this for everyframe.
I can't seem to write anything that won't crash my computer if done for more than a few frames. What I have at the moment is:
proc bakeVerts()
{
int $i,$j;
int $finTime = 200;
currentTime -edit 0;
for($i=0;$i<$finTime;$i++)
{
geomMove();
for($j=0;$j<$maxVerts;$j++)
{
setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 polySurface31.vtx[$j];
}
currentTime -edit ($i+1);
}
}
Where the geomMove function is:
proc geomMove()
{
float $location[2];
for($i=0;$i<=$maxVerts;$i++)
{
$location = `pointPosition ("locator"+($i+1))`;
select -r polySurface31.vtx[$i];
move $location[0] $location[1] $location[2];
}
}
Any ideas on how I can do this better? I mean I don't mind it being slow, since it has to key every vertex for every frame (incidentally, there are 1616 verts on the mesh im applying the script to), as long as it doesn't crash my computer.
Thanks
