diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-13 20:04:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-13 20:04:20 +0400 |
commit | 62cd927f57b94292139348b0a803288e8eafe850 (patch) | |
tree | aad5ec2589e3d44661ba36c15ebebd9e76a16467 /source/blender | |
parent | 05d004fd14876d9df0ca1028f77bebcad1580eff (diff) |
made BLI_edgefill returns the list length since some callers count directly after, also remove 2 unused flags from ScFillVert struct.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 11 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_scanfill.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 21 |
3 files changed, 14 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index a8351e0bb1b..54e4bf08ee7 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -981,16 +981,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) dl= dl->next; } - if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { - - /* count faces */ - tot= 0; - efa= fillfacebase.first; - while(efa) { - tot++; - efa= efa->next; - } - + if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { if(tot) { dlnew= MEM_callocN(sizeof(DispList), "filldisplist"); dlnew->type= DL_INDEX3; diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index e2f102c20eb..c5acf7b7f70 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -53,7 +53,7 @@ extern "C" { /* scanfill.c: used in displist only... */ struct EditVert *BLI_addfillvert(float *vec); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); -int BLI_edgefill(int mat_nr); +int BLI_edgefill(short mat_nr); void BLI_end_edgefill(void); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 423b9b99569..47a07d86e66 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -85,7 +85,6 @@ typedef struct PolyFill { typedef struct ScFillVert { EditVert *v1; EditEdge *first,*last; - short f,f1; } ScFillVert; @@ -95,9 +94,9 @@ typedef struct ScFillVert { static ScFillVert *scdata; -ListBase fillvertbase = {0,0}; -ListBase filledgebase = {0,0}; -ListBase fillfacebase = {0,0}; +ListBase fillvertbase = {NULL, NULL}; +ListBase filledgebase = {NULL, NULL}; +ListBase fillfacebase = {NULL, NULL}; static short cox, coy; @@ -219,7 +218,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2) return newed; } -static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, int mat_nr) +static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr) { /* does not make edges */ EditFace *evl; @@ -495,7 +494,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) } -static void scanfill(PolyFill *pf, int mat_nr) +static int scanfill(PolyFill *pf, short mat_nr) { ScFillVert *sc = NULL, *sc1; EditVert *eve,*v1,*v2,*v3; @@ -748,11 +747,13 @@ static void scanfill(PolyFill *pf, int mat_nr) } MEM_freeN(scdata); + + return totface; } -int BLI_edgefill(int mat_nr) +int BLI_edgefill(short mat_nr) { /* - fill works with its own lists, so create that first (no faces!) @@ -760,6 +761,7 @@ int BLI_edgefill(int mat_nr) - struct elements xs en ys are not used here: don't hide stuff in it - edge flag ->f becomes 2 when it's a new edge - mode: & 1 is check for crossings, then create edges (TO DO ) + - returns number of triangle faces added. */ ListBase tempve, temped; EditVert *eve; @@ -767,6 +769,7 @@ int BLI_edgefill(int mat_nr) PolyFill *pflist,*pf; float *minp, *maxp, *v1, *v2, norm[3], len; short a,c,poly=0,ok=0,toggle=0; + int totfaces= 0; /* total faces added */ /* reset variables */ eve= fillvertbase.first; @@ -1030,7 +1033,7 @@ int BLI_edgefill(int mat_nr) for(a=0;a<poly;a++) { if(pf->edges>1) { splitlist(&tempve,&temped,pf->nr); - scanfill(pf, mat_nr); + totfaces += scanfill(pf, mat_nr); } pf++; } @@ -1040,6 +1043,6 @@ int BLI_edgefill(int mat_nr) /* FREE */ MEM_freeN(pflist); - return 1; + return totfaces; } |