   Mel - Returning the UV from a face.
  Hello!Currently i am working on a exporing script from maya 2008, and i need to get the UV´S from a face, no har deal. got them with the "polyListComponentConversion" but the thing is that i can only acces the one of them, i whant to access the second and the third of thos UV´s.if there is some one who could either explain this to me or write me a example code i would be wery happy!   
  It's a bit of a pita, but do-able. Getting most data out of maya can be done by calling getAttr on the relevant attributes. That works fine for the UV coords and UV set names, but rather annoyingly not for the UV indicies (since the fc attribute is an un-defined polyFaces type). The trick is to set the current UV set, and then polyListComponentConversion returns the correct UV indices. Knocked out a quick example of how to do it, which should get you going:proc dumpUvs(string $mesh){  $parent = `listRelatives -p $mesh`;  $numUvSets = `getAttr -s ($mesh + ".uvst")`;  for($i=0;$i<$numUvSets;++$i)  {    // grab the UV set name    $uvsetname = `getAttr ($mesh + ".uvst["+$i+"].uvsn")`;    print ("UVSET: " + $uvsetname + "\n");   // dump the UV coords.    $numuvs = `getAttr -s ($mesh + ".uvst["+$i+"].uvsp")`;    for($j=0;$j<$numuvs;++$j)    { float $uv[] = `getAttr ($mesh + ".uvst["+$i+"].uvsp["+$j+"]")`; print($j + ": " + $uv[0] +" "+ $uv[1]+"\n");    }    // set the current UV set. This is required for the next part...setAttr -type "string" ($mesh+".currentUVSet") $uvsetname;    // num faces    $numfaces = `getAttr -s ($mesh+".fc")`;    print("UV indices\n");    for($j=0;$j<$numfaces;$j++)    { // convert from face to vtx-face select -r ($mesh+".f["+$j+"]"); $vtxFaces = `polyListComponentConversion -in -fromFace -toVertexFace ($mesh+".f["+$j+"]")`; for($k in $vtxFaces) {   string $buffer[];   string $wtf = $k;   $numTokens = `tokenize $wtf "[:]" $buffer`;   if($numTokens>3)   {int $start = $buffer[1];int $end = $buffer[2];// we have an annoying  vtxFace[1:4] type thing. for($l=$start;$l<=$end;++$l){  $uv_index = `polyListComponentConversion -fromVertexFace -toUV ($parent[0]+".vtxFace["+$l+"]["+$j+"]")`;  string $buffer2[];  string $hack = $uv_index[0]; $numTokens = `tokenize $hack "[]" $buffer2`;  print(" "+$buffer2[1]);  }   }   else   {$uv_index = `polyListComponentConversion -fromVertexFace -toUV $k`;string $buffer2[];string $hack = $uv_index[0];$numTokens = `tokenize $hack "[]" $buffer2`;print(" "+$buffer2[1]);} } print("\n");    }  }  }P.S. This stuff is much easier to do in the Maya API than in mel script - have a look here for more info.P.P.S. If your script starts running a bit slow (which it probably will do) you can try to speed things up a little by disabling the undo-stack at the start of the script, then re-enabling it at the end. i.e. // query current undo stateglobal int $gUndoState = `undoInfo -q -state`;// disable undoundoInfo -state 0;// do export...// re-enable undoundoInfo -state $gUndoState;P.P.P.S. You may also find it *very* useful to create a directory full of simple test maya files that test various possibilities. For example, mesh with no UV's, mesh with multiple UV's, a mesh created with createNode "mesh", mesh with skin cluster, mesh with blend shape etc etc. Write a small script to open each file, then export with your exporter script. That should quickly catch any possible problems with the script.   ;  jikes, thx alot m8. have to try this out and see if undersantd anything of it :)   