The "reorder vertices" and "copy vertex groups" scripts for Blender 2.49b use a preprocessing step wherein we construct a map of targetVerts <-> sourceVerts, based on the vertices' UV coordinates. Map format is: map[round(uv.x)][round(uv.y)] = array of struct { sourceVert, uv, targetVert }. When face UVs are in use, a vertex can have multiple UVs, in which case we index it by all of them. Benefit of this approach is that the meshes don't need the same vertex order or even the same number of vertices: if vertex A in the source mesh has a counterpart B in the target mesh, and A and B have identical or near-identical UVs, then we can get A from B or B from A. Only catch is that building the map is very slow; generally we loop over every vertex in every face (roughly <len(source.verts) * 3 + len(target.verts) * 3> iterations if both meshes are triangulated).
Awesome to see all of your work here dude! I've been pushing for people over at the niftools team to keep working on their porting plugin, but apparently development has ground to a halt since mid-last year.
3 comments
The "reorder vertices" and "copy vertex groups" scripts for Blender 2.49b use a preprocessing step wherein we construct a map of targetVerts <-> sourceVerts, based on the vertices' UV coordinates. Map format is: map[round(uv.x)][round(uv.y)] = array of struct { sourceVert, uv, targetVert }. When face UVs are in use, a vertex can have multiple UVs, in which case we index it by all of them. Benefit of this approach is that the meshes don't need the same vertex order or even the same number of vertices: if vertex A in the source mesh has a counterpart B in the target mesh, and A and B have identical or near-identical UVs, then we can get A from B or B from A. Only catch is that building the map is very slow; generally we loop over every vertex in every face (roughly <len(source.verts) * 3 + len(target.verts) * 3> iterations if both meshes are triangulated).
https://gitlab.com/ReltivlyObjectv/import-ck-prefab-for-blender