PDA

View Full Version : Exporting woes: face vertices


Marcel
10-26-2005, 04:08 PM
I'm trying to build an MEL script that exports mesh data to the X-file format.

I need to export the list of vertices, which I do somewhat like this:


for($i=0;$i<$vertCount;$i++)
{
float $vert[] = `getAttr ($mesh+".vt["+$i+"]")`;
-> export data


The vertices end up in a list, and with the indexes of the list I build the faces like this:

Vertices:
0.222780; 0.428977; 0.205035;
0.259622; 0.438517; 0.523871;
0.150889; 0.527702; 0.308754;
0.150889; 0.576815; 0.483982;
.........

Faces:
2, 1, 0;
3, 1, 2;
5, 2, 4;
5, 3, 2;
.....

The problem is that this doesn't give me correct results when a vertex has unshared normals or unshared UV's. For that I need to export the face-vertices, not the normal vertices.

Is there an easy way to export the face-vertices like this, and get a list of the indexes to the face vertices building up the faces? The only way I could do it now would be to sort a lot of stuff by hand, which is going to be dreadfully slow.

Robert Bateman
10-26-2005, 06:20 PM
the UV's are doable, however there's no real way of getting indexing for normals without dropping into the API. You might find my site handy (click the robthebloke link in the sig), there's an example or two of a mel exporter (in the mel scripting section of the site), and more than enough info about Maya API exporters to get you started....

Marcel
10-27-2005, 10:35 AM
Aah Rob the Bloke, just the man I need! :)

I actually took your script as an example, it has been really helpful. But am I correct that it doesn't export the normals correctly?

So you are saying that there is no quick way to get a list of all the correct vertex data (pos, uvs, normals) and a face index list using MEL? That sucks bigtime :sad:
This might be a good time to get to know the API then.

CGTalk Moderation
10-27-2005, 10:35 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.