- removed duplicate flags from BKE_mesh.h
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Jan 2004 04:42:29 +0000 (04:42 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Jan 2004 04:42:29 +0000 (04:42 +0000)
 - 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

source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/mesh.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/edit.c
source/blender/src/editarmature.c
source/blender/src/editobject.c
source/blender/src/space.c

index 500e1b0ef00dd23c5b124f694524303ff51e3092..f7d3f4863bc71281779eff0f9a9d5680e33045cf 100644 (file)
 #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);
 
index 53f94a5e6c6a9530e742e38c7c76a1dbd8046391..51c24d5d469ae86d2b2e518d67273647b66fbf26 100644 (file)
@@ -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) {
index 66025473fde483cab627caa21e6b8d0c5d40e687..8313c4bbf939ea5591175b63eebaef33dfe7ae71 100644 (file)
@@ -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");
index 459c2396a45ddab94d0337022a1892422f39bd21..2e1fe5487fb99a348a263ebebd7d8a2503b39fd7 100644 (file)
@@ -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 */
                        }
index a5360e65be4c53cc43725218d484e4c039ab89be..91b02253faf29135e3945593165c2460509440e7 100644 (file)
@@ -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;
index 74d508ea0d34ddae5fea8118ca3bb05e4cbb58a3..5a7da8e6fb6f2fe92e4469d6952d0eba52eb6832 100644 (file)
@@ -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 */
        }
index a474aae84a2434a69ca60c4e5940a4495f6205ad..3a9b2ff59d760fb15df956a6d658464e704f4ac3 100644 (file)
@@ -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;
        }
index 9a850ec0121cd992c947d8ad4fd5ab7d0e3ee7c9..0ef890b2c35bf47aa6971fa27d8496d080b1c04c 100644 (file)
@@ -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');