diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 89bf06be07e..b11d87b1557 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -173,7 +173,7 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f); for (j=0; l; l=BMIter_Step(&liter), j++) { /*mark order*/ - l->_index = j; + BM_SetIndex(l, j); /* set_loop */ v = BLI_addfillvert(l->v->co); v->tmp.p = l; @@ -198,9 +198,9 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) BLI_array_growone(looptris); - if (l1->_index > l2->_index) { SWAP(BMLoop*, l1, l2); } - if (l2->_index > l3->_index) { SWAP(BMLoop*, l2, l3); } - if (l1->_index > l2->_index) { SWAP(BMLoop*, l1, l2); } + if (BM_GetIndex(l1) > BM_GetIndex(l2)) { SWAP(BMLoop*, l1, l2); } + if (BM_GetIndex(l2) > BM_GetIndex(l3)) { SWAP(BMLoop*, l2, l3); } + if (BM_GetIndex(l1) > BM_GetIndex(l2)) { SWAP(BMLoop*, l1, l2); } looptris[i][0] = l1; looptris[i][1] = l2; diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index ddfdf775671..081a5782939 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -37,13 +37,10 @@ struct BMVert; struct BMEdge; struct BMLoop; struct BMFace; -struct BMVert; -struct BMEdge; -struct BMLoop; -struct BMFace; +struct BMFlagLayer; struct BMLayerType; struct BMSubClassLayer; -struct BMFlagLayer; + struct BLI_mempool; struct Object; @@ -54,7 +51,12 @@ struct Object; typedef struct BMHeader { void *data; /*customdata layers*/ struct BMFlagLayer *flags; - int index; /*note: use BM_GetIndex/SetIndex macros for index*/ + int index; /* notes: + * - Use BM_GetIndex/SetIndex macros for index + * - Unitialized to -1 so we can easily tell its not set. + * - Used for edge/vert/face, check BMesh.elem_index_dirty for valid index values, + * this is abused by various tools which set it dirty. + * - For loops this is used for sorting during tesselation. */ char htype; /*element geometric type (verts/edges/loops/faces)*/ char hflag; /*this would be a CD layer, see below*/ @@ -95,7 +97,6 @@ typedef struct BMLoop { /*private variables*/ struct BMLoop *next, *prev; /*won't be able to use listbase API, ger, due to head*/ - int _index; /*used for sorting during tesselation*/ } BMLoop; /*eventually, this structure will be used for supporting holes in faces*/ diff --git a/source/blender/bmesh/operators/bevel.c b/source/blender/bmesh/operators/bevel.c index e9f6677a6c8..3b60a3cbd8f 100644 --- a/source/blender/bmesh/operators/bevel.c +++ b/source/blender/bmesh/operators/bevel.c @@ -199,7 +199,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op) continue; BM_ITER(l2, &liter2, bm, BM_LOOPS_OF_FACE, l->f) { - BM_SetIndex(l2, BLI_array_count(tags)); /* set_dirty! */ + BM_SetIndex(l2, BLI_array_count(tags)); /* set_loop */ BLI_array_growone(tags); if (!BMO_TestFlag(bm, l2->e, EDGE_OLD)) {