views:

56

answers:

2

Hey, I have a skinned mesh that animates over time. I'm writing a quick export script to export out my verticies.

How do I output the vertices per frame?

I'm getting the verticies using getVert, but how do I specify which frame to get the vertex from?

Thanks ASH

A: 

you can use "at time" for the whole mesh. e.g. "at time i mmesh=snapshotAsMesh obj"

where "i" is the frame you want, "obj" the existing object and "mmesh" the resulting mesh. on mmesh you can do your usual getvert functions.

pandrr
A: 

The following code is untested, but something like it should work for you. Please let me know if there are any changes you need to make.

/* Exports mesh data 'm' to file 'f' */ 
def exportData m f = (
  format "%,%\n" m.numverts m.numfaces to:f
  for i = 1 to m.numverts do
  format "%," (getVert m i) to:f
    format "\n" to:f
  for i = 1 to m.numfaces do
    format "%," (getFace m i) to:f
)

/* Exports mesh data from a node 'n' at time 't' to file 'f' */ 
def exportNodeMeshAtTime t n f = 
(
  at time t 
    m = snapshotAsMesh n
  exportMesh m f
)

/* Create a text file for receiving the data */
out_file = createfile ((GetDir #export)+"/testmesh.dat")

/* Enumerate all times in the animation range, exporting
   the mesh data from the selected node at time t. */ 
for t = animationRange.start to animationRange.end do (
  exportNodeMeshAtTime t selection[1] out_file
)

/* Close the text file */
close out_file
cdiggins