4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
44 struct wmWindowManager;
62 #define EM_FGON_DRAW 1 // face flag
63 #define EM_FGON 2 // edge and face flag both
70 #define B_BEAUTY_SHORT 0x10
71 #define B_AUTOFGON 0x20
73 #define B_PERCENTSUBD 0x40
74 //#define B_MESH_X_MIRROR 0x100 // deprecated, use mesh
75 #define B_JOINTRIA_UV 0x200
76 #define B_JOINTRIA_VCOL 0X400
77 #define B_JOINTRIA_SHARP 0X800
78 #define B_JOINTRIA_MAT 0X1000
79 #define B_FRACTAL 0x2000
80 #define B_SPHERE 0x4000
84 intptr_t mesh_octree_table(struct Object *ob, struct EditMesh *em, float *co, char mode);
85 long mesh_mirrtopo_table(struct Object *ob, char mode);
87 struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, struct EditMesh *em, struct EditVert *eve, float *co, int index);
88 int mesh_get_x_mirror_vert(struct Object *ob, int index);
89 int *mesh_get_x_mirror_faces(struct Object *ob, struct EditMesh *em);
91 int join_mesh_exec(struct bContext *C, struct wmOperator *op);
92 int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
95 void ED_operatortypes_mesh(void);
96 void ED_operatormacros_mesh(void);
97 void ED_keymap_mesh(struct wmKeyConfig *keyconf);
101 void make_editMesh(struct Scene *scene, struct Object *ob);
102 void load_editMesh(struct Scene *scene, struct Object *ob);
103 void remake_editMesh(struct Scene *scene, struct Object *ob);
104 void free_editMesh(struct EditMesh *em);
106 void recalc_editnormals(struct EditMesh *em);
108 void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace);
109 void EM_free_index_arrays(void);
110 struct EditVert *EM_get_vert_for_index(int index);
111 struct EditEdge *EM_get_edge_for_index(int index);
112 struct EditFace *EM_get_face_for_index(int index);
113 int EM_texFaceCheck(struct EditMesh *em);
114 int EM_vertColorCheck(struct EditMesh *em);
116 void undo_push_mesh(struct bContext *C, const char *name);
121 struct EditFace *EM_get_actFace(struct EditMesh *em, int sloppy);
122 void EM_set_actFace(struct EditMesh *em, struct EditFace *efa);
123 float EM_face_area(struct EditFace *efa);
125 void EM_select_edge(struct EditEdge *eed, int sel);
126 void EM_select_face(struct EditFace *efa, int sel);
127 void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val);
128 void EM_select_swap(struct EditMesh *em);
129 void EM_toggle_select_all(struct EditMesh *em);
130 void EM_select_all(struct EditMesh *em);
131 void EM_deselect_all(struct EditMesh *em);
132 void EM_selectmode_flush(struct EditMesh *em);
133 void EM_deselect_flush(struct EditMesh *em);
134 void EM_selectmode_set(struct EditMesh *em);
135 void EM_select_flush(struct EditMesh *em);
136 void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode);
137 void EM_validate_selections(struct EditMesh *em);
138 void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit);
140 /* exported to transform */
141 int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese);
142 void EM_editselection_normal(float *normal, struct EditSelection *ese);
143 void EM_editselection_plane(float *plane, struct EditSelection *ese);
144 void EM_editselection_center(float *center, struct EditSelection *ese);
146 struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit);
147 struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
148 void EM_free_uv_vert_map(struct UvVertMap *vmap);
150 void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name);
151 void EM_free_data_layer(struct EditMesh *em, struct CustomData *data, int type);
153 void EM_make_hq_normals(struct EditMesh *em);
154 void EM_solidify(struct EditMesh *em, float dist);
156 int EM_deselect_nth(struct EditMesh *em, int nth);
158 void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em);
160 /* editmesh_mods.c */
161 extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
163 void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em);
164 int mouse_mesh(struct bContext *C, short mval[2], short extend);
165 int EM_check_backbuf(unsigned int index);
166 int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
167 void EM_free_backbuf(void);
168 int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
169 int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
171 void EM_hide_mesh(struct EditMesh *em, int swap);
172 void EM_reveal_mesh(struct EditMesh *em);
174 void EM_select_by_material(struct EditMesh *em, int index);
175 void EM_deselect_by_material(struct EditMesh *em, int index);
177 void EM_automerge(struct Scene *scene, struct Object *obedit, int update);
180 void paintface_flush_flags(struct Object *ob);
181 struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
182 int paintface_mouse_select(struct bContext *C, struct Object *ob, short mval[2], int extend);
183 int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
184 void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
185 void paintface_select_linked(struct bContext *C, struct Object *ob, short mval[2], int mode);
186 int paintface_minmax(struct Object *ob, float *min, float *max);
188 /* object_vgroup.c */
190 #define WEIGHT_REPLACE 1
192 #define WEIGHT_SUBTRACT 3
194 struct bDeformGroup *ED_vgroup_add(struct Object *ob);
195 struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name);
196 void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
197 void ED_vgroup_select_by_name(struct Object *ob, const char *name);
198 void ED_vgroup_data_create(struct ID *id);
199 int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
200 int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
201 void ED_vgroup_mirror(struct Object *ob, int mirror_weights, int flip_vgroups);
203 int ED_vgroup_object_is_edit_mode(struct Object *ob);
205 void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode);
206 void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
207 float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
209 /*needed by edge slide*/
210 struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve);
211 struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2);
212 int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
213 int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
214 int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
215 short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2);
218 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
219 void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count);
220 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
221 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
223 void ED_mesh_transform(struct Mesh *me, float *mat);
224 void ED_mesh_calc_normals(struct Mesh *me);
225 void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
226 void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
228 int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
229 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
230 int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
231 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
237 #endif /* ED_MESH_H */