diff options
author | Daniel Dunbar <daniel@zuster.org> | 2004-03-28 12:46:35 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2004-03-28 12:46:35 +0400 |
commit | 9206a1eba69136c928dc72144862d31bb00e6b11 (patch) | |
tree | 09cc61d9068e587e338780731590cd9ee9dd6ff4 /source/blender/blenkernel/intern | |
parent | d29d7030b64895574a1fdb4edd9764e5ce89f013 (diff) |
- replaced G.{edve,eded,edvl} with G.editMesh, atm just a structure to
hold the three lists, nothing major, but gives a place to hang data
off of and a single "mesh" structure to pass around for editing
functions.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/exotic.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf.c | 17 |
5 files changed, 29 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 822d37b271a..9bbe9d3726f 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -65,6 +65,7 @@ #include "BLI_winstuff.h" #endif +#include "DNA_mesh_types.h" #include "DNA_screen_types.h" #include "BKE_library.h" @@ -78,6 +79,7 @@ #include "BKE_curve.h" #include "BKE_font.h" +#include "BLI_editVert.h" #include "BKE_bad_level_calls.h" /* for BPY_do_pyscript */ #include "BLO_readfile.h" /* for BLO_read_file */ @@ -188,10 +190,15 @@ void duplicatelist(ListBase *list1, ListBase *list2) /* copy from 2 to 1 */ } } +static EditMesh theEditMesh; + void initglobals(void) { memset(&G, 0, sizeof(Global)); + G.editMesh = &theEditMesh; + memset(G.editMesh, 0, sizeof(G.editMesh)); + U.savetime= 1; G.animspeed= 4; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3159db7b5be..cfed127a6e5 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -107,7 +107,7 @@ struct _FastLamp { static FastLamp *fastlamplist= NULL; static float fviewmat[4][4]; -DispListMesh *displistmesh_from_editmesh(ListBase *verts, ListBase *edges, ListBase *faces) { +DispListMesh *displistmesh_from_editmesh(EditMesh *em) { DispListMesh *dlm= MEM_callocN(sizeof(*dlm),"dlm"); int i; EditVert *eve, *evePrev; @@ -115,22 +115,22 @@ DispListMesh *displistmesh_from_editmesh(ListBase *verts, ListBase *edges, ListB EditVlak *evl; dlm->flag= 0; - dlm->totvert= BLI_countlist(verts); - dlm->totface= BLI_countlist(edges)+BLI_countlist(faces); + dlm->totvert= BLI_countlist(&em->verts); + dlm->totface= BLI_countlist(&em->edges)+BLI_countlist(&em->faces); dlm->mvert= MEM_callocN(sizeof(*dlm->mface)*dlm->totvert, "dlm->mvert"); dlm->mcol= NULL; dlm->tface= NULL; dlm->mface= MEM_mallocN(sizeof(*dlm->mface)*dlm->totface, "dlm->mface"); i=0; - for (eve= verts->first; eve; eve= eve->next, i++) { + for (eve= em->verts.first; eve; eve= eve->next, i++) { MVert *mvNew= &dlm->mvert[i]; VECCOPY(mvNew->co, eve->co); eve->prev= (void*) i; /* hack to fetch indices */ } i=0; - for (evl= faces->first; evl; evl= evl->next, i++) { + for (evl= em->faces.first; evl; evl= evl->next, i++) { MFace *mfNew= &dlm->mface[i]; mfNew->v1= (int) evl->v1->prev; @@ -147,7 +147,7 @@ DispListMesh *displistmesh_from_editmesh(ListBase *verts, ListBase *edges, ListB mfNew->v2^= mfNew->v4^= mfNew->v2^= mfNew->v4; } } - for (eed= edges->first; eed; eed= eed->next, i++) { + for (eed= em->edges.first; eed; eed= eed->next, i++) { MFace *mfNew= &dlm->mface[i]; mfNew->v1= (int) eed->v1->prev; @@ -161,7 +161,7 @@ DispListMesh *displistmesh_from_editmesh(ListBase *verts, ListBase *edges, ListB } /* restore prev links */ - for (evePrev=NULL, eve= verts->first; eve; evePrev=eve, eve= eve->next) + for (evePrev=NULL, eve= em->verts.first; eve; evePrev=eve, eve= eve->next) eve->prev= evePrev; displistmesh_calc_vert_normals(dlm); @@ -1621,6 +1621,7 @@ void set_displist_onlyzero(int val) void makeDispList(Object *ob) { + EditMesh *em = G.editMesh; Mesh *me; Nurb *nu; Curve *cu; @@ -1651,8 +1652,7 @@ void makeDispList(Object *ob) DispListMesh *dlm; if (ob==G.obedit) { - dlm= subsurf_make_dispListMesh_from_editmesh(&G.edve, &G.eded, &G.edvl, - me->subdiv, me->flag, me->subsurftype); + dlm= subsurf_make_dispListMesh_from_editmesh(em, me->subdiv, me->flag, me->subsurftype); } else { DispList *dlVerts= find_displist(&ob->disp, DL_VERTS); dlm= subsurf_make_dispListMesh_from_mesh(me, dlVerts?dlVerts->verts:NULL, diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index e3297509fc5..fad1eeb93a6 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -2121,6 +2121,7 @@ char videosc_dir[160]= {0, 0}; static void write_videoscape_mesh(Object *ob, char *str) { + EditMesh *em = G.editMesh; Mesh *me; Material *ma; MVert *mvert; @@ -2169,7 +2170,7 @@ static void write_videoscape_mesh(Object *ob, char *str) fprintf(fp, "%d\n", G.totvert); tot= 0; - eve= G.edve.first; + eve= em->verts.first; while(eve) { VECCOPY(co, eve->co); Mat4MulVecfl(ob->obmat, co); @@ -2178,7 +2179,7 @@ static void write_videoscape_mesh(Object *ob, char *str) tot++; eve= eve->next; } - evl= G.edvl.first; + evl= em->faces.first; while(evl) { if(evl->v4==0) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9f3f63ba478..ffc8dcd4362 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1024,6 +1024,7 @@ void ob_parlimb(Object *ob, Object *par, float mat[][4]) void give_parvert(Object *par, int nr, float *vec) { + EditMesh *em = G.editMesh; Mesh *me; EditVert *eve; /* extern ListBase editNurb; already in bad lev calls */ @@ -1042,7 +1043,7 @@ void give_parvert(Object *par, int nr, float *vec) if(nr >= G.totvert) nr= 0; count= 0; - eve= G.edve.first; + eve= em->verts.first; while(eve) { if(count==nr) { memcpy(vec, eve->co, 12); diff --git a/source/blender/blenkernel/intern/subsurf.c b/source/blender/blenkernel/intern/subsurf.c index d9f4d357989..759b458ba63 100644 --- a/source/blender/blenkernel/intern/subsurf.c +++ b/source/blender/blenkernel/intern/subsurf.c @@ -396,7 +396,7 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) { return hme; } -static HyperMesh *hypermesh_from_editmesh(EditVert *everts, EditEdge *eedges, EditVlak *efaces) { +static HyperMesh *hypermesh_from_editmesh(EditMesh *em) { HyperMesh *hme= hypermesh_new(); EditVert *ev, *prevev; EditEdge *ee; @@ -404,13 +404,13 @@ static HyperMesh *hypermesh_from_editmesh(EditVert *everts, EditEdge *eedges, Ed /* we only add vertices with edges, 'f1' is a free flag */ /* added: check for hide flag in vertices */ - for (ev= everts; ev; ev= ev->next) ev->f1= 1; + for (ev= em->verts.first; ev; ev= ev->next) ev->f1= 1; /* hack, tuck the new hypervert pointer into * the ev->prev link so we can find it easy, * then restore real prev links later. */ - for (ee= eedges; ee; ee= ee->next) { + for (ee= em->edges.first; ee; ee= ee->next) { if(ee->v1->h==0 && ee->v2->h==0) { if(ee->v1->f1) { ee->v1->prev= (EditVert*) hypermesh_add_vert(hme, ee->v1->co, ee->v1->co); @@ -424,7 +424,7 @@ static HyperMesh *hypermesh_from_editmesh(EditVert *everts, EditEdge *eedges, Ed hypermesh_add_edge(hme, (HyperVert*) ee->v1->prev, (HyperVert*) ee->v2->prev, 1); } } - for (ef= efaces; ef; ef= ef->next) { + for (ef= em->faces.first; ef; ef= ef->next) { if(ef->v1->h || ef->v2->h || ef->v3->h); else if(ef->v4 && ef->v4->h); else { @@ -444,7 +444,7 @@ static HyperMesh *hypermesh_from_editmesh(EditVert *everts, EditEdge *eedges, Ed } /* see hack above, restore the prev links */ - for (prevev= NULL, ev= everts; ev; prevev= ev, ev= ev->next) + for (prevev= NULL, ev= em->verts.first; ev; prevev= ev, ev= ev->next) ev->prev= prevev; return hme; @@ -944,12 +944,11 @@ static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short sub return dlm; } -DispListMesh *subsurf_make_dispListMesh_from_editmesh(ListBase *verts, ListBase *edges, - ListBase *faces, int subdivLevels, int flags, short type) { +DispListMesh *subsurf_make_dispListMesh_from_editmesh(EditMesh *em, int subdivLevels, int flags, short type) { if (subdivLevels<1) { - return displistmesh_from_editmesh(verts, edges, faces); + return displistmesh_from_editmesh(em); } else { - HyperMesh *hme= hypermesh_from_editmesh(verts->first, edges->first, faces->first); + HyperMesh *hme= hypermesh_from_editmesh(em); return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, type); } |