From 1810913f81dde315d1aba207c4d88ab1c8186194 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 Feb 2013 04:18:01 +0000 Subject: fix for bmesh regression similar to last revision r54920. only effected loading old blend files without edge data. --- source/blender/blenkernel/intern/mesh.c | 20 +++++++++++--------- source/blender/editors/mesh/editface.c | 7 +++---- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index c9c86e6739f..f6f60d03cf7 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -887,12 +887,11 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll int old, MEdge **alledge, int *_totedge) { MPoly *mpoly; - MLoop *mloop; MFace *mface; MEdge *medge; EdgeHash *hash = BLI_edgehash_new(); struct edgesort *edsort, *ed; - int a, b, totedge = 0, final = 0; + int a, totedge = 0, final = 0; /* we put all edges in array, sort them, and detect doubles that way */ @@ -973,13 +972,16 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll mpoly = allpoly; for (a = 0; a < totpoly; a++, mpoly++) { - mloop = allloop + mpoly->loopstart; - for (b = 0; b < mpoly->totloop; b++) { - int v1, v2; - - v1 = mloop[b].v; - v2 = ME_POLY_LOOP_NEXT(mloop, mpoly, b)->v; - mloop[b].e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(hash, v1, v2)); + MLoop *ml, *ml_next; + int i = mpoly->totloop; + + ml_next = allloop + mpoly->loopstart; /* first loop */ + ml = &ml_next[i - 1]; /* last loop */ + + while (i-- != 0) { + ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(hash, ml->v, ml_next->v)); + ml = ml_next; + ml_next++; } } diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index a8b97d4c51f..7ddf2b54a88 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -181,12 +181,11 @@ void paintface_reveal(Object *ob) static void hash_add_face(EdgeHash *ehash, MPoly *mp, MLoop *mloop) { - MLoop *ml; - MLoop *ml_next; + MLoop *ml, *ml_next; int i = mp->totloop; - ml_next = mloop; - ml = &mloop[mp->totloop - 1]; + ml_next = mloop; /* first loop */ + ml = &ml_next[i - 1]; /* last loop */ while (i-- != 0) { BLI_edgehash_insert(ehash, ml->v, ml_next->v, NULL); -- cgit v1.2.3