Revision: 41441
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41441
Author:   campbellbarton
Date:     2011-11-01 14:36:23 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
use char for BMHeader type and flag (saves 2 bytes per edge/loop/vertex/face)
also found mouse_mesh_shortest_path was casting edit selecton to the wrong type.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_queries.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_iterators.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mods.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_private.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_queries.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers_impl.c
    branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
    branches/bmesh/blender/source/blender/bmesh/operators/createops.c
    branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c
    branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
    branches/bmesh/blender/source/blender/bmesh/tools/BME_extrude.c
    branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
    branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h
    branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c
    branches/bmesh/blender/source/blender/editors/space_view3d/view3d_buttons.c
    
branches/bmesh/blender/source/blender/editors/transform/transform_conversions.c
    
branches/bmesh/blender/source/blender/editors/transform/transform_orientations.c

Modified: 
branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c  
2011-11-01 12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c  
2011-11-01 14:36:23 UTC (rev 41441)
@@ -629,7 +629,7 @@
                        int drawSmooth;
                        
                        efa = l[0]->f;
-                       drawSmooth = (efa->head.flag & BM_SMOOTH);
+                       drawSmooth= BM_TestHFlag(efa, BM_SMOOTH);
 
                        draw = setDrawOptions==NULL ? 1 : 
setDrawOptions(userData, BM_GetIndex(efa), &drawSmooth);
                        if(draw) {
@@ -697,7 +697,7 @@
                        int drawSmooth;
 
                        efa = l[0]->f;
-                       drawSmooth = (efa->head.flag & BM_SMOOTH);
+                       drawSmooth= BM_TestHFlag(efa, BM_SMOOTH);
                        
                        draw = setDrawOptions==NULL ? 1 : 
setDrawOptions(userData, BM_GetIndex(efa), &drawSmooth);
                        if(draw) {

Modified: 
branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c   
2011-11-01 12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c   
2011-11-01 14:36:23 UTC (rev 41441)
@@ -148,7 +148,7 @@
        for (i=0; i<totvert; i++, mv++) {
                v = BM_Make_Vert(bm, mv->co, NULL);
                normal_short_to_float_v3(v->no, mv->no);
-               v->head.flag = MEFlags_To_BMFlags(mv->flag, BM_VERT);
+               v->head.hflag = MEFlags_To_BMFlags(mv->flag, BM_VERT);
 
                CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, 
&v->head.data);
                vtable[i] = v;
@@ -160,7 +160,7 @@
        for (i=0; i<totedge; i++, me++) {
                e = BM_Make_Edge(bm, vtable[me->v1], vtable[me->v2], NULL, 0);
 
-               e->head.flag = MEFlags_To_BMFlags(me->flag, BM_EDGE);
+               e->head.hflag = MEFlags_To_BMFlags(me->flag, BM_EDGE);
 
                CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, 
&e->head.data);
                etable[i] = e;
@@ -190,7 +190,7 @@
                if (!f)
                        continue;
 
-               f->head.flag = MEFlags_To_BMFlags(mp->flag, BM_FACE);
+               f->head.hflag = MEFlags_To_BMFlags(mp->flag, BM_FACE);
                f->mat_nr = mp->mat_nr;
 
                l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h 2011-11-01 12:51:38 UTC 
(rev 41440)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h 2011-11-01 14:36:23 UTC 
(rev 41441)
@@ -143,16 +143,16 @@
 struct BMFace *BM_Make_Ngon ( struct BMesh *bm, struct BMVert *v1, struct 
BMVert *v2, struct BMEdge **edges, int len, int nodouble );
 
 /*stuff for dealing with header flags*/
-BM_INLINE int BM_TestHFlag(const void *element, const int flag);
+BM_INLINE char BM_TestHFlag(const void *element, const char hflag);
 
 /*stuff for dealing with header flags*/
-BM_INLINE void BM_SetHFlag(void *element, const int flag);
+BM_INLINE void BM_SetHFlag(void *element, const char hflag);
 
 /*stuff for dealing with header flags*/
-BM_INLINE void BM_ClearHFlag(void *element, const int flag);
+BM_INLINE void BM_ClearHFlag(void *element, const char hflag);
 
 /*stuff for dealing BM_ToggleHFlag header flags*/
-BM_INLINE void BM_ToggleHFlag(void *element, const int flag);
+BM_INLINE void BM_ToggleHFlag(void *element, const char hflag);
 BM_INLINE void BM_MergeHFlag(void *element_a, void *element_b);
 BM_INLINE void BM_SetIndex(void *element, const int index);
 BM_INLINE int BM_GetIndex(const void *element);
@@ -275,14 +275,14 @@
 struct EditMesh *bmesh_to_editmesh ( BMesh *bm );
 
 /*convert between bmesh and Mesh flags*/
-int BMFlags_To_MEFlags ( void *element );
+short BMFlags_To_MEFlags(void *element);
 
 /*convert between Mesh and bmesh flags
   type must be BM_VERT/BM_EDGE/BM_FACE,
   and represents the type of the element
   parameter (the three defines map to
   MVert, MEdge, and MPoly, respectively).*/
-int MEFlags_To_BMFlags ( int flag, int type );
+char MEFlags_To_BMFlags(const char hflag, const char htype);
 
 /*convert MLoop*** in a bmface to mtface and mcol in
   an MFace*/

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_class.h   2011-11-01 
12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_class.h   2011-11-01 
14:36:23 UTC (rev 41441)
@@ -57,9 +57,10 @@
 typedef struct BMHeader {
        void *data; /*customdata layers*/
        struct BMFlagLayer *flags;
-       short type; /*element geometric type (verts/edges/loops/faces)*/
-       short flag; /*this would be a CD layer, see below*/
        int index; /*note: use BM_GetIndex/SetIndex macros for index*/
+
+       char htype; /*element geometric type (verts/edges/loops/faces)*/
+       char hflag; /*this would be a CD layer, see below*/
 } BMHeader;
 
 /*note: need some way to specify custom locations for custom data layers.  so 
we can

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h       
2011-11-01 12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h       
2011-11-01 14:36:23 UTC (rev 41441)
@@ -71,12 +71,12 @@
                int                     i;
                long            l;
                float           f;
-       }filter;
-       int type, count;
+       } filter;
+       int htype, count;
 }BMIter;
 
-void *BMIter_New(struct BMIter *iter, struct BMesh *bm, int type, void *data);
+void *BMIter_New(struct BMIter *iter, struct BMesh *bm, const char htype, void 
*data);
 void *BMIter_Step(struct BMIter *iter);
-void *BMIter_AtIndex(struct BMesh *bm, int type, void *data, int index);
+void *BMIter_AtIndex(struct BMesh *bm, const char htype, void *data, int 
index);
 
 #endif

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h 2011-11-01 
12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h 2011-11-01 
14:36:23 UTC (rev 41441)
@@ -4,8 +4,8 @@
 typedef struct BMEditSelection
 {
        struct BMEditSelection *next, *prev;
-       short type;
        void *data;
+       char htype;
 } BMEditSelection;
 
 /* pinning code */
@@ -27,7 +27,7 @@
   chuck it.*/
 int BM_Selected(BMesh *bm, const void *element);
 
-void BM_clear_flag_all(BMesh *bm, int flag);
+void BM_clear_flag_all(BMesh *bm, const char hflag);
 
 /*individual element select functions, BM_Select is a shortcut for these
   that automatically detects which one to use*/
@@ -38,7 +38,7 @@
 void BM_Selectmode_Set(struct BMesh *bm, int selectmode);
 
 /*counts number of elements with flag set*/
-int BM_CountFlag(struct BMesh *bm, int type, int flag, int respecthide);
+int BM_CountFlag(struct BMesh *bm, const char htype, const char hflag, int 
respecthide);
 
 /*edit selection stuff*/
 void BM_set_actFace(BMesh *em, BMFace *f);

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h    
2011-11-01 12:51:38 UTC (rev 41440)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h    
2011-11-01 14:36:23 UTC (rev 41441)
@@ -164,7 +164,7 @@
 
 /*count the number of elements with a specific flag.  type
   can be a bitmask of BM_FACE, BM_EDGE, or BM_FACE.*/
-int BMO_CountFlag(struct BMesh *bm, int flag, int type);
+int BMO_CountFlag(struct BMesh *bm, int flag, const char htype);
 
 /*---------formatted operator initialization/execution-----------*/
 /*
@@ -259,26 +259,26 @@
 void BMO_Get_Mat4(struct BMOperator *op, const char *slotname, float 
mat[4][4]);
 void BMO_Get_Mat3(struct BMOperator *op, const char *slotname, float 
mat[3][3]);
 
-void BMO_Clear_Flag_All(BMesh *bm, BMOperator *op, int type, int flag);
+void BMO_Clear_Flag_All(BMesh *bm, BMOperator *op, const char htype, int flag);
 
 /*puts every element of type type (which is a bitmask) with tool flag flag,
   into a slot.*/
-void BMO_Flag_To_Slot(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, int flag, int type);
+void BMO_Flag_To_Slot(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, const int flag, const char htype);
 
 /*tool-flags all elements inside an element slot array with flag flag.*/
-void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, int flag, int type);
+void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, const int hflag, const char htype);
 /*clears tool-flag flag from all elements inside a slot array.*/
