Adjust BMO_Get/SetIndex syntax so that it can take element pointers directly
authorAndrew Wiggin <ender79bl@gmail.com>
Thu, 24 Nov 2011 11:20:48 +0000 (11:20 +0000)
committerAndrew Wiggin <ender79bl@gmail.com>
Thu, 24 Nov 2011 11:20:48 +0000 (11:20 +0000)
source/blender/bmesh/bmesh_operator_api.h
source/blender/bmesh/operators/edgesplitop.c

index fe54ee3c8e71db63008d83cc0ab5db9b92fd7d33..5122391d9d53b1677dabe5691b8e4f94f04b82ff 100644 (file)
@@ -493,14 +493,16 @@ BM_INLINE void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, const char *slotna
        return NULL;
 }
 
-BM_INLINE void BMO_SetIndex(BMesh *bm, BMHeader *element, int index)
+BM_INLINE void BMO_SetIndex(BMesh *bm, const void *element, int index)
 {
-       element->flags[bm->stackdepth-1].index = index;
+       BMHeader *header = (BMHeader *)element;
+       header->flags[bm->stackdepth-1].index = index;
 }
 
-BM_INLINE int BMO_GetIndex(BMesh *bm, BMHeader *element)
+BM_INLINE int BMO_GetIndex(BMesh *bm, void *element)
 {
-       return element->flags[bm->stackdepth-1].index;
+       BMHeader *header = (BMHeader *)element;
+       return header->flags[bm->stackdepth-1].index;
 }
 
 #ifdef __cplusplus
index 124d1f31b7b0ac6f7aef653a131776aa2a4f2f5b..13f44c381020cf0c4e29e9944c85c843dcb503c1 100644 (file)
@@ -102,8 +102,8 @@ static BMFace *remake_face(BMesh *bm, EdgeTag *etags, BMFace *f, BMVert **verts,
                if (l->e != l2->e) {
                        /*set up data for figuring out the two sides of
                          the splits*/
-                       BMO_SetIndex(bm, &l2->e->head, BMO_GetIndex(bm, &l->e->head));
-                       et = etags + BMO_GetIndex(bm, &l->e->head);
+                       BMO_SetIndex(bm, l2->e, BMO_GetIndex(bm, l->e));
+                       et = etags + BMO_GetIndex(bm, l->e);
                        
                        if (!et->newe1) {
                                et->newe1 = l2->e;
@@ -147,7 +147,7 @@ static void tag_out_edges(BMesh *bm, EdgeTag *etags, BMOperator *UNUSED(op))
                        if (!BMO_TestFlag(bm, e, EDGE_SEAM))
                                continue;
 
-                       et = etags + BMO_GetIndex(bm, &e->head);
+                       et = etags + BMO_GetIndex(bm, e);
                        if (!et->tag && e->l) {
                                break;
                        }
@@ -164,7 +164,7 @@ static void tag_out_edges(BMesh *bm, EdgeTag *etags, BMOperator *UNUSED(op))
                        v = i ? l->next->v : l->v;
 
                        while (1) {
-                               et = etags + BMO_GetIndex(bm, &l->e->head);
+                               et = etags + BMO_GetIndex(bm, l->e);
                                if (et->newe1 == l->e) {
                                        if (et->newe1) {
                                                BMO_SetFlag(bm, et->newe1, EDGE_RET1);
@@ -248,7 +248,7 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op)
        etags = MEM_callocN(sizeof(EdgeTag)*bm->totedge, "EdgeTag");
        
        BM_ITER_INDEX(e, &iter, bm, BM_EDGES_OF_MESH, NULL, i) {
-               BMO_SetIndex(bm, &e->head, i);
+               BMO_SetIndex(bm, e, i);
        }
 
 #ifdef ETV
@@ -281,7 +281,7 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op)
                        if (!BMO_TestFlag(bm, l->e, EDGE_SEAM)) {
                                if (!verts[i]) {
 
-                                       et = etags + BMO_GetIndex(bm, &l->e->head);
+                                       et = etags + BMO_GetIndex(bm, l->e);
                                        if (ETV(et, l->v, l)) {
                                                verts[i] = ETV(et, l->v, l);
                                        }
@@ -336,7 +336,7 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op)
                                        } while (l3 != l2 && !BMO_TestFlag(bm, l3->e, EDGE_SEAM));
 
                                        if (l3 == NULL || (BMO_TestFlag(bm, l3->e, EDGE_SEAM) && l3->e != l->e)) {
-                                               et = etags + BMO_GetIndex(bm, &l2->e->head);
+                                               et = etags + BMO_GetIndex(bm, l2->e);
                                                if (ETV(et, v, l2) == NULL) {
                                                        v2 = BM_Make_Vert(bm, v->co, v);
                                                        
@@ -350,7 +350,7 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op)
                                                                l3 = l3->radial_next;
                                                                l3 = BM_OtherFaceLoop(l3->e, l3->f, v);
                                                                
-                                                               et = etags + BMO_GetIndex(bm, &l3->e->head);
+                                                               et = etags + BMO_GetIndex(bm, l3->e);
                                                        } while (l3 != l2 && !BMO_TestFlag(bm, l3->e, EDGE_SEAM));
                                                }
                                                else {