Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2008 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * 00022 * Contributor(s): Blender Foundation 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00031 #ifndef ED_MESH_H 00032 #define ED_MESH_H 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 struct ID; 00039 struct View3D; 00040 struct ARegion; 00041 struct EditMesh; 00042 struct EditVert; 00043 struct EditEdge; 00044 struct EditFace; 00045 struct bContext; 00046 struct wmOperator; 00047 struct wmWindowManager; 00048 struct wmKeyConfig; 00049 struct ReportList; 00050 struct EditSelection; 00051 struct ViewContext; 00052 struct bDeformGroup; 00053 struct MDeformWeight; 00054 struct MDeformVert; 00055 struct Scene; 00056 struct Mesh; 00057 struct MFace; 00058 struct MEdge; 00059 struct MVert; 00060 struct MCol; 00061 struct UvVertMap; 00062 struct UvMapVert; 00063 struct CustomData; 00064 struct Material; 00065 struct Object; 00066 struct rcti; 00067 00068 #define EM_FGON_DRAW 1 // face flag 00069 #define EM_FGON 2 // edge and face flag both 00070 00071 /* editbutflag */ 00072 #define B_CLOCKWISE 1 00073 #define B_KEEPORIG 2 00074 #define B_BEAUTY 4 00075 #define B_SMOOTH 8 00076 #define B_BEAUTY_SHORT 0x10 00077 #define B_AUTOFGON 0x20 00078 #define B_KNIFE 0x80 00079 #define B_PERCENTSUBD 0x40 00080 //#define B_MESH_X_MIRROR 0x100 // deprecated, use mesh 00081 #define B_JOINTRIA_UV 0x200 00082 #define B_JOINTRIA_VCOL 0X400 00083 #define B_JOINTRIA_SHARP 0X800 00084 #define B_JOINTRIA_MAT 0X1000 00085 #define B_FRACTAL 0x2000 00086 #define B_SPHERE 0x4000 00087 00088 /* meshtools.c */ 00089 00090 intptr_t mesh_octree_table(struct Object *ob, struct EditMesh *em, float *co, char mode); 00091 int mesh_mirrtopo_table(struct Object *ob, char mode); 00092 00093 struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, struct EditMesh *em, struct EditVert *eve, float *co, int index); 00094 int mesh_get_x_mirror_vert(struct Object *ob, int index); 00095 int *mesh_get_x_mirror_faces(struct Object *ob, struct EditMesh *em); 00096 00097 int join_mesh_exec(struct bContext *C, struct wmOperator *op); 00098 int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op); 00099 00100 /* mesh_ops.c */ 00101 void ED_operatortypes_mesh(void); 00102 void ED_operatormacros_mesh(void); 00103 void ED_keymap_mesh(struct wmKeyConfig *keyconf); 00104 00105 00106 /* editmesh.c */ 00107 void make_editMesh(struct Scene *scene, struct Object *ob); 00108 void load_editMesh(struct Scene *scene, struct Object *ob); 00109 void remake_editMesh(struct Scene *scene, struct Object *ob); 00110 void free_editMesh(struct EditMesh *em); 00111 00112 void recalc_editnormals(struct EditMesh *em); 00113 00114 void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace); 00115 void EM_free_index_arrays(void); 00116 struct EditVert *EM_get_vert_for_index(int index); 00117 struct EditEdge *EM_get_edge_for_index(int index); 00118 struct EditFace *EM_get_face_for_index(int index); 00119 int EM_texFaceCheck(struct EditMesh *em); 00120 int EM_vertColorCheck(struct EditMesh *em); 00121 00122 void undo_push_mesh(struct bContext *C, const char *name); 00123 00124 void paintvert_flush_flags(struct Object *ob); 00125 void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags); 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_clear(struct Object *ob); 00209 void ED_vgroup_select_by_name(struct Object *ob, const char *name); 00210 int ED_vgroup_data_create(struct ID *id); 00211 int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); 00212 int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); 00213 void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups); 00214 00215 int ED_vgroup_object_is_edit_mode(struct Object *ob); 00216 00217 void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); 00218 void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum); 00219 float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum); 00220 00221 /*needed by edge slide*/ 00222 struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve); 00223 struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2); 00224 int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve); 00225 int editface_containsVert(struct EditFace *efa, struct EditVert *eve); 00226 int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed); 00227 short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2); 00228 00229 /* mesh_data.c */ 00230 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces); 00231 void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count); 00232 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count); 00233 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count); 00234 00235 void ED_mesh_transform(struct Mesh *me, float *mat); 00236 void ED_mesh_calc_normals(struct Mesh *me); 00237 void ED_mesh_material_link(struct Mesh *me, struct Material *ma); 00238 void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); 00239 00240 int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); 00241 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); 00242 int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); 00243 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); 00244 int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name); 00245 00246 00247 /* mirrtopo */ 00248 typedef struct MirrTopoStore_t { 00249 intptr_t *index_lookup; 00250 int prev_vert_tot; 00251 int prev_edge_tot; 00252 int prev_ob_mode; 00253 } MirrTopoStore_t; 00254 00255 int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store); 00256 void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store, 00257 const short skip_em_vert_array_init); 00258 void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); 00259 00260 #ifdef __cplusplus 00261 } 00262 #endif 00263 00264 #endif /* ED_MESH_H */ 00265