update bmesh design doc and added some comments to the code from it.

This commit is contained in:
Campbell Barton 2012-02-27 12:25:47 +00:00
parent 47c373c7a9
commit 21f1c99a78
3 changed files with 24 additions and 21 deletions

@ -30,7 +30,7 @@
/* bmesh data structures */ /* bmesh data structures */
/* dissable holes for now, these are ifdef'd because they use more memory and cant be saved in DNA currently */ /* dissable holes for now, these are ifdef'd because they use more memory and cant be saved in DNA currently */
// define USE_BMESH_HOLES #define USE_BMESH_HOLES
struct BMesh; struct BMesh;
struct BMVert; struct BMVert;
@ -95,7 +95,7 @@ typedef struct BMLoop {
/* notice no flags layer */ /* notice no flags layer */
struct BMVert *v; struct BMVert *v;
struct BMEdge *e; struct BMEdge *e; /* edge, using verts (v, next->v) */
struct BMFace *f; struct BMFace *f;
struct BMLoop *radial_next, *radial_prev; struct BMLoop *radial_next, *radial_prev;

@ -90,24 +90,26 @@ BM_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const shor
/* slot type arrays are terminated by the last member /* slot type arrays are terminated by the last member
* having a slot type of 0.*/ * having a slot type of 0.*/
#define BMO_OP_SLOT_SENTINEL 0 enum {
#define BMO_OP_SLOT_BOOL 1 BMO_OP_SLOT_SENTINEL = 0,
#define BMO_OP_SLOT_INT 2 BMO_OP_SLOT_BOOL = 1,
#define BMO_OP_SLOT_FLT 3 BMO_OP_SLOT_INT = 2,
#define BMO_OP_SLOT_PNT 4 BMO_OP_SLOT_FLT = 3,
#define BMO_OP_SLOT_MAT 5
#define BMO_OP_SLOT_VEC 8
/* after BMO_OP_SLOT_VEC, everything is /* normally store pointers to object, scene,
* _never_ store arrays corresponding to mesh elements with this */
BMO_OP_SLOT_PNT = 4,
BMO_OP_SLOT_MAT = 5,
BMO_OP_SLOT_VEC = 8,
* dynamically allocated arrays. we /* after BMO_OP_SLOT_VEC, everything is dynamically allocated arrays.
* leave a space in the identifiers * We leave a space in the identifiers for future growth.
* for future growth. *
*/ * it's very important this remain a power of two */
//it's very important this remain a power of two BMO_OP_SLOT_ELEMENT_BUF = 9, /* list of verts/edges/faces */
#define BMO_OP_SLOT_ELEMENT_BUF 9 BMO_OP_SLOT_MAPPING = 10 /* simple hash map */
#define BMO_OP_SLOT_MAPPING 10 };
#define BMO_OP_SLOT_TOTAL_TYPES 11 #define BMO_OP_SLOT_TOTAL_TYPES 11
/* please ignore all these structures, don't touch them in tool code, except /* please ignore all these structures, don't touch them in tool code, except
* for when your defining an operator with BMOpDefine.*/ * for when your defining an operator with BMOpDefine.*/

@ -40,9 +40,9 @@ typedef enum {
/*Walkers*/ /*Walkers*/
typedef struct BMWalker { typedef struct BMWalker {
void (*begin) (struct BMWalker *walker, void *start); void (*begin) (struct BMWalker *walker, void *start);
void *(*step) (struct BMWalker *walker); void *(*step) (struct BMWalker *walker);
void *(*yield)(struct BMWalker *walker); void *(*yield) (struct BMWalker *walker);
int structsize; int structsize;
BMWOrder order; BMWOrder order;
int valid_mask; int valid_mask;
@ -54,6 +54,7 @@ typedef struct BMWalker {
BLI_mempool *worklist; BLI_mempool *worklist;
ListBase states; ListBase states;
/* these masks are to be tested against elements BMO_elem_flag_test() */
short mask_vert; short mask_vert;
short mask_edge; short mask_edge;
short mask_loop; short mask_loop;