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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 /* Internal for editmesh_xxxx.c functions */
35 #include "BLI_editVert.h"
36 #include "DNA_scene_types.h"
37 #include "DNA_object_types.h"
38 #include "DNA_mesh_types.h"
41 struct wmOperatorType;
44 #define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
46 /* ******************** editface.c */
48 int edgetag_context_check(Scene *scene, EditEdge *eed);
49 void edgetag_context_set(Scene *scene, EditEdge *eed, int val);
50 int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge *target);
52 /* ******************* meshtools.c */
55 /* XXX move to uv editor? */
57 B_UVAUTO_REDRAW = 3301,
76 /* ******************* editmesh.c */
78 extern void free_editvert(EditMesh *em, EditVert *eve);
79 extern void free_editedge(EditMesh *em, EditEdge *eed);
80 extern void free_editface(EditMesh *em, EditFace *efa);
81 void free_editMesh(EditMesh *em);
83 extern void free_vertlist(EditMesh *em, ListBase *edve);
84 extern void free_edgelist(EditMesh *em, ListBase *lb);
85 extern void free_facelist(EditMesh *em, ListBase *lb);
87 extern void remedge(EditMesh *em, EditEdge *eed);
89 extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example);
90 extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditEdge *example);
91 extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
92 extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2);
94 EditVert *editedge_getOtherVert(EditEdge *eed, EditVert *eve);
95 EditVert *editedge_getSharedVert(EditEdge *eed, EditEdge *eed2);
96 int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
97 int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
98 int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
100 void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
102 void MESH_OT_separate(struct wmOperatorType *ot);
104 /* ******************* editmesh_add.c */
105 void MESH_OT_add_primitive_plane(struct wmOperatorType *ot);
106 void MESH_OT_add_primitive_cube(struct wmOperatorType *ot);
107 void MESH_OT_add_primitive_circle(struct wmOperatorType *ot);
108 void MESH_OT_add_primitive_cylinder(struct wmOperatorType *ot);
109 void MESH_OT_add_primitive_tube(struct wmOperatorType *ot);
110 void MESH_OT_add_primitive_cone(struct wmOperatorType *ot);
111 void MESH_OT_add_primitive_grid(struct wmOperatorType *ot);
112 void MESH_OT_add_primitive_monkey(struct wmOperatorType *ot);
113 void MESH_OT_add_primitive_uv_sphere(struct wmOperatorType *ot);
114 void MESH_OT_add_primitive_ico_sphere(struct wmOperatorType *ot);
115 void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot);
116 void MESH_OT_add_edge_face(struct wmOperatorType *ot);
118 void MESH_OT_make_fgon(struct wmOperatorType *ot);
119 void MESH_OT_clear_fgon(struct wmOperatorType *ot);
121 /* ******************* editmesh_lib.c */
122 void EM_stats_update(EditMesh *em);
124 extern void EM_fgon_flags(EditMesh *em);
125 extern void EM_hide_reset(EditMesh *em);
127 extern int faceselectedOR(EditFace *efa, int flag);
128 extern int faceselectedAND(EditFace *efa, int flag);
130 void EM_remove_selection(EditMesh *em, void *data, int type);
131 void EM_clear_flag_all(EditMesh *em, int flag);
132 void EM_set_flag_all(EditMesh *em, int flag);
134 void EM_data_interp_from_verts(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *eve, float fac);
135 void EM_data_interp_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4);
137 int EM_nvertices_selected(EditMesh *em);
138 int EM_nedges_selected(EditMesh *em);
139 int EM_nfaces_selected(EditMesh *em);
141 float EM_face_perimeter(EditFace *efa);
143 void EM_store_selection(EditMesh *em, void *data, int type);
145 extern EditFace *exist_face(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4);
146 extern void flipface(EditMesh *em, EditFace *efa); // flips for normal direction
147 extern int compareface(EditFace *vl1, EditFace *vl2);
149 /* flag for selection bits, *nor will be filled with normal for extrusion constraint */
150 /* return value defines if such normal was set */
151 extern short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor);
152 extern short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor);
153 extern short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor);
154 extern short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor);
155 extern short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor);
157 extern void adduplicateflag(EditMesh *em, int flag);
158 extern void delfaceflag(EditMesh *em, int flag);
160 extern void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3]);
161 extern void translateflag(EditMesh *em, short flag, float *vec);
163 extern int convex(float *v1, float *v2, float *v3, float *v4);
165 extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
166 struct EditFace *efa2, int i1, int i2, int i3, int i4);
169 /* ******************* editmesh_loop.c */
171 #define LOOP_SELECT 1
174 void MESH_OT_knife_cut(struct wmOperatorType *ot);
176 /* ******************* editmesh_mods.c */
177 void MESH_OT_loop_select(struct wmOperatorType *ot);
178 void MESH_OT_de_select_all(struct wmOperatorType *ot);
179 void MESH_OT_bmesh_test(struct wmOperatorType *ot);
180 void MESH_OT_select_more(struct wmOperatorType *ot);
181 void MESH_OT_select_less(struct wmOperatorType *ot);
182 void MESH_OT_select_invert(struct wmOperatorType *ot);
183 void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
184 void MESH_OT_select_linked(struct wmOperatorType *ot);
185 void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
186 void MESH_OT_hide(struct wmOperatorType *ot);
187 void MESH_OT_reveal(struct wmOperatorType *ot);
188 void MESH_OT_consistant_normals(struct wmOperatorType *ot);
189 void MESH_OT_select_linked_flat_faces(struct wmOperatorType *ot);
190 void MESH_OT_select_sharp_edges(struct wmOperatorType *ot);
191 void MESH_OT_shortest_path_select(struct wmOperatorType *ot);
192 void MESH_OT_similar_vertex_select(struct wmOperatorType *ot);
193 void MESH_OT_similar_edge_select(struct wmOperatorType *ot);
194 void MESH_OT_similar_face_select(struct wmOperatorType *ot);
195 void MESH_OT_select_random(struct wmOperatorType *ot);
196 void MESH_OT_vertices_to_sphere(struct wmOperatorType *ot);
197 void MESH_OT_selection_type(struct wmOperatorType *ot);
198 void MESH_OT_select_multi_loop(struct wmOperatorType *ot);
199 void MESH_OT_mark_seam(struct wmOperatorType *ot);
200 void MESH_OT_mark_sharp(struct wmOperatorType *ot);
201 void MESH_OT_smooth_vertex(struct wmOperatorType *ot);
202 void MESH_OT_flip_editnormals(struct wmOperatorType *ot);
204 extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
205 extern void EM_automerge(int update);
206 void editmesh_select_by_material(EditMesh *em, int index);
207 void righthandfaces(EditMesh *em, int select); /* makes faces righthand turning */
208 void EM_select_more(EditMesh *em);
209 void selectconnected_mesh_all(EditMesh *em);
214 * dist (in/out): minimal distance to the nearest and at the end, actual distance
215 * sel: selection bias
216 * if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
217 * if 0, unselected vertice are given the bias
218 * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
220 extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict);
223 /* ******************* editmesh_tools.c */
225 #define SUBDIV_SELECT_ORIG 0
226 #define SUBDIV_SELECT_INNER 1
227 #define SUBDIV_SELECT_INNER_SEL 2
228 #define SUBDIV_SELECT_LOOPCUT 3
230 void join_triangles(EditMesh *em);
231 int removedoublesflag(EditMesh *em, short flag, short automerge, float limit); /* return amount */
232 void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype);
233 int EdgeSlide(EditMesh *em, short immediate, float imperc);
235 void MESH_OT_subdivs(struct wmOperatorType *ot);
236 void MESH_OT_subdivide(struct wmOperatorType *ot);
237 void MESH_OT_subdivide_multi(struct wmOperatorType *ot);
238 void MESH_OT_subdivide_multi_fractal(struct wmOperatorType *ot);
239 void MESH_OT_subdivide_smooth(struct wmOperatorType *ot);
240 void MESH_OT_removedoublesflag(struct wmOperatorType *ot);
241 void MESH_OT_extrude(struct wmOperatorType *ot);
243 void MESH_OT_fill(struct wmOperatorType *ot);
244 void MESH_OT_beauty_fill(struct wmOperatorType *ot);
245 void MESH_OT_convert_quads_to_tris(struct wmOperatorType *ot);
246 void MESH_OT_convert_tris_to_quads(struct wmOperatorType *ot);
247 void MESH_OT_edge_flip(struct wmOperatorType *ot);
248 void MESH_OT_faces_shade_smooth(struct wmOperatorType *ot);
249 void MESH_OT_faces_shade_solid(struct wmOperatorType *ot);
250 void MESH_OT_split_mesh(struct wmOperatorType *ot);
251 void MESH_OT_extrude_repeat(struct wmOperatorType *ot);
252 void MESH_OT_edge_rotate_selected(struct wmOperatorType *ot);
253 void MESH_OT_loop_to_region(struct wmOperatorType *ot);
254 void MESH_OT_region_to_loop(struct wmOperatorType *ot);
256 void MESH_OT_rotate_uvs(struct wmOperatorType *ot);
257 void MESH_OT_mirror_uvs(struct wmOperatorType *ot);
258 void MESH_OT_rotate_colors(struct wmOperatorType *ot);
259 void MESH_OT_mirror_colors(struct wmOperatorType *ot);
261 void MESH_OT_delete(struct wmOperatorType *ot);
263 #endif // MESH_INTERN_H