nothing to see here...

This commit is contained in:
Joseph Eagar 2010-11-10 18:42:53 +00:00
parent 1d68058f77
commit bc428e330b
3 changed files with 100 additions and 50 deletions

@ -1829,8 +1829,8 @@ void mesh_pmv_off(Object *ob, Mesh *me)
} }
static void mesh_loops_to_corners(CustomData *fdata, CustomData *ldata, static void mesh_loops_to_corners(CustomData *fdata, CustomData *ldata,
CustomData *pdata, int lindex[3], int findex, CustomData *pdata, int lindex[4], int findex,
int polyindex, int numTex, int numCol) int polyindex, int numTex, int numCol, int tot)
{ {
MTFace *texface; MTFace *texface;
MTexPoly *texpoly; MTexPoly *texpoly;
@ -1850,7 +1850,7 @@ static void mesh_loops_to_corners(CustomData *fdata, CustomData *ldata,
texface->tile = texpoly->tile; texface->tile = texpoly->tile;
texface->unwrap = texpoly->unwrap; texface->unwrap = texpoly->unwrap;
for (j=0; j<3; j++) { for (j=0; j<tot; j++) {
mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, lindex[j], i); mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, lindex[j], i);
texface->uv[j][0] = mloopuv->uv[0]; texface->uv[j][0] = mloopuv->uv[0];
texface->uv[j][1] = mloopuv->uv[1]; texface->uv[j][1] = mloopuv->uv[1];
@ -1860,7 +1860,7 @@ static void mesh_loops_to_corners(CustomData *fdata, CustomData *ldata,
for(i=0; i < numCol; i++){ for(i=0; i < numCol; i++){
mcol = CustomData_get_n(fdata, CD_MCOL, findex, i); mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
for (j=0; j<3; j++) { for (j=0; j<tot; j++) {
mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, lindex[j], i); mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, lindex[j], i);
mcol[j].r = mloopcol->r; mcol[j].r = mloopcol->r;
mcol[j].g = mloopcol->g; mcol[j].g = mloopcol->g;
@ -1872,7 +1872,7 @@ static void mesh_loops_to_corners(CustomData *fdata, CustomData *ldata,
if (hasWCol) { if (hasWCol) {
mcol = CustomData_get(fdata, findex, CD_WEIGHT_MCOL); mcol = CustomData_get(fdata, findex, CD_WEIGHT_MCOL);
for (j=0; j<3; j++) { for (j=0; j<tot; j++) {
mloopcol = CustomData_get(ldata, lindex[j], CD_WEIGHT_MLOOPCOL); mloopcol = CustomData_get(ldata, lindex[j], CD_WEIGHT_MLOOPCOL);
mcol[j].r = mloopcol->r; mcol[j].r = mloopcol->r;
mcol[j].g = mloopcol->g; mcol[j].g = mloopcol->g;
@ -1908,7 +1908,7 @@ int mesh_recalcTesselation(CustomData *fdata,
EditVert *v, *lastv, *firstv; EditVert *v, *lastv, *firstv;
EditFace *f; EditFace *f;
BLI_array_declare(origIndex); BLI_array_declare(origIndex);
int i, j, k, lindex[3], *origIndex = NULL, *polyorigIndex; int i, j, k, lindex[4], *origIndex = NULL, *polyorigIndex;
int numTex, numCol; int numTex, numCol;
mpoly = CustomData_get_layer(pdata, CD_MPOLY); mpoly = CustomData_get_layer(pdata, CD_MPOLY);
@ -1922,6 +1922,32 @@ int mesh_recalcTesselation(CustomData *fdata,
polyorigIndex = use_poly_origindex? CustomData_get_layer(pdata, CD_ORIGINDEX) : NULL; polyorigIndex = use_poly_origindex? CustomData_get_layer(pdata, CD_ORIGINDEX) : NULL;
for (i=0; i<totpoly; i++, mp++) { for (i=0; i<totpoly; i++, mp++) {
ml = mloop + mp->loopstart; ml = mloop + mp->loopstart;
if (mp->totloop < 5) {
BLI_array_growone(mf);
BLI_array_growone(origIndex);
origIndex[k] = use_face_origindex ? k : f->v1->tmp.l;
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);
}
k++;
} else {
firstv = NULL; firstv = NULL;
lastv = NULL; lastv = NULL;
for (j=0; j<mp->totloop; j++, ml++) { for (j=0; j<mp->totloop; j++, ml++) {
@ -1963,6 +1989,7 @@ int mesh_recalcTesselation(CustomData *fdata,
BLI_end_edgefill(); BLI_end_edgefill();
} }
}
CustomData_free(fdata, totface); CustomData_free(fdata, totface);
memset(fdata, 0, sizeof(CustomData)); memset(fdata, 0, sizeof(CustomData));
@ -1975,29 +2002,27 @@ int mesh_recalcTesselation(CustomData *fdata,
mface = mf; mface = mf;
for (i=0; i<totface; i++, mf++) { for (i=0; i<totface; i++, mf++) {
/*ensure winding is correct*/ /*ensure winding is correct*/
if (mf->v1 > mf->v2) { if (mf->v1 > mf->v2) SWAP(int, 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->v2 > mf->v3) { if (mf->v4 && mf->v1 > mf->v4) SWAP(int, mf->v1, mf->v4);
SWAP(int, mf->v2, mf->v3); 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) { if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
SWAP(int, mf->v1, mf->v2);
}
lindex[0] = mf->v1; lindex[0] = mf->v1;
lindex[1] = mf->v2; lindex[1] = mf->v2;
lindex[2] = mf->v3; lindex[2] = mf->v3;
lindex[4] = mf->v4;
/*transform loop indices to vert indices*/ /*transform loop indices to vert indices*/
mf->v1 = mloop[mf->v1].v; mf->v1 = mloop[mf->v1].v;
mf->v2 = mloop[mf->v2].v; mf->v2 = mloop[mf->v2].v;
mf->v3 = mloop[mf->v3].v; mf->v3 = mloop[mf->v3].v;
mf->v4 = mf->v4 ? mloop[mf->v4].v : 0;
mesh_loops_to_corners(fdata, ldata, pdata, mesh_loops_to_corners(fdata, ldata, pdata,
lindex, i, mf->v4, numTex, numCol); lindex, i, mf->v4, numTex, numCol, mf->v4 ? 4 : 3);
mf->v4 = 0;
} }
return totface; return totface;

@ -18,6 +18,13 @@ struct BMSubClassLayer;
struct BMFlagLayer; struct BMFlagLayer;
struct BLI_mempool; struct BLI_mempool;
/*
UPDATE: ok, this hasn't been all that useful. Need to rip this out and just go with original
structs.
well, much of the actual code was great, but this inheritance thing isn't so
useful, need to just make CDDM better.
*/
/* /*
ok: we have a simple subclassing system, to layer in bmesh api features (and ok: we have a simple subclassing system, to layer in bmesh api features (and
let people subclass the api). There's also a separate, compile-time system let people subclass the api). There's also a separate, compile-time system

@ -1291,6 +1291,24 @@ void knifenet_fill_faces(knifetool_opdata *kcd)
BMO_ClearFlag(bm, e, MARK); BMO_ClearFlag(bm, e, MARK);
} }
BM_ITER(f, &bmiter, bm, BM_FACES_OF_MESH, NULL) {
BMIter eiter;
if (!BMO_TestFlag(bm, f, DEL))
continue;
BM_ITER(e, &eiter, bm, BM_EDGES_OF_FACE, f) {
BMIter liter;
BMLoop *l;
BMO_SetFlag(bm, e, MARK);
BM_ITER(l, &liter, bm, BM_LOOPS_OF_EDGE, e) {
BMINDEX_SET(e, BMINDEX_GET(e)|BMINDEX_GET(l->f));
}
}
}
BMO_Flag_To_Slot(bm, &bmop, "edges", MARK, BM_EDGE); BMO_Flag_To_Slot(bm, &bmop, "edges", MARK, BM_EDGE);
BMO_Flag_To_Slot(bm, &bmop, "excludefaces", DEL, BM_FACE); BMO_Flag_To_Slot(bm, &bmop, "excludefaces", DEL, BM_FACE);