diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-29 14:47:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-29 14:52:09 +0300 |
commit | b5ce2bbef7a91f81c3556f2ddf6dd5f21161bc91 (patch) | |
tree | e9df91337cd5674bd593e9ab317530b5351daf90 /source | |
parent | 3e32f8e601b6ed9de80135e61b92cf8bffa2632a (diff) |
BMesh: when multiple vertices have the same key-index, use the first
Simple error case where many vertices share an original index,
now use the first match instead of the last.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 587ca16ba9d..fc26d04690d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -509,7 +509,12 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert) if (cd_shape_keyindex_offset != -1) { BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset); - if ((keyi != ORIGINDEX_NONE) && (keyi < ototvert)) { + if ((keyi != ORIGINDEX_NONE) && + (keyi < ototvert) && + /* not fool-proof, but chances are if we have many verts with the same index, + * we will want to use the first one, since the second is more likely to be a duplicate. */ + (vertMap[keyi] == NULL)) + { vertMap[keyi] = eve; } } |