diff options
author | Joseph Eagar <joeedh@gmail.com> | 2011-02-23 03:01:50 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2011-02-23 03:01:50 +0300 |
commit | 1c0cf60377f4dfeec7f6faec9eac4213ef4a45ba (patch) | |
tree | e96233ed455f5719e7d493130f57f944b798297f /source/blender/blenkernel | |
parent | 8b4eab10f1204e482423c013fdcd820bf2552454 (diff) |
=bmesh=
Fixed join meshes, and an annoying modifier bug (making modifiers
not work in editmode). Also fixed a tesselation bug.
Also got edge slide to work right, yay! Dunno why I couldn't get
it working right before; took me twenty minutes to fix.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 44 |
2 files changed, 11 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index c3404e35c05..107ea5f35fe 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1794,8 +1794,6 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *me) CD_CALLOC, dm->numVertData); CustomData_merge(&em->bm->edata, &dm->edgeData, CD_MASK_DERIVEDMESH, CD_CALLOC, dm->numEdgeData); - CustomData_merge(&em->bm->pdata, &dm->faceData, CD_MASK_DERIVEDMESH, - CD_CALLOC, dm->numFaceData); CustomData_merge(&em->bm->ldata, &dm->loopData, CD_MASK_DERIVEDMESH, CD_CALLOC, dm->numLoopData); CustomData_merge(&em->bm->pdata, &dm->polyData, CD_MASK_DERIVEDMESH, diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 3949902607b..f205d8f9e9a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1923,38 +1923,14 @@ int mesh_recalcTesselation(CustomData *fdata, mp = mpoly; polyorigIndex = use_poly_origindex? CustomData_get_layer(pdata, CD_ORIGINDEX) : NULL; for (i=0; i<totpoly; i++, mp++) { - ml = mloop + mp->loopstart; - - if (mp->totloop < 5) { - BLI_array_growone(mf); - BLI_array_growone(origIndex); - - origIndex[k] = use_face_origindex ? k : i; - - for (j=0; j<mp->totloop; j++, ml++) { - switch (j) { - case 0: - mf[k].v1 = mp->loopstart + j; - case 1: - mf[k].v2 = mp->loopstart + j; - case 2: - mf[k].v3 = mp->loopstart + j; - case 3: - mf[k].v4 = mp->loopstart + j; - } - } - if (mp->totloop == 4 && !mf->v4) { - SWAP(int, mf[k].v1, mf[k].v4); - SWAP(int, mf[k].v2, mf[k].v3); - } + if (mp->totloop > 2) { + ml = mloop + mp->loopstart; - k++; - } else { firstv = NULL; lastv = NULL; for (j=0; j<mp->totloop; j++, ml++) { v = BLI_addfillvert(mvert[ml->v].co); - if (polyorigIndex) + if (polyorigIndex && use_poly_origindex) v->tmp.l = polyorigIndex[i]; else v->tmp.l = i; @@ -1980,6 +1956,8 @@ int mesh_recalcTesselation(CustomData *fdata, mf[k].v1 = f->v1->keyindex; mf[k].v2 = f->v2->keyindex; mf[k].v3 = f->v3->keyindex; + + /*put poly index in mf->v4*/ mf[k].v4 = f->v1->tmp.l; mf[k].mat_nr = mp->mat_nr; @@ -2003,28 +1981,28 @@ int mesh_recalcTesselation(CustomData *fdata, mface = mf; for (i=0; i<totface; i++, mf++) { - /*ensure winding is correct*/ + /*sort loop indices to ensure winding is correct*/ if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2); if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3); if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2); - if (mf->v4 && mf->v1 > mf->v4) SWAP(int, mf->v1, mf->v4); + if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2); if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3); if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2); - + lindex[0] = mf->v1; lindex[1] = mf->v2; lindex[2] = mf->v3; - lindex[4] = mf->v4; /*transform loop indices to vert indices*/ mf->v1 = mloop[mf->v1].v; mf->v2 = mloop[mf->v2].v; mf->v3 = mloop[mf->v3].v; - mf->v4 = mf->v4 ? mloop[mf->v4].v : 0; mesh_loops_to_corners(fdata, ldata, pdata, - lindex, i, mf->v4, numTex, numCol, mf->v4 ? 4 : 3); + lindex, i, mf->v4, numTex, numCol, 3); + + mf->v4 = 0; } return totface; |