2 * bmesh_class.h september 2010
8 * ***** BEGIN GPL LICENSE BLOCK *****
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version. The Blender
14 * Foundation also sells licenses for use in proprietary software under
15 * the Blender License. See http://www.blender.org/BL/ for information
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 * Contributor(s): Geoffrey Bantle, Levi Schooley, Joseph Eagar.
29 * ***** END GPL LICENSE BLOCK *****
32 #ifndef _BMESH_CLASS_H
33 #define _BMESH_CLASS_H
35 /*bmesh data structures*/
37 #include "DNA_listBase.h"
39 #include "BKE_utildefines.h"
40 #include "BLI_utildefines.h"
52 struct BMSubClassLayer;
57 /*note: it is very important for BMHeader to start with two
58 pointers. this is a requirement of mempool's method of
61 typedef struct BMHeader {
62 void *data; /*customdata layers*/
63 struct BMFlagLayer *flags;
64 short type; /*element geometric type (verts/edges/loops/faces)*/
65 short flag; /*this would be a CD layer, see below*/
66 int index; /*note: use BM_GetIndex/SetIndex macros for index*/
69 /*note: need some way to specify custom locations for custom data layers. so we can
70 make them point directly into structs. and some way to make it only happen to the
71 active layer, and properly update when switching active layers.*/
73 typedef struct BMVert {
80 typedef struct BMEdge {
82 struct BMVert *v1, *v2;
85 /*disk cycle pointers*/
87 struct BMEdge *next, *prev;
90 struct BMEdge *next, *prev;
94 typedef struct BMLoop {
100 struct BMLoop *radial_next, *radial_prev;
102 /*private variables*/
103 struct BMLoop *next, *prev; /*won't be able to use listbase API, ger, due to head*/\
104 int _index; /*used for sorting during tesselation*/
107 typedef struct BMLoopList {
108 struct BMLoopList *next, *prev;
109 struct BMLoop *first, *last;
112 typedef struct BMFace {
114 int len; /*includes all boundary loops*/\
115 int totbounds; /*total boundaries, is one plus the number of holes in the face*/\
117 float no[3]; /*yes, we do store this here*/\
121 typedef struct BMFlagLayer {
122 short f, pflag; /*flags*/
123 int index; /*generic index*/
126 typedef struct BMesh {
127 int totvert, totedge, totloop, totface;
128 int totvertsel, totedgesel, totfacesel;
131 struct BLI_mempool *vpool, *epool, *lpool, *fpool;
133 /*operator api stuff*/
134 struct BLI_mempool *toolflagpool;
136 struct BMOperator *currentop;
138 CustomData vdata, edata, ldata, pdata;
140 struct BLI_mempool *looplistpool;
142 /*should be copy of scene select mode*/
145 /*ID of the shape key this bmesh came from*/
148 int walkers, totflags;
149 ListBase selected, error_stack;
154 struct Object *ob; /*owner object*/
156 int opflag; /*current operator flag*/
159 BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts);
166 #endif /* _BMESH_CLASS_H */