|
Blender
V2.59
|
00001 /* 00002 * $Id: ED_mesh.h 37302 2011-06-07 18:04:03Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2008 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * 00024 * Contributor(s): Blender Foundation 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00033 #ifndef ED_MESH_H 00034 #define ED_MESH_H 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 struct ID; 00041 struct View3D; 00042 struct ARegion; 00043 struct EditMesh; 00044 struct EditVert; 00045 struct EditEdge; 00046 struct EditFace; 00047 struct bContext; 00048 struct wmOperator; 00049 struct wmWindowManager; 00050 struct wmKeyConfig; 00051 struct ReportList; 00052 struct EditSelection; 00053 struct ViewContext; 00054 struct bDeformGroup; 00055 struct MDeformWeight; 00056 struct MDeformVert; 00057 struct Scene; 00058 struct Mesh; 00059 struct MFace; 00060 struct MEdge; 00061 struct MVert; 00062 struct MCol; 00063 struct UvVertMap; 00064 struct UvMapVert; 00065 struct CustomData; 00066 struct Material; 00067 struct Object; 00068 struct rcti; 00069 00070 #define EM_FGON_DRAW 1 // face flag 00071 #define EM_FGON 2 // edge and face flag both 00072 00073 /* editbutflag */ 00074 #define B_CLOCKWISE 1 00075 #define B_KEEPORIG 2 00076 #define B_BEAUTY 4 00077 #define B_SMOOTH 8 00078 #define B_BEAUTY_SHORT 0x10 00079 #define B_AUTOFGON 0x20 00080 #define B_KNIFE 0x80 00081 #define B_PERCENTSUBD 0x40 00082 //#define B_MESH_X_MIRROR 0x100 // deprecated, use mesh 00083 #define B_JOINTRIA_UV 0x200 00084 #define B_JOINTRIA_VCOL 0X400 00085 #define B_JOINTRIA_SHARP 0X800 00086 #define B_JOINTRIA_MAT 0X1000 00087 #define B_FRACTAL 0x2000 00088 #define B_SPHERE 0x4000 00089 00090 /* meshtools.c */ 00091 00092 intptr_t mesh_octree_table(struct Object *ob, struct EditMesh *em, float *co, char mode); 00093 long mesh_mirrtopo_table(struct Object *ob, char mode); 00094 00095 struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, struct EditMesh *em, struct EditVert *eve, float *co, int index); 00096 int mesh_get_x_mirror_vert(struct Object *ob, int index); 00097 int *mesh_get_x_mirror_faces(struct Object *ob, struct EditMesh *em); 00098 00099 int join_mesh_exec(struct bContext *C, struct wmOperator *op); 00100 int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op); 00101 00102 /* mesh_ops.c */ 00103 void ED_operatortypes_mesh(void); 00104 void ED_operatormacros_mesh(void); 00105 void ED_keymap_mesh(struct wmKeyConfig *keyconf); 00106 00107 00108 /* editmesh.c */ 00109 void make_editMesh(struct Scene *scene, struct Object *ob); 00110 void load_editMesh(struct Scene *scene, struct Object *ob); 00111 void remake_editMesh(struct Scene *scene, struct Object *ob); 00112 void free_editMesh(struct EditMesh *em); 00113 00114 void recalc_editnormals(struct EditMesh *em); 00115 00116 void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace); 00117 void EM_free_index_arrays(void); 00118 struct EditVert *EM_get_vert_for_index(int index); 00119 struct EditEdge *EM_get_edge_for_index(int index); 00120 struct EditFace *EM_get_face_for_index(int index); 00121 int EM_texFaceCheck(struct EditMesh *em); 00122 int EM_vertColorCheck(struct EditMesh *em); 00123 00124 void undo_push_mesh(struct bContext *C, const char *name); 00125 00126 00127 /* editmesh_lib.c */ 00128 00129 struct EditFace *EM_get_actFace(struct EditMesh *em, int sloppy); 00130 void EM_set_actFace(struct EditMesh *em, struct EditFace *efa); 00131 float EM_face_area(struct EditFace *efa); 00132 00133 void EM_select_edge(struct EditEdge *eed, int sel); 00134 void EM_select_face(struct EditFace *efa, int sel); 00135 void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val); 00136 void EM_select_swap(struct EditMesh *em); 00137 void EM_toggle_select_all(struct EditMesh *em); 00138 void EM_select_all(struct EditMesh *em); 00139 void EM_deselect_all(struct EditMesh *em); 00140 void EM_selectmode_flush(struct EditMesh *em); 00141 void EM_deselect_flush(struct EditMesh *em); 00142 void EM_selectmode_set(struct EditMesh *em); 00143 void EM_select_flush(struct EditMesh *em); 00144 void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode); 00145 void EM_validate_selections(struct EditMesh *em); 00146 void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit); 00147 00148 /* exported to transform */ 00149 int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese); 00150 void EM_editselection_normal(float *normal, struct EditSelection *ese); 00151 void EM_editselection_plane(float *plane, struct EditSelection *ese); 00152 void EM_editselection_center(float *center, struct EditSelection *ese); 00153 00154 struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit); 00155 struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v); 00156 void EM_free_uv_vert_map(struct UvVertMap *vmap); 00157 00158 void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name); 00159 void EM_free_data_layer(struct EditMesh *em, struct CustomData *data, int type); 00160 00161 void EM_make_hq_normals(struct EditMesh *em); 00162 void EM_solidify(struct EditMesh *em, float dist); 00163 00164 int EM_deselect_nth(struct EditMesh *em, int nth); 00165 00166 void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em); 00167 00168 /* editmesh_mods.c */ 00169 extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs; 00170 00171 void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em); 00172 int mouse_mesh(struct bContext *C, const int mval[2], short extend); 00173 int EM_check_backbuf(unsigned int index); 00174 int EM_mask_init_backbuf_border(struct ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); 00175 void EM_free_backbuf(void); 00176 int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); 00177 int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads); 00178 00179 void EM_hide_mesh(struct EditMesh *em, int swap); 00180 void EM_reveal_mesh(struct EditMesh *em); 00181 00182 void EM_select_by_material(struct EditMesh *em, int index); 00183 void EM_deselect_by_material(struct EditMesh *em, int index); 00184 00185 void EM_automerge(struct Scene *scene, struct Object *obedit, int update); 00186 00187 /* editface.c */ 00188 void paintface_flush_flags(struct Object *ob); 00189 struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy); 00190 int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend); 00191 int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend); 00192 void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags); 00193 void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode); 00194 int paintface_minmax(struct Object *ob, float *min, float *max); 00195 00196 void paintface_hide(struct Object *ob, const int unselected); 00197 void paintface_reveal(struct Object *ob); 00198 00199 /* object_vgroup.c */ 00200 00201 #define WEIGHT_REPLACE 1 00202 #define WEIGHT_ADD 2 00203 #define WEIGHT_SUBTRACT 3 00204 00205 struct bDeformGroup *ED_vgroup_add(struct Object *ob); 00206 struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name); 00207 void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup); 00208 void ED_vgroup_select_by_name(struct Object *ob, const char *name); 00209 int ED_vgroup_data_create(struct ID *id); 00210 int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); 00211 int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); 00212 void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups); 00213 00214 int ED_vgroup_object_is_edit_mode(struct Object *ob); 00215 00216 void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); 00217 void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum); 00218 float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum); 00219 00220 /*needed by edge slide*/ 00221 struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve); 00222 struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2); 00223 int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve); 00224 int editface_containsVert(struct EditFace *efa, struct EditVert *eve); 00225 int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed); 00226 short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2); 00227 00228 /* mesh_data.c */ 00229 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces); 00230 void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count); 00231 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count); 00232 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count); 00233 00234 void ED_mesh_transform(struct Mesh *me, float *mat); 00235 void ED_mesh_calc_normals(struct Mesh *me); 00236 void ED_mesh_material_link(struct Mesh *me, struct Material *ma); 00237 void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); 00238 00239 int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); 00240 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); 00241 int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); 00242 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); 00243 00244 #ifdef __cplusplus 00245 } 00246 #endif 00247 00248 #endif /* ED_MESH_H */ 00249