Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Wiggin <ender79bl@gmail.com>2011-10-09 20:59:48 +0400
committerAndrew Wiggin <ender79bl@gmail.com>2011-10-09 20:59:48 +0400
commitd62338578bf117378c905be2c25122d5a47fd9bc (patch)
treefa0ed56ac6c090d51be34f867d226c28e54da6a5 /source/blender/blenkernel/intern/mesh_validate.c
parentaa6d7ebd145ff375a9dc876d33065f80d94accca (diff)
Fix 28493: Meshes added with many addons revert to only verts on entry to edit mode
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_validate.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index e7cec669081..76e74034ec7 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -326,6 +326,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
MEdge *med, *med_orig;
EdgeHash *eh = BLI_edgehash_new();
int i, totedge, totface = mesh->totface;
+ int med_index;
if(mesh->totedge==0)
update= 0;
@@ -345,7 +346,9 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
MLoop *l= &mesh->mloop[mp->loopstart];
int j, l_prev= (l + (mp->totloop-1))->v;
for (j=0; j < mp->totloop; j++, l++) {
- BLI_edgehash_insert(eh, l_prev, l->v, NULL);
+ if (!BLI_edgehash_haskey(eh, l_prev, l->v)) {
+ BLI_edgehash_insert(eh, l_prev, l->v, NULL);
+ }
l_prev= l->v;
}
}
@@ -387,9 +390,29 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2);
med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */
}
+
+ /* store the new edge index in the hash value */
+ BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
}
BLI_edgehashIterator_free(ehi);
+ if (mesh->totpoly) {
+ /* second pass, iterate through all loops again and assign
+ the newly created edges to them. */
+ MPoly *mp= mesh->mpoly;
+ for(i=0; i < mesh->totpoly; i++, mp++) {
+ MLoop *l= &mesh->mloop[mp->loopstart];
+ MLoop *l_prev= (l + (mp->totloop-1));
+ int j;
+ for (j=0; j < mp->totloop; j++, l++) {
+ /* lookup hashed edge index */
+ med_index = BLI_edgehash_lookup(eh, l_prev->v, l->v);
+ l_prev->e = med_index;
+ l_prev= l;
+ }
+ }
+ }
+
/* free old CustomData and assign new one */
CustomData_free(&mesh->edata, mesh->totedge);
mesh->edata = edata;