Importing a triangulated mesh with UVs

Should be simple, right? I’ve managed to get the mesh to import just fine using a bmesh, but since I haven’t worked with Blender addons since 2.49, I’m confused by all the changes to the API. Looking through the OBJ, PLY, and 3DS importers hasn’t helped. Tessfaces? Loops? uv_textures, uv_layers, tessface_uv_textures? Bmesh or regular mesh?

What I’ve got so far, as an intermediate format, is a few custom classes (not children of anything): Mesh, Vertex, Edge, Face, and FaceVert. A Vertex is basically just a coordinate. An Edge is a collection of two Vertex objects and a value for use_edge_sharp (or whatever it is for the edge split modifier). A FaceVert is a coordinate, an index in some vertex list, and a UV coordinate. A Face is instantiated from a collection of three Edge objects and stores that collection and a collection of generated FaceVert objects. A Mesh is a collection of Vertex, Edge, and Face objects.

All the faces are triangles. What would be the best way to generate a Blender mesh from that, with UV coordinates?

have another look at the obj importer, it uses .tessfaces for import, you don’t need to use .loops if you import tris only. The API for tessfaces is very similar to the pre-bmesh API, instead of .faces you use .tessfaces, and instead of uv_textures you use tessface_uv_textures.