Blender V2.61 - r43446
Classes | Typedefs | Functions

mesh.c File Reference

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_ipo_types.h"
#include "BLI_blenlib.h"
#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_main.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_displist.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_key.h"
#include "BKE_curve.h"
#include "BKE_object.h"

Go to the source code of this file.

Classes

struct  edgesort
struct  EdgeLink
struct  VertLink

Typedefs

typedef struct EdgeLink EdgeLink
typedef struct VertLink VertLink

Functions

EditMeshBKE_mesh_get_editmesh (Mesh *me)
void BKE_mesh_end_editmesh (Mesh *UNUSED(me), EditMesh *UNUSED(em))
void mesh_update_customdata_pointers (Mesh *me)
void unlink_mesh (Mesh *me)
void free_mesh (Mesh *me)
void copy_dverts (MDeformVert *dst, MDeformVert *src, int copycount)
void free_dverts (MDeformVert *dvert, int totvert)
Meshadd_mesh (const char *name)
Meshcopy_mesh (Mesh *me)
static void expand_local_mesh (Mesh *me)
void make_local_mesh (Mesh *me)
void boundbox_mesh (Mesh *me, float *loc, float *size)
void tex_space_mesh (Mesh *me)
BoundBoxmesh_get_bb (Object *ob)
void mesh_get_texspace (Mesh *me, float *loc_r, float *rot_r, float *size_r)
float * get_mesh_orco_verts (Object *ob)
void transform_mesh_orco_verts (Mesh *me, float(*orco)[3], int totvert, int invert)
int test_index_face (MFace *mface, CustomData *fdata, int mfindex, int nr)
Meshget_mesh (Object *ob)
void set_mesh (Object *ob, Mesh *me)
static void to_edgesort (struct edgesort *ed, unsigned int v1, unsigned int v2, short is_loose, short is_draw)
static int vergedgesort (const void *v1, const void *v2)
static void mfaces_strip_loose (MFace *mface, int *totface)
static void make_edges_mdata (MVert *UNUSED(allvert), MFace *allface, int UNUSED(totvert), int totface, int old, MEdge **alledge, int *_totedge)
void make_edges (Mesh *me, int old)
void mesh_strip_loose_faces (Mesh *me)
void mesh_strip_loose_edges (Mesh *me)
void mball_to_mesh (ListBase *lb, Mesh *me)
int nurbs_to_mdata (Object *ob, MVert **allvert, int *totvert, MEdge **alledge, int *totedge, MFace **allface, int *totface)
int nurbs_to_mdata_customdb (Object *ob, ListBase *dispbase, MVert **allvert, int *_totvert, MEdge **alledge, int *_totedge, MFace **allface, int *_totface)
void nurbs_to_mesh (Object *ob)
static void prependPolyLineVert (ListBase *lb, unsigned int index)
static void appendPolyLineVert (ListBase *lb, unsigned int index)
void mesh_to_curve (Scene *scene, Object *ob)
void mesh_delete_material_index (Mesh *me, short index)
void mesh_set_smooth_flag (Object *meshOb, int enableSmooth)
void mesh_calc_normals (MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float(*faceNors_r)[3])
float(* mesh_getVertexCos (Mesh *me, int *numVerts_r))[3]
UvVertMapmake_uv_vert_map (struct MFace *mface, struct MTFace *tface, unsigned int totface, unsigned int totvert, int selected, float *limit)
UvMapVertget_uv_map_vert (UvVertMap *vmap, unsigned int v)
void free_uv_vert_map (UvVertMap *vmap)
void create_vert_face_map (ListBase **map, IndexNode **mem, const MFace *mface, const int totvert, const int totface)
void create_vert_edge_map (ListBase **map, IndexNode **mem, const MEdge *medge, const int totvert, const int totedge)
int minmax_mesh (Mesh *me, float min[3], float max[3])
int mesh_center_median (Mesh *me, float cent[3])
int mesh_center_bounds (Mesh *me, float cent[3])
void mesh_translate (Mesh *me, float offset[3], int do_keys)
void BKE_mesh_ensure_navmesh (Mesh *me)

