My limited API knowledge dies out there. I don’t know how different return values relate to each other enough to know what you can trust to give you a conversion of global-to-local. You may be better offer using MItMeshPolygon to iterate over the triangles of each polygon.
That being said, from some simple tests I just ran this method seems to work:
MFnMesh.getVertices returns:
[out] vertexCount Vertex count per polygon
[out] vertexList Storage for the vertex list.
Which is the same return as getTriangles except per-polygon, not triangle. As far as I can tell getVertices returns the object-relative vertices in their local order. So if a polygon has 4 vertices and they are [2, 3, 5, 4], you can use their position in that list to determine which local-index each has on that polygon, and then you can loop through the vertices for each triangle on that polygon and find the index of each triangle vert in the corresponding poly’s getVertices list, and you (should) have the local-index of each tri’s vert.
So for example assuming:
getTriangles returns:
triangleCount: [2, 2]
triangleVertices: [0, 1, 2, 2, 1, 3, 2, 3, 4, 4, 3, 5]
and
getVertices returns:
polygonVertexCount: [4, 4]
polygonVertices: [0, 1, 3, 2, 2, 3, 5, 4]
That means that the first polygon has 4 verts [0, 1, 3, 2]; and it has two triangles, with verts [0, 1, 2] and [2, 1, 3].
By looking up the index of each triangle vert in the poly vert list, you get the local index, so that translates to two triangles with [0, 1, 3] and [3, 1, 2] in local-vertex orders
And again, I can’t confirm that this will always hold up (but it makes sense to me that it would), but it’s more just me writing down/brainstorming a little exploration I just did.
Keep posting any progress you have, the more knowledge out there the better.