2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2008 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
43 struct wmWindowManager;
61 struct BMEditSelection;
74 #define EM_FGON_DRAW 1 // face flag
75 #define EM_FGON 2 // edge and face flag both
82 #define B_BEAUTY_SHORT 0x10
83 #define B_AUTOFGON 0x20
85 #define B_PERCENTSUBD 0x40
86 //#define B_MESH_X_MIRROR 0x100 // deprecated, use mesh
87 #define B_JOINTRIA_UV 0x200
88 #define B_JOINTRIA_VCOL 0X400
89 #define B_JOINTRIA_SHARP 0X800
90 #define B_JOINTRIA_MAT 0X1000
91 #define B_FRACTAL 0x2000
92 #define B_SPHERE 0x4000
94 intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode);
95 int mesh_mirrtopo_table(struct Object *ob, char mode);
100 /* retrieves mirrored cache vert, or NULL if there isn't one.
101 * note: calling this without ensuring the mirror cache state
103 void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const short use_select); /* note, replaces EM_cache_x_mirror_vert in trunk */
104 void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to);
105 struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v);
106 void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v);
107 void EDBM_verts_mirror_cache_end(struct BMEditMesh *em);
109 void EDBM_mesh_normals_update(struct BMEditMesh *em);
111 void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob);
112 void EDBM_mesh_free(struct BMEditMesh *tm);
113 void EDBM_mesh_load(struct Object *ob);
115 void EDBM_index_arrays_init(struct BMEditMesh *em, int forvert, int foredge, int forface);
116 void EDBM_index_arrays_free(struct BMEditMesh *em);
117 struct BMVert *EDBM_vert_at_index(struct BMEditMesh *em, int index);
118 struct BMEdge *EDBM_edge_at_index(struct BMEditMesh *em, int index);
119 struct BMFace *EDBM_face_at_index(struct BMEditMesh *em, int index);
121 /* flushes based on the current select mode. if in vertex select mode,
122 * verts select/deselect edges and faces, if in edge select mode,
123 * edges select/deselect faces and vertices, and in face select mode faces select/deselect
124 * edges and vertices.*/
125 void EDBM_select_more(struct BMEditMesh *em);
126 void EDBM_select_less(struct BMEditMesh *em);
128 void EDBM_selectmode_flush_ex(struct BMEditMesh *em, int selectmode);
129 void EDBM_selectmode_flush(struct BMEditMesh *em);
131 void EDBM_deselect_flush(struct BMEditMesh *em);
132 void EDBM_select_flush(struct BMEditMesh *em);
134 void EDBM_selectmode_set(struct BMEditMesh *em);
135 void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectmode);
136 void undo_push_mesh(struct bContext *C, const char *name);
138 int EDBM_editselection_active_get(struct BMEditMesh *em, struct BMEditSelection *ese);
139 void EDBM_editselection_center(struct BMEditMesh *em, float *center, struct BMEditSelection *ese);
140 void EDBM_editselection_plane(struct BMEditMesh *em, float *plane, struct BMEditSelection *ese);
141 void EDBM_editselection_normal(float *normal, struct BMEditSelection *ese);
142 int EDBM_vert_color_check(struct BMEditMesh *em);
143 void EDBM_editselection_validate(struct BMEditMesh *em);
145 void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
146 void EDBM_mesh_reveal(struct BMEditMesh *em);
148 void EDBM_update_generic(struct bContext *C, struct BMEditMesh *em, const short do_tessface);
150 int EDBM_backbuf_check(unsigned int index);
151 int EDBM_backbuf_border_mask_init(struct ViewContext *vc, int mcords[][2], short tot,
152 short xmin, short ymin, short xmax, short ymax);
153 void EDBM_backbuf_free(void);
154 int EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
155 int EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
157 void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
159 struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands);
160 void EDBM_uv_element_map_free(struct UvElementMap *vmap);
162 int EDBM_mtexpoly_check(struct BMEditMesh *em);
163 struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy);
165 void EDBM_uv_vert_map_free(struct UvVertMap *vmap);
166 struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
167 struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit);
169 void EDBM_data_layer_add(struct BMEditMesh *em, struct CustomData *data, int type, const char *name);
170 void EDBM_data_layer_free(struct BMEditMesh *em, struct CustomData *data, int type);
172 void EDBM_select_toggle_all(struct BMEditMesh *em);
173 void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */
174 int EDBM_select_interior_faces(struct BMEditMesh *em);
176 void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag);
177 void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
178 void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
179 void EDBM_automerge(struct Scene *scene, struct Object *ob, int update);
181 /* editmesh_mods.c */
182 extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
184 int mouse_mesh(struct bContext *C, const int mval[2], short extend);
186 struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index);
187 int mesh_get_x_mirror_vert(struct Object *ob, int index);
188 int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
190 int join_mesh_exec(struct bContext *C, struct wmOperator *op);
191 int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
194 void ED_operatortypes_mesh(void);
195 void ED_operatormacros_mesh(void);
196 void ED_keymap_mesh(struct wmKeyConfig *keyconf);
201 void ED_spacetypes_init(void);
202 void ED_keymap_mesh(struct wmKeyConfig *keyconf);
205 extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
207 /* bmesh_tools.c (could be moved) */
208 void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct BMEditMesh *em);
211 void paintface_flush_flags(struct Object *ob);
212 int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend);
213 int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
214 void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
215 void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode);
216 int paintface_minmax(struct Object *ob, float *min, float *max);
218 void paintface_hide(struct Object *ob, const int unselected);
219 void paintface_reveal(struct Object *ob);
221 void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
222 void paintvert_flush_flags(struct Object *ob);
224 /* object_vgroup.c */
226 #define WEIGHT_REPLACE 1
228 #define WEIGHT_SUBTRACT 3
230 struct bDeformGroup *ED_vgroup_add(struct Object *ob);
231 struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name);
232 void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
233 void ED_vgroup_clear(struct Object *ob);
234 void ED_vgroup_select_by_name(struct Object *ob, const char *name);
235 int ED_vgroup_data_create(struct ID *id);
236 int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
237 int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
238 void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups);
240 int ED_vgroup_object_is_edit_mode(struct Object *ob);
242 void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode);
243 void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
244 float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
246 struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, int *dist, short sel, short strict);
247 struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, int *dist);
248 struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, int *dist);
251 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
252 void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count);
253 void ED_mesh_tessfaces_add(struct Mesh *mesh, struct ReportList *reports, int count);
254 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
255 void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count);
256 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
258 void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count);
259 void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count);
260 void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count);
262 void ED_mesh_transform(struct Mesh *me, float *mat);
263 void ED_mesh_calc_normals(struct Mesh *me);
264 void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
265 void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
267 int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
268 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
269 int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me);
270 int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum);
271 int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
272 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
273 int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
275 void EDBM_selectmode_to_scene(struct bContext *C);
276 void EDBM_mesh_clear(struct BMEditMesh *em);
278 #include "../mesh/editmesh_bvh.h"
282 typedef struct MirrTopoStore_t {
283 intptr_t *index_lookup;
289 int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
290 void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
291 const short skip_em_vert_array_init);
292 void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
294 #define SUBDIV_SELECT_ORIG 0
295 #define SUBDIV_SELECT_INNER 1
296 #define SUBDIV_SELECT_INNER_SEL 2
297 #define SUBDIV_SELECT_LOOPCUT 3
299 /* edge subdivide corner cut types */
300 #define SUBDIV_CORNER_PATH 0
301 #define SUBDIV_CORNER_INNERVERT 1
302 #define SUBDIV_CORNER_FAN 2
308 #endif /* __ED_MESH_H__ */