Detailed Description

Definition in file mesh.c.


Typedef Documentation

typedef struct EdgeLink EdgeLink
typedef struct VertLink VertLink

Function Documentation

Mesh* add_mesh ( const char *  name) [read]
static void appendPolyLineVert ( ListBase lb,
unsigned int  index 
) [static]

Definition at line 1048 of file mesh.c.

References BLI_addtail(), VertLink::index, and MEM_callocN().

Referenced by mesh_to_curve().

void BKE_mesh_end_editmesh ( Mesh UNUSEDme,
EditMesh UNUSEDem 
)

Definition at line 78 of file mesh.c.

void BKE_mesh_ensure_navmesh ( Mesh me)
EditMesh* BKE_mesh_get_editmesh ( Mesh me) [read]

Definition at line 73 of file mesh.c.

References Mesh::edit_mesh.

Referenced by act_vert_def(), addedgeface_mesh_exec(), average_islands_scale_exec(), beautify_fill_exec(), blend_from_shape_exec(), border_select_exec(), calc_manipulator_stats(), calculateCenter(), circle_select_exec(), clear_fgon_exec(), contarget_get_mesh_mat(), createRepresentation(), cube_project_exec(), cylinder_project_exec(), delete_mesh_exec(), do_uvedit_vertex(), do_view3d_header_buttons(), draw_uvs(), draw_uvs_shadow(), ED_operator_uvmap(), ED_space_image_show_uvedit(), ED_space_image_show_uvshadow(), ED_unwrap_lscm(), ED_uvedit_assign_image(), ED_uvedit_ensure_uvs(), ED_uvedit_live_unwrap_begin(), ED_uvedit_median(), ED_uvedit_minmax(), ED_uvedit_nearest_uv(), ED_uvedit_test(), ED_vgroup_mirror(), edge_flip_exec(), edge_rotate_selected(), editmesh_mark_seam(), editmesh_mark_sharp(), editmesh_select_all_exec(), editvert_mirror_update(), extrude_repeat_mesh_exec(), face_duplilist(), fill_mesh_exec(), flip_normals(), give_parvert(), hide_exec(), hide_mesh_exec(), image_refresh(), knife_cut_exec(), linked_limit_default(), loop_multiselect(), loop_to_region(), make_fgon_exec(), make_prim(), merge_exec(), merge_type_itemf(), mesh_duplicate_exec(), mesh_extrude_exec(), mesh_extrude_invoke(), mesh_extrude_itemf(), mesh_faces_shade_flat_exec(), mesh_faces_shade_smooth_exec(), mesh_mirror_colors(), mesh_mirror_uvs(), mesh_noise_exec(), mesh_rip_invoke(), mesh_rotate_colors(), mesh_rotate_uvs(), mesh_select_nth_exec(), mesh_select_random_exec(), mesh_separate_loose(), mesh_separate_material(), mesh_separate_selected(), mesh_shortest_path_select_poll(), mesh_vertices_randomize_exec(), meshdeformModifier_do(), minimize_stretch_init(), mouse_select(), navmesh_face_add_exec(), navmesh_face_copy_exec(), normals_make_consistent_exec(), object_get_derived_final(), object_handle_update(), object_hook_index_array(), object_origin_set_exec(), pack_islands_exec(), pin_exec(), quads_convert_to_tris_exec(), region_to_loop(), removedoublesflag_exec(), reset_exec(), reveal_exec(), reveal_mesh_exec(), ringsel_finish(), ringsel_init(), screw_mesh_exec(), select_all_exec(), select_all_perform(), select_axis_exec(), select_by_number_vertices_exec(), select_editmesh_hook(), select_less(), select_linked_exec(), select_linked_flat_faces_exec(), select_linked_internal(), select_mirror_exec(), select_more(), select_non_manifold_exec(), select_pinned_exec(), select_sharp_edges_exec(), select_similar_type_itemf(), select_vertex_path_exec(), shape_propagate_to_all_exec(), similar_edge_select_exec(), similar_face_select_exec(), similar_vert_select_exec(), smooth_vertex(), snap_uvs_to_adjacent_unselected(), snap_uvs_to_cursor(), snap_uvs_to_pixels(), solidify_exec(), sphere_project_exec(), spin_mesh(), split_mesh(), stats_object_edit(), stitch_exec(), subdivide_exec(), tris_convert_to_quads_exec(), uiTemplateEditModeSelection(), unlink_selection_exec(), unwrap_exec(), uv_faces_do_sticky(), uv_from_view_exec(), uv_map_transform(), uvedit_center(), uvedit_set_tile(), uvedit_vertex_buttons(), v3d_editvertex_buts(), vertex_duplilist(), vertex_parent_set_exec(), vgroup_active_remove_verts(), vgroup_assign_verts(), vgroup_blend(), vgroup_copy_active_to_sel(), vgroup_copy_active_to_sel_single(), vgroup_delete_edit_mode(), vgroup_do_remap(), vgroup_select_verts(), and weld_align_uv().