-void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, int flag, int type);
+void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, const int flag, const char htype);
 
 /*tool-flags all elements inside an element slot array with flag flag.*/
-void BMO_HeaderFlag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, int flag, int type);
+void BMO_HeaderFlag_Buffer(struct BMesh *bm, struct BMOperator *op, const char 
*slotname, const char hflag, const char htype);
 /*clears tool-flag flag from all elements inside a slot array.*/
-void BMO_UnHeaderFlag_Buffer(struct BMesh *bm, struct BMOperator *op, const 
char *slotname, int flag, int type);
+void BMO_UnHeaderFlag_Buffer(struct BMesh *bm, struct BMOperator *op, const 
char *slotname, const char hflag, const char htype);
 
 /*puts every element of type type (which is a bitmask) with header flag 
   flag, into a slot.  note: ignores hidden elements (e.g. elements with
   header flag BM_HIDDEN set).*/
-void BMO_HeaderFlag_To_Slot(struct BMesh *bm, struct BMOperator *op, const 
char *slotname, int flag, int type);
+void BMO_HeaderFlag_To_Slot(struct BMesh *bm, struct BMOperator *op, const 
char *slotname, const char hflag, const char htype);
 
 /*counts number of elements inside a slot array.*/
 int BMO_CountSlotBuf(struct BMesh *bm, struct BMOperator *op, const char 
*slotname);
@@ -359,7 +359,7 @@
        int cur; //for arrays
        struct GHashIterator giter;
        void *val;
-       int restrictmask;
+       char restrictmask; /* bitwise '&' with BMHeader.htype */
 } BMOIter;
 
 void *BMO_FirstElem(BMOperator *op, const char *slotname);
@@ -368,7 +368,7 @@

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to