[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18315] branches/bmesh/bmesh: cleaned up flags so they work properly as per design.
Joseph Eagar
joeedh at gmail.com
Sun Jan 4 18:54:34 CET 2009
Revision: 18315
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18315
Author: joeedh
Date: 2009-01-04 18:54:34 +0100 (Sun, 04 Jan 2009)
Log Message:
-----------
cleaned up flags so they work properly as per design.
also line endings had to be normalized; I suspect svn
is being buggy, ger. I may set svn:eol-style to native
on all the files if necessary.
Modified Paths:
--------------
branches/bmesh/bmesh/bmesh.h
branches/bmesh/bmesh/intern/bmesh_mods.c
branches/bmesh/bmesh/intern/bmesh_operators.c
branches/bmesh/bmesh/intern/bmesh_structure.c
branches/bmesh/bmesh/intern/bmesh_to_editmesh.c
branches/bmesh/bmesh/intern/editmesh_to_bmesh.c
Modified: branches/bmesh/bmesh/bmesh.h
===================================================================
--- branches/bmesh/bmesh/bmesh.h 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/bmesh.h 2009-01-04 17:54:34 UTC (rev 18315)
@@ -71,11 +71,11 @@
/*BMHeader->flag*/
#define BM_SELECT (1<<0)
-#define BM_SEAM (1<<16)
-#define BM_FGON (1<<17)
-#define BM_HIDDEN (1<<18)
-#define BM_SHARP (1<<19)
-#define BM_SMOOTH (1<<20)
+#define BM_SEAM (1<<1)
+#define BM_FGON (1<<2)
+#define BM_HIDDEN (1<<3)
+#define BM_SHARP (1<<4)
+#define BM_SMOOTH (1<<5)
typedef struct BMHeader {
struct BMHeader *next, *prev;
Modified: branches/bmesh/bmesh/intern/bmesh_mods.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_mods.c 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/intern/bmesh_mods.c 2009-01-04 17:54:34 UTC (rev 18315)
@@ -134,7 +134,6 @@
*/
BMEdge *BM_Connect_Verts(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **nf) {
- /*search radial disk for face that contains e1 and e2*/
BMIter iter, iter2;
BMVert *v;
BMLoop *nl;
Modified: branches/bmesh/bmesh/intern/bmesh_operators.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_operators.c 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/intern/bmesh_operators.c 2009-01-04 17:54:34 UTC (rev 18315)
@@ -169,8 +169,8 @@
dest_slot->data.buf = NULL;
dest_slot->len = source_slot->len;
if(dest_slot->len){
- dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, opdefines[dest_slot->slottype]->totslot * dest_slot->len);
- memcpy(dest_slot->data.buf, source_slot->data.buf, opdefines[dest_slot->slottype]->totslot * dest_slot->len);
+ dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, BMOP_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len);
+ memcpy(dest_slot->data.buf, source_slot->data.buf, BMOP_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len);
}
} else {
dest_slot->data = source_slot->data;
@@ -309,7 +309,7 @@
op->slots[slotcode].len = len;
if(len)
- op->slots[slotcode].data.buf = BLI_memarena_alloc(op->arena, opdefines[op->type]->slottypes[slotcode] * len);
+ op->slots[slotcode].data.buf = BLI_memarena_alloc(op->arena, BMOP_OPSLOT_TYPEINFO[opdefines[op->type]->slottypes[slotcode]] * len);
return op->slots[slotcode].data.buf;
}
Modified: branches/bmesh/bmesh/intern/bmesh_structure.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_structure.c 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/intern/bmesh_structure.c 2009-01-04 17:54:34 UTC (rev 18315)
@@ -85,8 +85,9 @@
BMVert *bmesh_addvertlist(BMesh *bm, BMVert *example){
BMVert *v=NULL;
- v = BLI_mempool_alloc(bm->vpool);
+ v = BLI_mempool_calloc(bm->vpool);
v->head.next = v->head.prev = NULL;
+ v->head.flag = 0;
v->head.EID = bm->nextv;
v->head.type = BM_VERT;
v->co[0] = v->co[1] = v->co[2] = 0.0f;
@@ -112,10 +113,11 @@
}
BMEdge *bmesh_addedgelist(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example){
BMEdge *e=NULL;
- e = BLI_mempool_alloc(bm->epool);
+ e = BLI_mempool_calloc(bm->epool);
e->head.next = e->head.prev = NULL;
e->head.EID = bm->nexte;
e->head.type = BM_EDGE;
+ e->head.flag = 0;
e->v1 = v1;
e->v2 = v2;
e->d1.next = e->d1.prev = e->d2.next = e->d2.prev = NULL;
@@ -140,10 +142,11 @@
}
BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, BMLoop *example){
BMLoop *l=NULL;
- l = BLI_mempool_alloc(bm->lpool);
+ l = BLI_mempool_calloc(bm->lpool);
l->head.next = l->head.prev = NULL;
l->head.EID = bm->nextl;
l->head.type = BM_LOOP;
+ l->head.flag = 0;
l->radial.next = l->radial.prev = NULL;
l->radial.data = l;
l->v = v;
@@ -163,7 +166,8 @@
BMFace *bmesh_addpolylist(BMesh *bm, BMFace *example){
BMFace *f = NULL;
- f = BLI_mempool_alloc(bm->ppool);
+ f = BLI_mempool_calloc(bm->ppool);
+ f->head.flag = 0;
f->head.next = f->head.prev = NULL;
f->head.EID = bm->nextp;
f->head.type = BM_FACE;
Modified: branches/bmesh/bmesh/intern/bmesh_to_editmesh.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_to_editmesh.c 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/intern/bmesh_to_editmesh.c 2009-01-04 17:54:34 UTC (rev 18315)
@@ -57,20 +57,21 @@
j = 0;
l = f->loopbase;
- do{
+ do {
mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
texface->uv[j][0] = mloopuv->uv[0];
texface->uv[j][1] = mloopuv->uv[1];
j++;
l = ((BMLoop*)(l->head.next));
- }while(l!=f->loopbase);
+ } while(l!=f->loopbase);
}
+
for(i=0; i < numCol; i++){
mcol = CustomData_em_get_n(facedata, face_block, CD_MCOL, i);
j = 0;
l = f->loopbase;
- do{
+ do {
mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
mcol[j].r = mloopcol->r;
mcol[j].g = mloopcol->g;
@@ -78,7 +79,7 @@
mcol[j].a = mloopcol->a;
j++;
l = ((BMLoop*)(l->head.next));
- }while(l!=f->loopbase);
+ } while(l!=f->loopbase);
}
}
@@ -87,13 +88,13 @@
EditVert *eve = NULL;
v->head.eflag1 = index; /*abuse!*/
- eve = addvertlist(v->co,NULL);
+ eve = addvertlist(v->co, NULL);
eve->keyindex = index;
evlist[index]= eve;
/*copy flags*/
- eve->f = v->head.flag & 255;
if(v->head.flag & BM_HIDDEN) eve->h = 1;
+ if (v->head.flag & BM_SELECT) eve->f |= SELECT;
eve->bweight = v->bweight;
CustomData_em_copy_data(&bm->vdata, &em->vdata, v->data, &eve->data);
@@ -111,12 +112,12 @@
eed->bweight = e->bweight;
//copy relavent flags
- eed->f = e->head.flag & 65535;
+ if (e->head.flag & BM_SELECT) eed->f |= SELECT;
if (e->head.flag & BM_SEAM) eed->seam = 1;
if (e->head.flag & BM_SHARP) eed->sharp = 1;
if (e->head.flag & BM_HIDDEN) eed->h = 1;
if (e->head.flag & BM_FGON) eed->h |= EM_FGON;
-
+
CustomData_em_copy_data(&bm->edata, &em->edata, e->data, &eed->data);
}
@@ -143,7 +144,7 @@
eve1= evlist[f->loopbase->v->head.eflag1];
eve2= evlist[((BMLoop*)(f->loopbase->head.next))->v->head.eflag1];
eve3= evlist[((BMLoop*)(f->loopbase->head.next->next))->v->head.eflag1];
- if (len >= 4) {
+ if (len == 4) {
eve4= evlist[ ((BMLoop*)(f->loopbase->head.prev))->v->head.eflag1];
}
else {
@@ -167,7 +168,7 @@
efa->n[2] = f->no[2];
//copy relavent original flags
- efa->f = f->head.flag & 255;
+ if (f->head.flag & BM_SELECT) efa->f |= SELECT;
if (f->head.flag & BM_HIDDEN) efa->h = 1;
if (f->head.flag & BM_SMOOTH) efa->flag |= ME_SMOOTH;
@@ -234,9 +235,9 @@
BMOperator conv;
EditMesh *em;
- BMO_Init_Op(&conv, BMOP_TO_EDITMESH);
- BMO_Exec_Op(bmesh, &conv);
- em = conv.slots[BMOP_TO_EDITMESH_EMOUT].data.p;
+ BMO_Init_Op(&conv, BMOP_TO_EDITMESH);
+ BMO_Exec_Op(bmesh, &conv);
+ em = conv.slots[BMOP_TO_EDITMESH_EMOUT].data.p;
BMO_Finish_Op(bmesh, &conv);
return em;
Modified: branches/bmesh/bmesh/intern/editmesh_to_bmesh.c
===================================================================
--- branches/bmesh/bmesh/intern/editmesh_to_bmesh.c 2009-01-04 17:45:54 UTC (rev 18314)
+++ branches/bmesh/bmesh/intern/editmesh_to_bmesh.c 2009-01-04 17:54:34 UTC (rev 18315)
@@ -91,8 +91,7 @@
v = BM_Make_Vert(bm, eve->co, NULL);
/*transfer flags*/
- v->head.flag = eve->f;
- v->head.flag |= eve->h ? BM_HIDDEN : 0;
+ v->head.flag = eve->h ? BM_HIDDEN : 0;
if(eve->f & SELECT) BM_Select_Vert(bm, v, 1);
v->bweight = eve->bweight;
@@ -115,10 +114,10 @@
e->crease = eed->crease;
e->bweight = eed->bweight;
- e->head.flag = eed->f;
+ e->head.flag = eed->f & SELECT ? BM_SELECT : 0;
e->head.flag |= eed->seam ? BM_SEAM : 0;
- e->head.flag |= eed->h & EM_FGON ? BM_FGON : 0;
e->head.flag |= eed->h & 1 ? BM_HIDDEN : 0;
+ e->head.flag |= eed->h & EM_FGON ? BM_FGON : 0;
e->head.flag |= eed->sharp ? BM_SHARP : 0;
CustomData_bmesh_copy_data(&em->edata, &bm->edata, eed->data, &e->data);
@@ -183,8 +182,8 @@
v2 = efa->v2->tmp.p;
f = BM_Make_Ngon(bm, v1, v2, edar, len, 0);
+ f->head.flag = 0;
f->mat_nr = efa->mat_nr;
- f->head.flag = efa->f;
if(efa->f & SELECT) BM_Select_Face(bm, f, 1);
if(efa->h) f->head.flag |= BM_HIDDEN;
@@ -403,9 +402,9 @@
/*allocate a bmesh*/
bm = BM_Make_Mesh(allocsize);
- BMO_Init_Op(&conv, BMOP_FROM_EDITMESH);
- BMO_Set_Pnt(&conv, BMOP_FROM_EDITMESH_EM, em);
- BMO_Exec_Op(bm, &conv);
+ BMO_Init_Op(&conv, BMOP_FROM_EDITMESH);
+ BMO_Set_Pnt(&conv, BMOP_FROM_EDITMESH_EM, em);
+ BMO_Exec_Op(bm, &conv);
BMO_Finish_Op(bm, &conv);
return bm;
More information about the Bf-blender-cvs
mailing list