void boundbox_mesh ( Mesh me,
float *  loc,
float *  size 
)

Definition at line 307 of file mesh.c.

References Mesh::bb, boundbox_set_from_min_max(), INIT_MINMAX, max, MEM_callocN(), mid_v3_v3v3(), min, minmax_mesh(), and NULL.

Referenced by tex_space_mesh().

void copy_dverts ( MDeformVert dst,
MDeformVert src,
int  copycount 
)

Definition at line 141 of file mesh.c.

References MDeformVert::dw, i, and MEM_callocN().

Referenced by copy_lattice(), copy_wpaint_prev(), load_editLatt(), and make_editLatt().

Mesh* copy_mesh ( Mesh me) [read]
void create_vert_edge_map ( ListBase **  map,
IndexNode **  mem,
const MEdge medge,
const int  totvert,
const int  totedge 
)

Definition at line 1432 of file mesh.c.

References BLI_addtail(), i, IndexNode::index, MEM_callocN(), and NULL.

void create_vert_face_map ( ListBase **  map,
IndexNode **  mem,
const MFace mface,
const int  totvert,
const int  totface 
)

Definition at line 1411 of file mesh.c.

References BLI_addtail(), i, IndexNode::index, MEM_callocN(), NULL, and MFace::v4.

static void expand_local_mesh ( Mesh me) [static]
void free_dverts ( MDeformVert dvert,
int  totvert 
)

Definition at line 160 of file mesh.c.

References i, and MEM_freeN().

Referenced by copy_wpaint_prev(), free_editLatt(), free_lattice(), load_editLatt(), and resizelattice().

void free_mesh ( Mesh me)
void free_uv_vert_map ( UvVertMap vmap)

Definition at line 1399 of file mesh.c.

References UvVertMap::buf, MEM_freeN(), and UvVertMap::vert.

Referenced by EM_make_uv_vert_map(), make_uv_vert_map(), and ss_sync_from_uv().

Mesh* get_mesh ( Object ob) [read]
float* get_mesh_orco_verts ( Object ob)
UvMapVert* get_uv_map_vert ( UvVertMap vmap,
unsigned int  v 
)

Definition at line 1394 of file mesh.c.

References UvVertMap::vert.

Referenced by get_face_uv_map_vert(), and ss_sync_from_uv().

void make_edges ( Mesh me,
int  old 
)
static void make_edges_mdata ( MVert UNUSEDallvert,
MFace allface,
int   UNUSEDtotvert,
int  totface,
int  old,
MEdge **  alledge,
int *  _totedge 
) [static]
void make_local_mesh ( Mesh me)
UvVertMap* make_uv_vert_map ( struct MFace mface,
struct MTFace tface,
unsigned int  totface,
unsigned int  totvert,
int  selected,
float *  limit 
)
void mball_to_mesh ( ListBase lb,
Mesh me 
)
void mesh_calc_normals ( MVert mverts,
int  numVerts,
MFace mfaces,
int  numFaces,
float(*)  faceNors_r[3] 
)
int mesh_center_bounds ( Mesh me,
float  cent[3] 
)

Definition at line 1656 of file mesh.c.

References INIT_MINMAX, max, mid_v3_v3v3(), min, and minmax_mesh().

