diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-24 21:06:50 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-24 21:06:50 +0400 |
commit | 0c965e16ac85848473add24de4b7beaf6011812f (patch) | |
tree | 0513e73194e5c15869c6a9861ab772095b3da0e5 /source/blender/blenkernel/intern | |
parent | 03398cfa8846e37fe88c8b992f2b7efb4d7b2a20 (diff) |
Fix #29366: multires crash with meshes that had verts/edges not connected to any face.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 4793e83df53..140f596f78c 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -2301,14 +2301,16 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in /* zero */ for (i=0; i<numEffectedV; i++) { CCGVert *v = effectedV[i]; - VertDataZero(VERT_getCo(v, lvl)); + if(v->numFaces) + VertDataZero(VERT_getCo(v, lvl)); } for (i=0; i<numEffectedE; i++) { CCGEdge *e = effectedE[i]; - for (x=0; x<edgeSize; x++) - VertDataZero(EDGE_getCo(e, lvl, x)); + if(e->numFaces) + for (x=0; x<edgeSize; x++) + VertDataZero(EDGE_getCo(e, lvl, x)); } /* add */ @@ -2349,7 +2351,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in /* average */ for (i=0; i<numEffectedV; i++) { CCGVert *v = effectedV[i]; - VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces); + if(v->numFaces) + VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces); } for (i=0; i<numEffectedE; i++) { @@ -2358,8 +2361,9 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in VertDataCopy(EDGE_getCo(e, lvl, 0), VERT_getCo(e->v0, lvl)); VertDataCopy(EDGE_getCo(e, lvl, edgeSize-1), VERT_getCo(e->v1, lvl)); - for (x=1; x<edgeSize-1; x++) - VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces); + if(e->numFaces) + for (x=1; x<edgeSize-1; x++) + VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces); } /* copy */ |