diff options
author | Daniel Dunbar <daniel@zuster.org> | 2004-01-08 07:42:29 +0300 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2004-01-08 07:42:29 +0300 |
commit | f6f06ba54d5195c8c0eac0e0b59d615ba20d1349 (patch) | |
tree | 83208edf3648cab2b05406dfb521ff08b8bbd69f | |
parent | 86e32ddcc88c3e048105ad4f055fa1ad84aae152 (diff) |
- removed duplicate flags from BKE_mesh.h
- removed rendermesh_uses_displist (no longer relevant)
- converted appropriate me->flag tests to using mesh_uses_displist
- made vert and face counting (for info header) use proper counts
- changed flip_subdivision to allow level==0 argument
- ps. thanks for subsurf orco fix ton
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 33 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 4 | ||||
-rw-r--r-- | source/blender/renderconverter/intern/convertBlenderScene.c | 4 | ||||
-rw-r--r-- | source/blender/src/edit.c | 20 | ||||
-rw-r--r-- | source/blender/src/editarmature.c | 2 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 22 | ||||
-rw-r--r-- | source/blender/src/space.c | 2 |
8 files changed, 28 insertions, 61 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 500e1b0ef00..f7d3f4863bc 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -34,38 +34,6 @@ #ifndef BKE_MESH_H #define BKE_MESH_H -/* texflag */ -#define AUTOSPACE 1 - -/* me->flag (let op alternatieven in blendpsx.h) */ -#define ME_ISDONE 1 -#define ME_NOPUNOFLIP 2 -#define ME_TWOSIDED 4 -#define ME_UVEFFECT 8 -#define ME_VCOLEFFECT 16 -#define ME_AUTOSMOOTH 32 -#define ME_SMESH 64 -#define ME_SUBSURF 128 - -/* puno (mface) */ -#define ME_FLIPV1 1 -#define ME_FLIPV2 2 -#define ME_FLIPV3 4 -#define ME_FLIPV4 8 -#define ME_PROJXY 16 -#define ME_PROJXZ 32 -#define ME_PROJYZ 64 - -/* edcode (mface) */ -#define ME_V1V2 1 -#define ME_V2V3 2 -#define ME_V3V1 4 -#define ME_V3V4 4 -#define ME_V4V1 8 - -/* flag (mface) */ -#define ME_SMOOTH 1 - /***/ struct DispList; @@ -105,7 +73,6 @@ void tface_to_mcol(struct Mesh *me); void free_dverts(struct MDeformVert *dvert, int totvert); void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */ int mesh_uses_displist(struct Mesh *me); -int rendermesh_uses_displist(struct Mesh *me); float get_mvert_weight (struct Object *ob, int vert, int defgroup); int update_realtime_texture(struct TFace *tface, double time); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 53f94a5e6c6..51c24d5d469 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1646,7 +1646,7 @@ void makeDispList(Object *ob) if(ob->effect.first) object_wave(ob); - if (me->flag & ME_SUBSURF) { + if (mesh_uses_displist(me)) { DispListMesh *dlm; if (ob==G.obedit) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 66025473fde..8313c4bbf93 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1111,10 +1111,6 @@ int mesh_uses_displist(Mesh *me) { return (me->flag&ME_SUBSURF); } -int rendermesh_uses_displist(Mesh *me) { - return (me->flag&ME_SUBSURF); -} - void mesh_calculate_vertex_normals(Mesh *me) { float (*tempNorms)[3]= MEM_callocN(me->totvert*sizeof(*tempNorms), "tempNorms"); diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c index 459c2396a45..2e1fe5487fb 100644 --- a/source/blender/renderconverter/intern/convertBlenderScene.c +++ b/source/blender/renderconverter/intern/convertBlenderScene.c @@ -1438,7 +1438,7 @@ static void init_render_mesh(Object *ob) int start, end, flipnorm, do_autosmooth=0; me= ob->data; - if (rendermesh_uses_displist(me)) { + if (mesh_uses_displist(me)) { init_render_displist_mesh(ob); return; } @@ -2737,7 +2737,7 @@ void RE_freeRotateBlenderScene(void) MEM_freeN(me->orco); me->orco= 0; } - if (rendermesh_uses_displist(me) && (me->subdiv!=me->subdivr)) { + if (mesh_uses_displist(me) && (me->subdiv!=me->subdivr)) { makeDispList(ob); /* XXX this should be replaced with proper caching */ me->subdivdone= 0; /* needed to prevent multiple used meshes being recalculated */ } diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c index a5360e65be4..91b02253faf 100644 --- a/source/blender/src/edit.c +++ b/source/blender/src/edit.c @@ -450,12 +450,22 @@ void count_object(Object *ob, int sel) G.totmesh++; me= get_mesh(ob); if(me) { - int mult= (me->flag & ME_SUBSURF)?(1<<me->subdiv)*(1<<me->subdiv):1; - G.totvert+= me->totvert*mult; - G.totface+= me->totface*mult; + int totvert, totface; + /* hack, should be getting displistmesh from a central function */ + if (mesh_uses_displist(me) && ((DispList*)me->disp.first)->type==DL_MESH) { + DispListMesh *dlm= ((DispList*)me->disp.first)->mesh; + totvert= dlm->totvert; + totface= dlm->totface; + } else { + totvert= me->totvert; + totface= me->totface; + } + + G.totvert+= totvert; + G.totface+= totface; if(sel) { - G.totvertsel+= me->totvert*mult; - G.totfacesel+= me->totface*mult; + G.totvertsel+= totvert; + G.totfacesel+= totface; } } break; diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 74d508ea0d3..5a7da8e6fb6 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -2705,7 +2705,7 @@ void add_verts_to_closest_dgroup(Object *ob, Object *par) mesh = (Mesh*)ob->data; /* Is subsurf on? Lets use the verts on the limit surface then */ - if ( (mesh->flag&ME_SUBSURF) && (mesh->subdiv > 0) ) { + if (mesh->flag&ME_SUBSURF) { subverts = MEM_mallocN(3*mesh->totvert*sizeof(float), "subverts"); subsurf_calculate_limit_positions(mesh, (void *)subverts); /* (ton) made void*, dunno how to cast */ } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index a474aae84a2..3a9b2ff59d7 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -1670,7 +1670,7 @@ void convertmenu(void) nr= pupmenu("Convert Nurbs Surf to%t|Mesh"); if(nr>0) ok= 1; } - else if(ob->type==OB_MESH && ((Mesh*) ob->data)->flag&ME_SUBSURF) { + else if(ob->type==OB_MESH && mesh_uses_displist((Mesh*) ob->data)) { nr= pupmenu("Convert SubSurf to%t|Mesh (keep original)"); if(nr>0) ok= 1; } @@ -1697,10 +1697,7 @@ void convertmenu(void) else if(ob->type==OB_MESH) { Mesh *oldme= ob->data; - if( oldme->subdiv==0 ) { - error("No subdivision Mesh to convert available"); - } - else if (oldme->flag&ME_SUBSURF) { + if (mesh_uses_displist(oldme)) { DispListMesh *dlm; ob->flag |= OB_DONE; @@ -1819,18 +1816,15 @@ void convertmenu(void) allqueue(REDRAWBUTSEDIT, 0); } + /* Change subdivision properties of mesh object ob, if + * level==-1 then toggle subsurf, else set to level. + */ void flip_subdivison(Object *ob, int level) { - Mesh *me; + Mesh *me = ob->data; - me = ob->data; - - if (level == 0) - { - if(me->flag & ME_SUBSURF) - me->flag &= ~ME_SUBSURF; - else - me->flag |= ME_SUBSURF; + if (level == -1) { + me->flag ^= ME_SUBSURF; } else { me->subdiv = level; } diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 9a850ec0121..0ef890b2c35 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1203,7 +1203,7 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } else if((G.qual==LR_SHIFTKEY)) { if(ob && ob->type == OB_MESH) { - flip_subdivison(ob, 0); + flip_subdivison(ob, -1); } } else if(G.qual==LR_ALTKEY) clear_object('o'); |