[Bf-blender-cvs] [b5ce2bb] master: BMesh: when multiple vertices have the same key-index, use the first

Campbell Barton noreply at git.blender.org
Fri Apr 29 13:48:26 CEST 2016


Commit: b5ce2bbef7a91f81c3556f2ddf6dd5f21161bc91
Author: Campbell Barton
Date:   Fri Apr 29 21:47:05 2016 +1000
Branches: master
https://developer.blender.org/rBb5ce2bbef7a91f81c3556f2ddf6dd5f21161bc91

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.

===================================================================

M	source/blender/bmesh/intern/bmesh_mesh_conv.c

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 587ca16..fc26d04 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;
 			}
 		}




More information about the Bf-blender-cvs mailing list