[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42595] branches/bmesh/blender/source/ blender: save 4 bytes per BMLoop, added some comments on index use.
Campbell Barton
ideasman42 at gmail.com
Tue Dec 13 06:20:14 CET 2011
Revision: 42595
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42595
Author: campbellbarton
Date: 2011-12-13 05:20:02 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
save 4 bytes per BMLoop, added some comments on index use.
Modified Paths:
--------------
branches/bmesh/blender/source/blender/blenkernel/intern/editderivedmesh.c
branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
branches/bmesh/blender/source/blender/bmesh/operators/bevel.c
Modified: branches/bmesh/blender/source/blender/blenkernel/intern/editderivedmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedmesh.c 2011-12-13 02:45:59 UTC (rev 42594)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedmesh.c 2011-12-13 05:20:02 UTC (rev 42595)
@@ -173,7 +173,7 @@
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 @@
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;
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_class.h 2011-12-13 02:45:59 UTC (rev 42594)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_class.h 2011-12-13 05:20:02 UTC (rev 42595)
@@ -37,13 +37,10 @@
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 @@
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 @@
/*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*/
Modified: branches/bmesh/blender/source/blender/bmesh/operators/bevel.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2011-12-13 02:45:59 UTC (rev 42594)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2011-12-13 05:20:02 UTC (rev 42595)
@@ -199,7 +199,7 @@
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)) {
More information about the Bf-blender-cvs
mailing list