Referenced by object_origin_set_exec().

int mesh_center_median ( Mesh me,
float  cent[3] 
)

Definition at line 1640 of file mesh.c.

References add_v3_v3(), MVert::co, mul_v3_fl(), Mesh::mvert, Mesh::totvert, and zero_v3().

Referenced by object_origin_set_exec().

void mesh_delete_material_index ( Mesh me,
short  index 
)

Definition at line 1226 of file mesh.c.

References i, MFace::mat_nr, and Mesh::mface.

Referenced by data_delete_material_index_id().

BoundBox* mesh_get_bb ( Object ob) [read]

Definition at line 354 of file mesh.c.

References Mesh::bb, Object::bb, Object::data, and tex_space_mesh().

Referenced by draw_bounding_volume(), minmax_object(), and object_get_boundbox().

void mesh_get_texspace ( Mesh me,
float *  loc_r,
float *  rot_r,
float *  size_r 
)
float(* mesh_getVertexCos ( Mesh me,
int *  numVerts_r 
) )[3]
void mesh_set_smooth_flag ( Object meshOb,
int  enableSmooth 
)

Definition at line 1237 of file mesh.c.

References Object::data, MFace::flag, i, ME_SMOOTH, Mesh::mface, and Mesh::totface.

Referenced by shade_smooth_exec().

void mesh_strip_loose_edges ( Mesh me)
void mesh_strip_loose_faces ( Mesh me)
void mesh_to_curve ( Scene scene,
Object ob 
)
void mesh_translate ( Mesh me,
float  offset[3],
int  do_keys 
)
void mesh_update_customdata_pointers ( Mesh me)
static void mfaces_strip_loose ( MFace mface,
int *  totface 
) [static]

Definition at line 558 of file mesh.c.

Referenced by nurbs_to_mdata_customdb().

int minmax_mesh ( Mesh me,
float  min[3],
float  max[3] 
)

Definition at line 1629 of file mesh.c.

References MVert::co, DO_MINMAX, Mesh::mvert, and Mesh::totvert.

Referenced by boundbox_mesh(), and mesh_center_bounds().

int nurbs_to_mdata ( Object ob,
MVert **  allvert,
int *  totvert,
MEdge **  alledge,
int *  totedge,
MFace **  allface,
int *  totface 
)

Definition at line 761 of file mesh.c.

References Object::disp, and nurbs_to_mdata_customdb().

Referenced by nurbs_to_mesh().

int nurbs_to_mdata_customdb ( Object ob,
ListBase dispbase,
MVert **  allvert,
int *  _totvert,
MEdge **  alledge,
int *  _totedge,
MFace **  allface,
int *  _totface 
)
void nurbs_to_mesh ( Object ob)
static void prependPolyLineVert ( ListBase lb,
unsigned int  index 
) [static]

Definition at line 1041 of file mesh.c.

References BLI_addhead(), VertLink::index, and MEM_callocN().

Referenced by mesh_to_curve().

void set_mesh ( Object ob,
Mesh me 
)
int test_index_face ( MFace mface,
CustomData fdata,
int  mfindex,
int  nr 
)
void tex_space_mesh ( Mesh me)
static void to_edgesort ( struct edgesort ed,
unsigned int  v1,
unsigned int  v2,
short  is_loose,
short  is_draw 
) [static]

Definition at line 532 of file mesh.c.

References edgesort::is_draw, edgesort::is_loose, edgesort::v1, and edgesort::v2.

Referenced by make_edges_mdata().

void transform_mesh_orco_verts ( Mesh me,
float(*)  orco[3],
int  totvert,
int  invert 
)
void unlink_mesh ( Mesh me)

Definition at line 101 of file mesh.c.

References Key::id, Material::id, Mesh::key, Mesh::mat, NULL, Mesh::texcomesh, Mesh::totcol, and ID::us.

Referenced by free_mesh(), and free_object().

static int vergedgesort ( const void *  v1,
const void *  v2 
) [static]

Definition at line 546 of file mesh.c.

References edgesort::v1, and edgesort::v2.

Referenced by make_edges_mdata().