Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions | Variables
BKE_mesh.h File Reference
#include "BKE_mesh_types.h"
#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Classes

struct  MLoopNorSpace
 
struct  MLoopNorSpaceArray
 

Macros

#define BKE_MESH_OMP_LIMIT   10000
 

Typedefs

typedef struct MLoopNorSpace MLoopNorSpace
 
typedef struct MLoopNorSpaceArray MLoopNorSpaceArray
 

Enumerations

enum  { MLNOR_SPACE_IS_SINGLE = 1 << 0 }
 
enum  { MLNOR_SPACEARR_LOOP_INDEX = 0 , MLNOR_SPACEARR_BMLOOP_PTR = 1 }
 
enum  { MESH_MERGE_VERTS_DUMP_IF_MAPPED , MESH_MERGE_VERTS_DUMP_IF_EQUAL }
 

Functions

void BKE_mesh_tag_coords_changed (struct Mesh *mesh)
 
void BKE_mesh_tag_coords_changed_uniformly (struct Mesh *mesh)
 
struct BMeshBKE_mesh_to_bmesh_ex (const struct Mesh *me, const struct BMeshCreateParams *create_params, const struct BMeshFromMeshParams *convert_params)
 
struct BMeshBKE_mesh_to_bmesh (struct Mesh *me, struct Object *ob, bool add_key_index, const struct BMeshCreateParams *params)
 
struct MeshBKE_mesh_from_bmesh_nomain (struct BMesh *bm, const struct BMeshToMeshParams *params, const struct Mesh *me_settings)
 
struct MeshBKE_mesh_from_bmesh_for_eval_nomain (struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra, const struct Mesh *me_settings)
 
void BKE_mesh_ensure_default_orig_index_customdata (struct Mesh *mesh)
 
void BKE_mesh_ensure_default_orig_index_customdata_no_check (struct Mesh *mesh)
 
int poly_find_loop_from_vert (const struct MPoly *poly, const struct MLoop *loopstart, uint vert)
 
int poly_get_adj_loops_from_vert (const struct MPoly *poly, const struct MLoop *mloop, unsigned int vert, unsigned int r_adj[2])
 
int BKE_mesh_edge_other_vert (const struct MEdge *e, int v)
 
void BKE_mesh_looptri_get_real_edges (const struct Mesh *mesh, const struct MLoopTri *looptri, int r_edges[3])
 
void BKE_mesh_free_data_for_undo (struct Mesh *me)
 
void BKE_mesh_clear_geometry (struct Mesh *me)
 
struct MeshBKE_mesh_add (struct Main *bmain, const char *name)
 
void BKE_mesh_free_editmesh (struct Mesh *mesh)
 
void BKE_mesh_copy_parameters_for_eval (struct Mesh *me_dst, const struct Mesh *me_src)
 
void BKE_mesh_copy_parameters (struct Mesh *me_dst, const struct Mesh *me_src)
 
void BKE_mesh_update_customdata_pointers (struct Mesh *me, bool do_ensure_tess_cd)
 
void BKE_mesh_ensure_skin_customdata (struct Mesh *me)
 
struct MeshBKE_mesh_new_nomain (int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
 
struct MeshBKE_mesh_new_nomain_from_template (const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
 
struct MeshBKE_mesh_new_nomain_from_template_ex (const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len, struct CustomData_MeshMasks mask)
 
void BKE_mesh_eval_delete (struct Mesh *mesh_eval)
 
struct MeshBKE_mesh_copy_for_eval (const struct Mesh *source, bool reference)
 
struct MeshBKE_mesh_new_nomain_from_curve (const struct Object *ob)
 
struct MeshBKE_mesh_new_nomain_from_curve_displist (const struct Object *ob, const struct ListBase *dispbase)
 
bool BKE_mesh_ensure_facemap_customdata (struct Mesh *me)
 
bool BKE_mesh_clear_facemap_customdata (struct Mesh *me)
 
float(* BKE_mesh_orco_verts_get (struct Object *ob))[3]
 
void BKE_mesh_orco_verts_transform (struct Mesh *me, float(*orco)[3], int totvert, int invert)
 
void BKE_mesh_orco_ensure (struct Object *ob, struct Mesh *mesh)
 
struct MeshBKE_mesh_from_object (struct Object *ob)
 
void BKE_mesh_assign_object (struct Main *bmain, struct Object *ob, struct Mesh *me)
 
void BKE_mesh_from_metaball (struct ListBase *lb, struct Mesh *me)
 
void BKE_mesh_to_curve_nurblist (const struct Mesh *me, struct ListBase *nurblist, int edge_users_test)
 
void BKE_mesh_to_curve (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
 
void BKE_pointcloud_from_mesh (struct Mesh *me, struct PointCloud *pointcloud)
 
void BKE_mesh_to_pointcloud (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
 
void BKE_mesh_from_pointcloud (const struct PointCloud *pointcloud, struct Mesh *me)
 
void BKE_pointcloud_to_mesh (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
 
void BKE_mesh_material_index_remove (struct Mesh *me, short index)
 
bool BKE_mesh_material_index_used (struct Mesh *me, short index)
 
void BKE_mesh_material_index_clear (struct Mesh *me)
 
void BKE_mesh_material_remap (struct Mesh *me, const unsigned int *remap, unsigned int remap_len)
 
void BKE_mesh_smooth_flag_set (struct Mesh *me, bool use_smooth)
 
void BKE_mesh_auto_smooth_flag_set (struct Mesh *me, bool use_auto_smooth, float auto_smooth_angle)
 
void BKE_mesh_edges_set_draw_render (struct Mesh *me)
 
const char * BKE_mesh_cmp (struct Mesh *me1, struct Mesh *me2, float thresh)
 
struct BoundBoxBKE_mesh_boundbox_get (struct Object *ob)
 
void BKE_mesh_texspace_calc (struct Mesh *me)
 
void BKE_mesh_texspace_ensure (struct Mesh *me)
 
void BKE_mesh_texspace_get (struct Mesh *me, float r_loc[3], float r_size[3])
 
void BKE_mesh_texspace_get_reference (struct Mesh *me, char **r_texflag, float **r_loc, float **r_size)
 
void BKE_mesh_texspace_copy_from_object (struct Mesh *me, struct Object *ob)
 
void BKE_mesh_split_faces (struct Mesh *mesh, bool free_loop_normals)
 
struct MeshBKE_mesh_new_from_object (struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers, bool preserve_origindex)
 
struct MeshBKE_mesh_new_from_object_to_bmain (struct Main *bmain, struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers)
 
struct MeshBKE_mesh_create_derived_for_modifier (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_eval, struct ModifierData *md_eval, bool use_virtual_modifiers, bool build_shapekey_layers)
 
void BKE_mesh_nomain_to_mesh (struct Mesh *mesh_src, struct Mesh *mesh_dst, struct Object *ob, const struct CustomData_MeshMasks *mask, bool take_ownership)
 
void BKE_mesh_nomain_to_meshkey (struct Mesh *mesh_src, struct Mesh *mesh_dst, struct KeyBlock *kb)
 
bool BKE_mesh_minmax (const struct Mesh *me, float r_min[3], float r_max[3])
 
void BKE_mesh_transform (struct Mesh *me, const float mat[4][4], bool do_keys)
 
void BKE_mesh_translate (struct Mesh *me, const float offset[3], bool do_keys)
 
void BKE_mesh_tessface_clear (struct Mesh *mesh)
 
void BKE_mesh_do_versions_cd_flag_init (struct Mesh *mesh)
 
void BKE_mesh_mselect_clear (struct Mesh *me)
 
void BKE_mesh_mselect_validate (struct Mesh *me)
 
int BKE_mesh_mselect_find (struct Mesh *me, int index, int type)
 
int BKE_mesh_mselect_active_get (struct Mesh *me, int type)
 
void BKE_mesh_mselect_active_set (struct Mesh *me, int index, int type)
 
void BKE_mesh_count_selected_items (const struct Mesh *mesh, int r_count[3])
 
float(* BKE_mesh_vert_coords_alloc (const struct Mesh *mesh, int *r_vert_len))[3]
 
void BKE_mesh_vert_coords_get (const struct Mesh *mesh, float(*vert_coords)[3])
 
void BKE_mesh_vert_coords_apply_with_mat4 (struct Mesh *mesh, const float(*vert_coords)[3], const float mat[4][4])
 
void BKE_mesh_vert_coords_apply (struct Mesh *mesh, const float(*vert_coords)[3])
 
void BKE_mesh_recalc_looptri (const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri)
 
void BKE_mesh_recalc_looptri_with_normals (const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri, const float(*poly_normals)[3])
 
const float(* BKE_mesh_vertex_normals_ensure (const struct Mesh *mesh))[3]
 
const float(* BKE_mesh_poly_normals_ensure (const struct Mesh *mesh))[3]
 
void BKE_mesh_normals_tag_dirty (struct Mesh *mesh)
 
void BKE_mesh_assert_normals_dirty_or_calculated (const struct Mesh *mesh)
 
float(* BKE_mesh_vertex_normals_for_write (struct Mesh *mesh))[3]
 
float(* BKE_mesh_poly_normals_for_write (struct Mesh *mesh))[3]
 
void BKE_mesh_clear_derived_normals (struct Mesh *mesh)
 
void BKE_mesh_vertex_normals_clear_dirty (struct Mesh *mesh)
 
void BKE_mesh_poly_normals_clear_dirty (struct Mesh *mesh)
 
bool BKE_mesh_vertex_normals_are_dirty (const struct Mesh *mesh)
 
bool BKE_mesh_poly_normals_are_dirty (const struct Mesh *mesh)
 
void BKE_mesh_calc_normals_poly (const struct MVert *mvert, int mvert_len, const struct MLoop *mloop, int mloop_len, const struct MPoly *mpoly, int mpoly_len, float(*r_poly_normals)[3])
 
void BKE_mesh_calc_normals_poly_and_vertex (const struct MVert *mvert, int mvert_len, const struct MLoop *mloop, int mloop_len, const struct MPoly *mpoly, int mpoly_len, float(*r_poly_normals)[3], float(*r_vert_normals)[3])
 
void BKE_mesh_calc_normals (struct Mesh *me)
 
void BKE_mesh_ensure_normals_for_display (struct Mesh *mesh)
 
void BKE_mesh_calc_normals_looptri (struct MVert *mverts, int numVerts, const struct MLoop *mloop, const struct MLoopTri *looptri, int looptri_num, float(*r_tri_nors)[3])
 
void BKE_mesh_loop_manifold_fan_around_vert_next (const struct MLoop *mloops, const struct MPoly *mpolys, const int *loop_to_poly, const int *e2lfan_curr, uint mv_pivot_index, const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index)
 
void BKE_edges_sharp_from_angle_set (const struct MVert *mverts, int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, float split_angle)
 
void BKE_lnor_spacearr_init (MLoopNorSpaceArray *lnors_spacearr, int numLoops, char data_type)
 
void BKE_lnor_spacearr_clear (MLoopNorSpaceArray *lnors_spacearr)
 
void BKE_lnor_spacearr_free (MLoopNorSpaceArray *lnors_spacearr)
 
void BKE_lnor_spacearr_tls_init (MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpaceArray *lnors_spacearr_tls)
 
void BKE_lnor_spacearr_tls_join (MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpaceArray *lnors_spacearr_tls)
 
MLoopNorSpaceBKE_lnor_space_create (MLoopNorSpaceArray *lnors_spacearr)
 
void BKE_lnor_space_define (MLoopNorSpace *lnor_space, const float lnor[3], float vec_ref[3], float vec_other[3], struct BLI_Stack *edge_vectors)
 
void BKE_lnor_space_add_loop (MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, int ml_index, void *bm_loop, bool is_single)
 
void BKE_lnor_space_custom_data_to_normal (MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3])
 
void BKE_lnor_space_custom_normal_to_data (MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2])
 
void BKE_mesh_normals_loop_split (const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, bool use_split_normals, float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], int *r_loop_to_poly)
 
void BKE_mesh_normals_loop_custom_set (const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_custom_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, short(*r_clnors_data)[2])
 
void BKE_mesh_normals_loop_custom_from_vertices_set (const struct MVert *mverts, const float(*vert_normals)[3], float(*r_custom_vertnors)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, short(*r_clnors_data)[2])
 
void BKE_mesh_normals_loop_to_vertex (int numVerts, const struct MLoop *mloops, int numLoops, const float(*clnors)[3], float(*r_vert_clnors)[3])
 
bool BKE_mesh_has_custom_loop_normals (struct Mesh *me)
 
void BKE_mesh_calc_normals_split (struct Mesh *mesh)
 
void BKE_mesh_calc_normals_split_ex (struct Mesh *mesh, struct MLoopNorSpaceArray *r_lnors_spacearr, float(*r_corner_normals)[3])
 
void BKE_mesh_set_custom_normals (struct Mesh *mesh, float(*r_custom_loopnors)[3])
 
void BKE_mesh_set_custom_normals_from_vertices (struct Mesh *mesh, float(*r_custom_vertnors)[3])
 
void BKE_mesh_calc_poly_normal (const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_no[3])
 
void BKE_mesh_calc_poly_normal_coords (const struct MPoly *mpoly, const struct MLoop *loopstart, const float(*vertex_coords)[3], float r_no[3])
 
void BKE_mesh_calc_poly_center (const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_cent[3])
 
float BKE_mesh_calc_poly_area (const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray)
 
float BKE_mesh_calc_area (const struct Mesh *me)
 
float BKE_mesh_calc_poly_uv_area (const struct MPoly *mpoly, const struct MLoopUV *uv_array)
 
void BKE_mesh_calc_poly_angles (const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float angles[])
 
void BKE_mesh_poly_edgehash_insert (struct EdgeHash *ehash, const struct MPoly *mp, const struct MLoop *mloop)
 
void BKE_mesh_poly_edgebitmap_insert (unsigned int *edge_bitmap, const struct MPoly *mp, const struct MLoop *mloop)
 
bool BKE_mesh_center_median (const struct Mesh *me, float r_cent[3])
 
bool BKE_mesh_center_median_from_polys (const struct Mesh *me, float r_cent[3])
 
bool BKE_mesh_center_bounds (const struct Mesh *me, float r_cent[3])
 
bool BKE_mesh_center_of_surface (const struct Mesh *me, float r_cent[3])
 
bool BKE_mesh_center_of_volume (const struct Mesh *me, float r_cent[3])
 
void BKE_mesh_calc_volume (const struct MVert *mverts, int mverts_num, const struct MLoopTri *mlooptri, int looptri_num, const struct MLoop *mloop, float *r_volume, float r_center[3])
 
void BKE_mesh_mdisp_flip (struct MDisps *md, bool use_loop_mdisp_flip)
 
void BKE_mesh_polygon_flip_ex (struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata, float(*lnors)[3], struct MDisps *mdisp, bool use_loop_mdisp_flip)
 
void BKE_mesh_polygon_flip (struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata)
 
void BKE_mesh_polygons_flip (struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata, int totpoly)
 
struct MeshBKE_mesh_merge_verts (struct Mesh *mesh, const int *vtargetmap, int tot_vtargetmap, int merge_mode)
 
void BKE_mesh_merge_customdata_for_apply_modifier (struct Mesh *me)
 
void BKE_mesh_flush_hidden_from_verts_ex (const struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, struct MPoly *mpoly, int totpoly)
 
void BKE_mesh_flush_hidden_from_verts (struct Mesh *me)
 
void BKE_mesh_flush_hidden_from_polys_ex (struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, const struct MPoly *mpoly, int totpoly)
 
void BKE_mesh_flush_hidden_from_polys (struct Mesh *me)
 
void BKE_mesh_flush_select_from_polys_ex (struct MVert *mvert, int totvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, const struct MPoly *mpoly, int totpoly)
 
void BKE_mesh_flush_select_from_polys (struct Mesh *me)
 
void BKE_mesh_flush_select_from_verts (struct Mesh *me)
 
void BKE_mesh_calc_relative_deform (const struct MPoly *mpoly, int totpoly, const struct MLoop *mloop, int totvert, const float(*vert_cos_src)[3], const float(*vert_cos_dst)[3], const float(*vert_cos_org)[3], float(*vert_cos_new)[3])
 
bool BKE_mesh_validate (struct Mesh *me, bool do_verbose, bool cddata_check_mask)
 
bool BKE_mesh_is_valid (struct Mesh *me)
 
bool BKE_mesh_validate_material_indices (struct Mesh *me)
 
bool BKE_mesh_validate_arrays (struct Mesh *me, struct MVert *mverts, unsigned int totvert, struct MEdge *medges, unsigned int totedge, struct MFace *mfaces, unsigned int totface, struct MLoop *mloops, unsigned int totloop, struct MPoly *mpolys, unsigned int totpoly, struct MDeformVert *dverts, bool do_verbose, bool do_fixes, bool *r_change)
 
bool BKE_mesh_validate_all_customdata (struct CustomData *vdata, uint totvert, struct CustomData *edata, uint totedge, struct CustomData *ldata, uint totloop, struct CustomData *pdata, uint totpoly, bool check_meshmask, bool do_verbose, bool do_fixes, bool *r_change)
 
void BKE_mesh_strip_loose_faces (struct Mesh *me)
 
void BKE_mesh_strip_loose_polysloops (struct Mesh *me)
 
void BKE_mesh_strip_loose_edges (struct Mesh *me)
 
void BKE_mesh_calc_edges_legacy (struct Mesh *me, bool use_old)
 
void BKE_mesh_calc_edges_loose (struct Mesh *mesh)
 
void BKE_mesh_calc_edges (struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges)
 
void BKE_mesh_calc_edges_tessface (struct Mesh *mesh)
 
void BKE_mesh_wrapper_deferred_finalize_mdata (struct Mesh *me_eval, const struct CustomData_MeshMasks *cd_mask_finalize)
 
void BKE_mesh_eval_geometry (struct Depsgraph *depsgraph, struct Mesh *mesh)
 
void BKE_mesh_batch_cache_dirty_tag (struct Mesh *me, eMeshBatchDirtyMode mode)
 
void BKE_mesh_batch_cache_free (struct Mesh *me)
 
char * BKE_mesh_debug_info (const struct Mesh *me) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
 
void BKE_mesh_debug_print (const struct Mesh *me) ATTR_NONNULL(1)
 

Variables

void(* BKE_mesh_batch_cache_dirty_tag_cb )(struct Mesh *me, eMeshBatchDirtyMode mode)
 
void(* BKE_mesh_batch_cache_free_cb )(struct Mesh *me)
 

Macro Definition Documentation

◆ BKE_MESH_OMP_LIMIT

#define BKE_MESH_OMP_LIMIT   10000

Definition at line 52 of file BKE_mesh.h.

Typedef Documentation

◆ MLoopNorSpace

typedef struct MLoopNorSpace MLoopNorSpace

References a contiguous loop-fan with normal offset vars.

◆ MLoopNorSpaceArray

Collection of MLoopNorSpace basic storage & pre-allocation.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

MLoopNorSpace.flags

Enumerator
MLNOR_SPACE_IS_SINGLE 

Definition at line 552 of file BKE_mesh.h.

◆ anonymous enum

anonymous enum

MLoopNorSpaceArray.data_type

Enumerator
MLNOR_SPACEARR_LOOP_INDEX 
MLNOR_SPACEARR_BMLOOP_PTR 

Definition at line 570 of file BKE_mesh.h.

◆ anonymous enum

anonymous enum
Enumerator
MESH_MERGE_VERTS_DUMP_IF_MAPPED 
MESH_MERGE_VERTS_DUMP_IF_EQUAL 

Definition at line 817 of file BKE_mesh.h.

Function Documentation

◆ BKE_edges_sharp_from_angle_set()

void BKE_edges_sharp_from_angle_set ( const struct MVert mverts,
int  numVerts,
struct MEdge medges,
int  numEdges,
struct MLoop mloops,
int  numLoops,
struct MPoly mpolys,
const float(*)  polynors[3],
int  numPolys,
float  split_angle 
)

Define sharp edges as needed to mimic 'autosmooth' from angle threshold.

Used when defining an empty custom loop normals data layer, to keep same shading as with auto-smooth!

Referenced by mesh_customdata_custom_splitnormals_add_exec().

◆ BKE_lnor_space_add_loop()

void BKE_lnor_space_add_loop ( MLoopNorSpaceArray lnors_spacearr,
MLoopNorSpace lnor_space,
int  ml_index,
void bm_loop,
bool  is_single 
)

Add a new given loop to given lnor_space. Depending on lnor_space->data_type, we expect bm_loop to be a pointer to BMLoop struct (in case of BMLOOP_PTR), or nullptr (in case of LOOP_INDEX), loop index is then stored in pointer. If is_single is set, the BMLoop or loop index is directly stored in lnor_space->loops pointer (since there is only one loop in this fan), else it is added to the linked list of loops in the fan.

Definition at line 660 of file mesh_normals.cc.

References BLI_assert, BLI_linklist_prepend_nlink(), MLoopNorSpaceArray::data_type, MLoopNorSpace::flags, MLoopNorSpace::loops, MLoopNorSpaceArray::loops_pool, MLoopNorSpaceArray::lspacearr, MLNOR_SPACE_IS_SINGLE, MLNOR_SPACEARR_BMLOOP_PTR, MLNOR_SPACEARR_LOOP_INDEX, and POINTER_FROM_INT.

Referenced by bm_mesh_loops_calc_normals_for_loop(), split_loop_nor_fan_do(), and split_loop_nor_single_do().

◆ BKE_lnor_space_create()

MLoopNorSpace* BKE_lnor_space_create ( MLoopNorSpaceArray lnors_spacearr)

◆ BKE_lnor_space_custom_data_to_normal()

void BKE_lnor_space_custom_data_to_normal ( MLoopNorSpace lnor_space,
const short  clnor_data[2],
float  r_custom_lnor[3] 
)

◆ BKE_lnor_space_custom_normal_to_data()

void BKE_lnor_space_custom_normal_to_data ( MLoopNorSpace lnor_space,
const float  custom_lnor[3],
short  r_clnor_data[2] 
)

◆ BKE_lnor_space_define()

void BKE_lnor_space_define ( MLoopNorSpace lnor_space,
const float  lnor[3],
float  vec_ref[3],
float  vec_other[3],
struct BLI_Stack edge_vectors 
)

◆ BKE_lnor_spacearr_clear()

void BKE_lnor_spacearr_clear ( MLoopNorSpaceArray lnors_spacearr)

◆ BKE_lnor_spacearr_free()

void BKE_lnor_spacearr_free ( MLoopNorSpaceArray lnors_spacearr)

◆ BKE_lnor_spacearr_init()

void BKE_lnor_spacearr_init ( MLoopNorSpaceArray lnors_spacearr,
int  numLoops,
char  data_type 
)

◆ BKE_lnor_spacearr_tls_init()

void BKE_lnor_spacearr_tls_init ( MLoopNorSpaceArray lnors_spacearr,
MLoopNorSpaceArray lnors_spacearr_tls 
)

Utility for multi-threaded calculation that ensures lnors_spacearr_tls doesn't share memory with lnors_spacearr that would cause it not to be thread safe.

Note
This works as long as threads never operate on the same loops at once.

Definition at line 541 of file mesh_normals.cc.

References BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, and MLoopNorSpaceArray::mem.

Referenced by bm_mesh_loops_calc_normals_for_vert_init_fn().

◆ BKE_lnor_spacearr_tls_join()

void BKE_lnor_spacearr_tls_join ( MLoopNorSpaceArray lnors_spacearr,
MLoopNorSpaceArray lnors_spacearr_tls 
)

Utility for multi-threaded calculation that merges lnors_spacearr_tls into lnors_spacearr.

Definition at line 548 of file mesh_normals.cc.

References BKE_lnor_spacearr_clear(), BLI_assert, BLI_memarena_free(), BLI_memarena_merge(), MLoopNorSpaceArray::data_type, MLoopNorSpaceArray::mem, and MLoopNorSpaceArray::spaces_num.

Referenced by bm_mesh_loops_calc_normals_for_vert_reduce_fn().

◆ BKE_mesh_add()

struct Mesh* BKE_mesh_add ( struct Main bmain,
const char *  name 
)

◆ BKE_mesh_assert_normals_dirty_or_calculated()

void BKE_mesh_assert_normals_dirty_or_calculated ( const struct Mesh mesh)

Check that a mesh with non-dirty normals has vertex and face custom data layers. If these asserts fail, it means some area cleared the dirty flag but didn't copy or add the normal layers, or removed normals but didn't set the dirty flag.

Referenced by BKE_mesh_calc_normals_split_ex(), BKE_mesh_copy_parameters_for_eval(), BKE_mesh_is_valid(), BKE_mesh_nomain_to_mesh(), BKE_mesh_split_faces(), BKE_mesh_validate_arrays(), mesh_blend_read_data(), mesh_calc_modifiers(), mesh_copy_data(), and mesh_get_eval_final().

◆ BKE_mesh_assign_object()

void BKE_mesh_assign_object ( struct Main bmain,
struct Object ob,
struct Mesh me 
)

◆ BKE_mesh_auto_smooth_flag_set()

void BKE_mesh_auto_smooth_flag_set ( struct Mesh me,
bool  use_auto_smooth,
float  auto_smooth_angle 
)

Definition at line 1500 of file mesh.cc.

References Mesh::flag, ME_AUTOSMOOTH, and Mesh::smoothresh.

Referenced by shade_smooth_exec().

◆ BKE_mesh_batch_cache_dirty_tag()

void BKE_mesh_batch_cache_dirty_tag ( struct Mesh me,
eMeshBatchDirtyMode  mode 
)

◆ BKE_mesh_batch_cache_free()

void BKE_mesh_batch_cache_free ( struct Mesh me)

◆ BKE_mesh_boundbox_get()

struct BoundBox* BKE_mesh_boundbox_get ( struct Object ob)

◆ BKE_mesh_calc_area()

float BKE_mesh_calc_area ( const struct Mesh me)

Referenced by quadriflow_check().

◆ BKE_mesh_calc_edges()

void BKE_mesh_calc_edges ( struct Mesh mesh,
bool  keep_existing_edges,
bool  select_new_edges 
)

◆ BKE_mesh_calc_edges_legacy()

void BKE_mesh_calc_edges_legacy ( struct Mesh me,
bool  use_old 
)

◆ BKE_mesh_calc_edges_loose()

void BKE_mesh_calc_edges_loose ( struct Mesh mesh)

◆ BKE_mesh_calc_edges_tessface()

void BKE_mesh_calc_edges_tessface ( struct Mesh mesh)

◆ BKE_mesh_calc_normals()

void BKE_mesh_calc_normals ( struct Mesh me)

Calculate vertex and face normals, storing the result in custom data layers on the mesh.

Note
It is usually preferable to calculate normals lazily with BKE_mesh_vertex_normals_ensure, but some areas (perhaps unnecessarily) can also calculate them eagerly.

Definition at line 454 of file mesh_normals.cc.

References BKE_mesh_calc_normals(), BKE_mesh_vertex_normals_ensure(), mesh, TIMEIT_END_AVERAGED, and TIMEIT_START_AVERAGED.

Referenced by BKE_mesh_calc_normals().

◆ BKE_mesh_calc_normals_looptri()

void BKE_mesh_calc_normals_looptri ( struct MVert mverts,
int  numVerts,
const struct MLoop mloop,
const struct MLoopTri looptri,
int  looptri_num,
float(*)  r_tri_nors[3] 
)

◆ BKE_mesh_calc_normals_poly()

void BKE_mesh_calc_normals_poly ( const struct MVert mvert,
int  mvert_len,
const struct MLoop mloop,
int  mloop_len,
const struct MPoly mpoly,
int  mpoly_len,
float(*)  r_poly_normals[3] 
)

Calculate face normals directly into a result array.

Note
Usually BKE_mesh_poly_normals_ensure is the preferred way to access face normals, since they may already be calculated and cached on the mesh.

Referenced by BKE_keyblock_mesh_calc_normals().

◆ BKE_mesh_calc_normals_poly_and_vertex()

void BKE_mesh_calc_normals_poly_and_vertex ( const struct MVert mvert,
int  mvert_len,
const struct MLoop mloop,
int  mloop_len,
const struct MPoly mpoly,
int  mpoly_len,
float(*)  r_poly_normals[3],
float(*)  r_vert_normals[3] 
)

Calculate face and vertex normals directly into result arrays.

Note
Usually BKE_mesh_vertex_normals_ensure is the preferred way to access vertex normals, since they may already be calculated and cached on the mesh.

Referenced by BKE_keyblock_mesh_calc_normals().

◆ BKE_mesh_calc_normals_split()

void BKE_mesh_calc_normals_split ( struct Mesh mesh)

◆ BKE_mesh_calc_normals_split_ex()

void BKE_mesh_calc_normals_split_ex ( struct Mesh mesh,
struct MLoopNorSpaceArray r_lnors_spacearr,
float(*)  r_corner_normals[3] 
)

Compute 'split' (aka loop, or per face corner's) normals.

Parameters
r_lnors_spacearrAllows to get computed loop normal space array. That data, among other things, contains 'smooth fan' info, useful e.g. to split geometry along sharp edges.

Definition at line 1875 of file mesh.cc.

References BKE_mesh_assert_normals_dirty_or_calculated(), BKE_mesh_normals_loop_split(), BKE_mesh_poly_normals_ensure(), BKE_mesh_vertex_normals_ensure(), CD_CUSTOMLOOPNORMAL, CustomData_get_layer(), Mesh::flag, Mesh::ldata, M_PI, ME_AUTOSMOOTH, Mesh::medge, mesh, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::smoothresh, Mesh::totedge, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.

Referenced by BKE_mesh_calc_normals_split(), BKE_mesh_split_faces(), and blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec().

◆ BKE_mesh_calc_poly_angles()

void BKE_mesh_calc_poly_angles ( const struct MPoly mpoly,
const struct MLoop loopstart,
const struct MVert mvarray,
float  angles[] 
)

◆ BKE_mesh_calc_poly_area()

float BKE_mesh_calc_poly_area ( const struct MPoly mpoly,
const struct MLoop loopstart,
const struct MVert mvarray 
)

◆ BKE_mesh_calc_poly_center()

void BKE_mesh_calc_poly_center ( const struct MPoly mpoly,
const struct MLoop loopstart,
const struct MVert mvarray,
float  r_cent[3] 
)

◆ BKE_mesh_calc_poly_normal()

void BKE_mesh_calc_poly_normal ( const struct MPoly mpoly,
const struct MLoop loopstart,
const struct MVert mvarray,
float  r_no[3] 
)

◆ BKE_mesh_calc_poly_normal_coords()

void BKE_mesh_calc_poly_normal_coords ( const struct MPoly mpoly,
const struct MLoop loopstart,
const float(*)  vertex_coords[3],
float  r_no[3] 
)

◆ BKE_mesh_calc_poly_uv_area()

float BKE_mesh_calc_poly_uv_area ( const struct MPoly mpoly,
const struct MLoopUV uv_array 
)

◆ BKE_mesh_calc_relative_deform()

void BKE_mesh_calc_relative_deform ( const struct MPoly mpoly,
int  totpoly,
const struct MLoop mloop,
int  totvert,
const float(*)  vert_cos_src[3],
const float(*)  vert_cos_dst[3],
const float(*)  vert_cos_org[3],
float(*)  vert_cos_new[3] 
)

This function takes the difference between 2 vertex-coord-arrays (vert_cos_src, vert_cos_dst), and applies the difference to vert_cos_new relative to vert_cos_org.

Parameters
vert_cos_srcreference deform source.
vert_cos_dstreference deform destination.
vert_cos_orgreference for the output location.
vert_cos_newresulting coords.

Referenced by meshcache_do().

◆ BKE_mesh_calc_volume()

void BKE_mesh_calc_volume ( const struct MVert mverts,
int  mverts_num,
const struct MLoopTri mlooptri,
int  looptri_num,
const struct MLoop mloop,
float r_volume,
float  r_center[3] 
)

Calculate the volume and center.

Parameters
r_volumeVolume (unsigned).
r_centerCenter of mass.

◆ BKE_mesh_center_bounds()

bool BKE_mesh_center_bounds ( const struct Mesh me,
float  r_cent[3] 
)

Referenced by object_origin_set_exec().

◆ BKE_mesh_center_median()

bool BKE_mesh_center_median ( const struct Mesh me,
float  r_cent[3] 
)

Referenced by object_origin_set_exec().

◆ BKE_mesh_center_median_from_polys()

bool BKE_mesh_center_median_from_polys ( const struct Mesh me,
float  r_cent[3] 
)

Calculate the center from polygons, use when we want to ignore vertex locations that don't have connected faces.

◆ BKE_mesh_center_of_surface()

bool BKE_mesh_center_of_surface ( const struct Mesh me,
float  r_cent[3] 
)

Referenced by object_origin_set_exec().

◆ BKE_mesh_center_of_volume()

bool BKE_mesh_center_of_volume ( const struct Mesh me,
float  r_cent[3] 
)
Note
Mesh must be manifold with consistent face-winding, see mesh_calc_poly_volume_centroid for details.

Referenced by object_origin_set_exec().

◆ BKE_mesh_clear_derived_normals()

void BKE_mesh_clear_derived_normals ( struct Mesh mesh)

Free any cached vertex or poly normals. Face corner (loop) normals are also derived data, but are not handled with the same method yet, so they are not included. It's important that this is called after the mesh changes size, since otherwise cached normal arrays might not be large enough (though it may be called indirectly by other functions).

Note
Normally it's preferred to call BKE_mesh_normals_tag_dirty instead, but this can be used in specific situations to reset a mesh or reduce memory usage.

Definition at line 147 of file mesh_normals.cc.

References MEM_SAFE_FREE, mesh, Mesh_Runtime::poly_normals, Mesh_Runtime::poly_normals_dirty, Mesh::runtime, Mesh_Runtime::vert_normals, and Mesh_Runtime::vert_normals_dirty.

Referenced by BKE_mesh_nomain_to_mesh(), BKE_mesh_runtime_clear_cache(), BM_mesh_bm_to_me(), BM_mesh_bm_to_me_for_eval(), and ED_mesh_join_objects_exec().

◆ BKE_mesh_clear_facemap_customdata()

bool BKE_mesh_clear_facemap_customdata ( struct Mesh me)

◆ BKE_mesh_clear_geometry()

void BKE_mesh_clear_geometry ( struct Mesh me)

◆ BKE_mesh_cmp()

const char* BKE_mesh_cmp ( struct Mesh me1,
struct Mesh me2,
float  thresh 
)

Used for unit testing; compares two meshes, checking only differences we care about. should be usable with leaf's testing framework I get RNA work done, will use hackish testing code for now.

Definition at line 702 of file mesh.cc.

References Freestyle::c, cmpcode_to_str(), customdata_compare(), Mesh::edata, Mesh::ldata, Mesh::pdata, Mesh::totedge, Mesh::totloop, Mesh::totpoly, Mesh::totvert, and Mesh::vdata.

◆ BKE_mesh_copy_for_eval()

struct Mesh* BKE_mesh_copy_for_eval ( const struct Mesh source,
bool  reference 
)

◆ BKE_mesh_copy_parameters()

void BKE_mesh_copy_parameters ( struct Mesh me_dst,
const struct Mesh me_src 
)

Copy user editable settings that we want to preserve when a new mesh is based on an existing mesh.

Referenced by BKE_id_eval_properties_copy().

◆ BKE_mesh_copy_parameters_for_eval()

void BKE_mesh_copy_parameters_for_eval ( struct Mesh me_dst,
const struct Mesh me_src 
)

A version of BKE_mesh_copy_parameters that is intended for evaluated output (the modifier stack for example).

Warning
User counts are not handled for ID's.

Referenced by BKE_mesh_wrapper_from_editmesh_with_coords(), create_empty_mesh(), blender::geometry::execute_realize_mesh_tasks(), geometry_extract_apply(), modifier_modify_mesh_and_geometry_set(), modifyMesh(), and paint_mask_slice_exec().

◆ BKE_mesh_count_selected_items()

void BKE_mesh_count_selected_items ( const struct Mesh mesh,
int  r_count[3] 
)

◆ BKE_mesh_create_derived_for_modifier()

struct Mesh* BKE_mesh_create_derived_for_modifier ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob_eval,
struct ModifierData md_eval,
bool  use_virtual_modifiers,
bool  build_shapekey_layers 
)

◆ BKE_mesh_debug_info()

char* BKE_mesh_debug_info ( const struct Mesh me)

◆ BKE_mesh_debug_print()

void BKE_mesh_debug_print ( const struct Mesh me)

◆ BKE_mesh_do_versions_cd_flag_init()

void BKE_mesh_do_versions_cd_flag_init ( struct Mesh mesh)

◆ BKE_mesh_edge_other_vert()

int BKE_mesh_edge_other_vert ( const struct MEdge e,
int  v 
)

Return the index of the edge vert that is not equal to v. If neither edge vertex is equal to v, returns -1.

Referenced by BKE_mesh_remap_calc_edges_from_mesh(), build_edge_mats(), build_emats_stack(), and collect_hull_frames().

◆ BKE_mesh_edges_set_draw_render()

void BKE_mesh_edges_set_draw_render ( struct Mesh me)

Needed after converting a mesh with subsurf optimal display to mesh.

Definition at line 826 of file mesh_convert.cc.

References MEdge::flag, ME_EDGEDRAW, ME_EDGERENDER, Mesh::medge, mesh, and Mesh::totedge.

Referenced by object_convert_exec().

◆ BKE_mesh_ensure_default_orig_index_customdata()

void BKE_mesh_ensure_default_orig_index_customdata ( struct Mesh mesh)

Add original index (CD_ORIGINDEX) layers if they don't already exist. This is meant to be used when creating an evaluated mesh from an original edit mode mesh, to allow mapping from the evaluated vertices to the originals.

The mesh is expected to of a ME_WRAPPER_TYPE_MDATA wrapper type. This is asserted.

Definition at line 1194 of file mesh.cc.

References BKE_mesh_ensure_default_orig_index_customdata_no_check(), BLI_assert, ME_WRAPPER_TYPE_MDATA, mesh, Mesh::runtime, and Mesh_Runtime::wrapper_type.

Referenced by create_orco_mesh(), and editbmesh_calc_modifiers().

◆ BKE_mesh_ensure_default_orig_index_customdata_no_check()

void BKE_mesh_ensure_default_orig_index_customdata_no_check ( struct Mesh mesh)

Same as BKE_mesh_ensure_default_orig_index_customdata but does not perform any checks: they must be done by the caller.

Definition at line 1200 of file mesh.cc.

References Mesh::edata, ensure_orig_index_layer(), mesh, Mesh::pdata, Mesh::totedge, Mesh::totpoly, Mesh::totvert, and Mesh::vdata.

Referenced by BKE_mesh_ensure_default_orig_index_customdata().

◆ BKE_mesh_ensure_facemap_customdata()

bool BKE_mesh_ensure_facemap_customdata ( struct Mesh me)

◆ BKE_mesh_ensure_normals_for_display()

void BKE_mesh_ensure_normals_for_display ( struct Mesh mesh)

◆ BKE_mesh_ensure_skin_customdata()

void BKE_mesh_ensure_skin_customdata ( struct Mesh me)

◆ BKE_mesh_eval_delete()

void BKE_mesh_eval_delete ( struct Mesh mesh_eval)

◆ BKE_mesh_eval_geometry()

void BKE_mesh_eval_geometry ( struct Depsgraph depsgraph,
struct Mesh mesh 
)

◆ BKE_mesh_flush_hidden_from_polys()

void BKE_mesh_flush_hidden_from_polys ( struct Mesh me)

◆ BKE_mesh_flush_hidden_from_polys_ex()

void BKE_mesh_flush_hidden_from_polys_ex ( struct MVert mvert,
const struct MLoop mloop,
struct MEdge medge,
int  totedge,
const struct MPoly mpoly,
int  totpoly 
)

◆ BKE_mesh_flush_hidden_from_verts()

void BKE_mesh_flush_hidden_from_verts ( struct Mesh me)

◆ BKE_mesh_flush_hidden_from_verts_ex()

void BKE_mesh_flush_hidden_from_verts_ex ( const struct MVert mvert,
const struct MLoop mloop,
struct MEdge medge,
int  totedge,
struct MPoly mpoly,
int  totpoly 
)

Update the hide flag for edges and faces from the corresponding flag in verts.

◆ BKE_mesh_flush_select_from_polys()

void BKE_mesh_flush_select_from_polys ( struct Mesh me)

◆ BKE_mesh_flush_select_from_polys_ex()

void BKE_mesh_flush_select_from_polys_ex ( struct MVert mvert,
int  totvert,
const struct MLoop mloop,
struct MEdge medge,
int  totedge,
const struct MPoly mpoly,
int  totpoly 
)

simple poly -> vert/edge selection.

◆ BKE_mesh_flush_select_from_verts()

void BKE_mesh_flush_select_from_verts ( struct Mesh me)

◆ BKE_mesh_free_data_for_undo()

void BKE_mesh_free_data_for_undo ( struct Mesh me)

Free (or release) any data used by this mesh (does not free the mesh itself). Only use for undo, in most cases BKE_id_free(nullptr, me) should be used.

Definition at line 903 of file mesh.cc.

References Mesh::id, and mesh_free_data().

Referenced by undomesh_free_data().

◆ BKE_mesh_free_editmesh()

void BKE_mesh_free_editmesh ( struct Mesh mesh)

◆ BKE_mesh_from_bmesh_for_eval_nomain()

struct Mesh* BKE_mesh_from_bmesh_for_eval_nomain ( struct BMesh bm,
const struct CustomData_MeshMasks cd_mask_extra,
const struct Mesh me_settings 
)

◆ BKE_mesh_from_bmesh_nomain()

struct Mesh* BKE_mesh_from_bmesh_nomain ( struct BMesh bm,
const struct BMeshToMeshParams params,
const struct Mesh me_settings 
)

◆ BKE_mesh_from_metaball()

void BKE_mesh_from_metaball ( struct ListBase lb,
struct Mesh me 
)

◆ BKE_mesh_from_object()

struct Mesh* BKE_mesh_from_object ( struct Object ob)

Definition at line 1365 of file mesh.cc.

References Object::data, OB_MESH, and Object::type.

Referenced by BKE_sculpt_ensure_orig_mesh_data(), build_pbvh_from_ccg(), createTransEdge(), do_paintface_box_select(), ED_mesh_join_objects_exec(), ED_object_sculptmode_enter_ex(), ED_object_sculptmode_exit_ex(), ED_object_texture_paint_mode_enter_ex(), ED_object_texture_paint_mode_exit_ex(), ED_paint_proj_mesh_data_check(), ed_vwpaintmode_enter_generic(), ed_vwpaintmode_exit_generic(), ED_wpaint_ensure_data(), multires_force_external_reload(), multiresModifier_del_levels(), paint_proj_new_stroke(), paintface_deselect_all_visible(), paintface_flush_flags(), paintface_hide(), paintface_minmax(), paintface_mouse_select(), paintface_reveal(), paintface_select_linked(), paintvert_deselect_all_visible(), paintvert_flush_flags(), paintvert_hide(), paintvert_reveal(), paintvert_select_ungrouped(), quadriflow_remesh_exec(), SCULPT_boundary_info_ensure(), sculpt_face_set_grow(), sculpt_face_set_shrink(), sculpt_gesture_apply_trim(), sculpt_gesture_init_face_set_properties(), SCULPT_mesh_symmetry_xyz_get(), vertex_color_brightness_contrast_exec(), vertex_color_hsv_exec(), vertex_color_invert_exec(), vertex_color_levels_exec(), vertex_color_set(), vertex_color_smooth(), vertex_paint_from_weight(), vertex_weight_paint_mode_poll(), vgroup_selected_get(), vpaint_mode_toggle_exec(), vpaint_stroke_test_start(), weight_paint_sample_enum_itemf(), weight_sample_invoke(), wpaint_mode_toggle_exec(), and wpaint_stroke_test_start().

◆ BKE_mesh_from_pointcloud()

void BKE_mesh_from_pointcloud ( const struct PointCloud pointcloud,
struct Mesh me 
)

◆ BKE_mesh_has_custom_loop_normals()

bool BKE_mesh_has_custom_loop_normals ( struct Mesh me)

◆ BKE_mesh_is_valid()

bool BKE_mesh_is_valid ( struct Mesh me)

◆ BKE_mesh_loop_manifold_fan_around_vert_next()

void BKE_mesh_loop_manifold_fan_around_vert_next ( const struct MLoop mloops,
const struct MPoly mpolys,
const int *  loop_to_poly,
const int *  e2lfan_curr,
uint  mv_pivot_index,
const struct MLoop **  r_mlfan_curr,
int *  r_mlfan_curr_index,
int *  r_mlfan_vert_index,
int *  r_mpfan_curr_index 
)

◆ BKE_mesh_looptri_get_real_edges()

void BKE_mesh_looptri_get_real_edges ( const struct Mesh mesh,
const struct MLoopTri looptri,
int  r_edges[3] 
)

Sets each output array element to the edge index if it is a real edge, or -1.

Referenced by GPU_pbvh_mesh_buffers_build(), lineart_identify_mlooptri_feature_edges(), mesh_looptri_target_project(), and shrinkwrap_build_boundary_data().

◆ BKE_mesh_material_index_clear()

void BKE_mesh_material_index_clear ( struct Mesh me)

Definition at line 1441 of file mesh.cc.

References MPoly::mat_nr, MFace::mat_nr, Mesh::mface, and Mesh::mpoly.

Referenced by material_data_index_clear_id().

◆ BKE_mesh_material_index_remove()

void BKE_mesh_material_index_remove ( struct Mesh me,
short  index 
)

Definition at line 1401 of file mesh.cc.

References MPoly::mat_nr, MFace::mat_nr, Mesh::mface, and Mesh::mpoly.

Referenced by material_data_index_remove_id().

◆ BKE_mesh_material_index_used()

bool BKE_mesh_material_index_used ( struct Mesh me,
short  index 
)

Definition at line 1420 of file mesh.cc.

References MPoly::mat_nr, MFace::mat_nr, Mesh::mface, and Mesh::mpoly.

Referenced by BKE_object_material_slot_used().

◆ BKE_mesh_material_remap()

void BKE_mesh_material_remap ( struct Mesh me,
const unsigned int *  remap,
unsigned int  remap_len 
)

◆ BKE_mesh_mdisp_flip()

void BKE_mesh_mdisp_flip ( struct MDisps md,
bool  use_loop_mdisp_flip 
)

Flip a single MLoop's MDisps structure, low level function to be called from face-flipping code which re-arranged the mdisps themselves.

Definition at line 635 of file mesh_evaluate.cc.

References MDisps::disps, float(), sqrt(), SWAP, swap_v3_v3(), MDisps::totdisp, UNLIKELY, x, and y.

Referenced by BKE_mesh_polygon_flip_ex(), and bmesh_kernel_loop_reverse().

◆ BKE_mesh_merge_customdata_for_apply_modifier()

void BKE_mesh_merge_customdata_for_apply_modifier ( struct Mesh me)

◆ BKE_mesh_merge_verts()

struct Mesh* BKE_mesh_merge_verts ( struct Mesh mesh,
const int *  vtargetmap,
int  tot_vtargetmap,
int  merge_mode 
)

Merge Verts

This frees the given mesh and returns a new mesh.

Parameters
vtargetmapThe table that maps vertices to target vertices. a value of -1 indicates a vertex is a target, and is to be kept. This array is aligned with 'mesh->totvert'
Warning
vtargetmap must not contain any chained mapping (v1 -> v2 -> v3 etc.), this is not supported and will likely generate corrupted geometry.
Parameters
tot_vtargetmapThe number of non '-1' values in vtargetmap. (not the size)
merge_modeenum with two modes.
  • MESH_MERGE_VERTS_DUMP_IF_MAPPED When called by the Mirror Modifier, In this mode it skips any faces that have all vertices merged (to avoid creating pairs of faces sharing the same set of vertices)
  • MESH_MERGE_VERTS_DUMP_IF_EQUAL When called by the Array Modifier, In this mode, faces where all vertices are merged are double-checked, to see whether all target vertices actually make up a poly already. Indeed it could be that all of a poly's vertices are merged, but merged to vertices that do not make up a single poly, in which case the original poly should not be dumped. Actually this later behavior could apply to the Mirror Modifier as well, but the additional checks are costly and not necessary in the case of mirror, because each vertex is only merged to its own mirror.

Definition at line 192 of file mesh_merge.c.

References BKE_mesh_vert_poly_map_create(), BLI_assert, BLI_BITMAP_DISABLE, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_edgehash_ensure_p(), BLI_edgehash_new_ex(), BLI_edgehash_remove(), BLI_gset_flag_set(), BLI_gset_haskey(), BLI_gset_insert(), BLI_gset_new_ex(), Freestyle::c, cddm_poly_compare(), MeshElemMap::count, MLoop::e, ELEM, GHASH_FLAG_ALLOW_DUPES, PolyKey::hash_sum, PolyKey::hash_xor, MeshElemMap::indices, LIKELY, MPoly::loopstart, Mesh::medge, MEM_malloc_arrayN, mesh, MESH_MERGE_VERTS_DUMP_IF_EQUAL, MESH_MERGE_VERTS_DUMP_IF_MAPPED, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, POINTER_AS_INT, POINTER_FROM_INT, poly_gset_compare_fn(), poly_gset_hash_fn(), PolyKey::poly_index, result, STACK_DECLARE, STACK_DISCARD, STACK_INIT, STACK_PUSH, STACK_PUSH_RET_PTR, STACK_SIZE, Mesh::totedge, Mesh::totloop, MPoly::totloop, PolyKey::totloops, Mesh::totpoly, Mesh::totvert, UNLIKELY, MLoop::v, v1, MEdge::v1, v2, and MEdge::v2.

Referenced by arrayModifier_doArray(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), and mesh_remove_doubles_on_axis().

◆ BKE_mesh_minmax()

bool BKE_mesh_minmax ( const struct Mesh me,
float  r_min[3],
float  r_max[3] 
)

◆ BKE_mesh_mselect_active_get()

int BKE_mesh_mselect_active_get ( struct Mesh me,
int  type 
)
Returns
The index of the active element.

Definition at line 1772 of file mesh.cc.

References BLI_assert, ELEM, MSelect::index, ME_ESEL, ME_FSEL, ME_VSEL, Mesh::mselect, Mesh::totselect, type, and MSelect::type.

Referenced by ED_mesh_active_dvert_get_ob().

◆ BKE_mesh_mselect_active_set()

void BKE_mesh_mselect_active_set ( struct Mesh me,
int  index,
int  type 
)

◆ BKE_mesh_mselect_clear()

void BKE_mesh_mselect_clear ( struct Mesh me)

◆ BKE_mesh_mselect_find()

int BKE_mesh_mselect_find ( struct Mesh me,
int  index,
int  type 
)
Returns
the index within me->mselect, or -1

Definition at line 1759 of file mesh.cc.

References BLI_assert, ELEM, MSelect::index, ME_ESEL, ME_FSEL, ME_VSEL, Mesh::mselect, Mesh::totselect, type, and MSelect::type.

Referenced by BKE_mesh_mselect_active_set().

◆ BKE_mesh_mselect_validate()

void BKE_mesh_mselect_validate ( struct Mesh me)

◆ BKE_mesh_new_from_object()

struct Mesh* BKE_mesh_new_from_object ( struct Depsgraph depsgraph,
struct Object object,
bool  preserve_all_data_layers,
bool  preserve_origindex 
)

Create new mesh from the given object at its current state. The owner of this mesh is unknown, it is up to the caller to decide.

If preserve_all_data_layers is truth then the modifier stack is re-evaluated to ensure it preserves all possible custom data layers.

Note
Dependency graph argument is required when preserve_all_data_layers is truth, and is ignored otherwise.

Definition at line 1102 of file mesh_convert.cc.

References BLI_assert, depsgraph, Mesh::edit_mesh, Mesh::id, mesh_new_from_curve_type_object(), mesh_new_from_mball_object(), mesh_new_from_mesh_object(), OB_CURVES_LEGACY, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, Object::type, and ID::us.

Referenced by bake(), bake_mesh_new_from_object(), BKE_mesh_new_from_object_to_bmain(), BKE_object_to_mesh(), bpy_bmesh_from_object(), blender::io::alembic::ABCMetaballWriter::get_export_mesh(), blender::io::usd::USDMetaballWriter::get_export_mesh(), lineart_object_load_single_instance(), and blender::io::obj::OBJMesh::OBJMesh().

◆ BKE_mesh_new_from_object_to_bmain()

struct Mesh* BKE_mesh_new_from_object_to_bmain ( struct Main bmain,
struct Depsgraph depsgraph,
struct Object object,
bool  preserve_all_data_layers 
)

◆ BKE_mesh_new_nomain()

struct Mesh* BKE_mesh_new_nomain ( int  verts_len,
int  edges_len,
int  tessface_len,
int  loops_len,
int  polys_len 
)

Definition at line 991 of file mesh.cc.

References BKE_idtype_idcode_to_name(), BKE_libblock_alloc(), BKE_libblock_init_empty(), BKE_mesh_update_customdata_pointers(), CD_NUMTYPES, copy_vn_i(), Mesh::edata, Mesh::fdata, Mesh::id, ID_ME, Mesh::ldata, LIB_ID_CREATE_LOCALIZE, mesh, mesh_ensure_cdlayers_primary(), Mesh::pdata, Mesh::totedge, Mesh::totface, Mesh::totloop, Mesh::totpoly, Mesh::totvert, CustomData::typemap, and Mesh::vdata.

Referenced by BKE_mesh_new_nomain_from_curve_displist(), blender::nodes::node_geo_curve_fill_cc::cdt_to_mesh(), blender::nodes::node_geo_mesh_primitive_circle_cc::create_circle_mesh(), blender::geometry::create_cuboid_mesh(), blender::nodes::create_cylinder_or_cone_mesh(), create_empty_mesh(), blender::nodes::create_grid_mesh(), blender::nodes::create_line_mesh(), blender::io::obj::MeshFromGeometry::create_mesh(), blender::nodes::node_geo_mesh_primitive_uv_sphere_cc::create_uv_sphere_mesh(), blender::nodes::create_vertex_mesh(), curve_calc_modifiers_post(), blender::bke::curve_to_mesh_sweep(), do_multires_bake(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_edges(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_mesh(), evaluate_surface_object(), blender::geometry::execute_realize_mesh_tasks(), blender::nodes::node_geo_points_to_vertices_cc::geometry_set_points_to_vertices(), get_quick_mesh(), hair_create_input_mesh(), modifier_modify_mesh_and_geometry_set(), modifyMesh(), multires_unsubdivide_to_basemesh(), blender::io::alembic::AbcPointsReader::read_mesh(), and sculpt_gesture_trim_geometry_generate().

◆ BKE_mesh_new_nomain_from_curve()

struct Mesh* BKE_mesh_new_nomain_from_curve ( const struct Object ob)

◆ BKE_mesh_new_nomain_from_curve_displist()

struct Mesh* BKE_mesh_new_nomain_from_curve_displist ( const struct Object ob,
const struct ListBase dispbase 
)

◆ BKE_mesh_new_nomain_from_template()

struct Mesh* BKE_mesh_new_nomain_from_template ( const struct Mesh me_src,
int  verts_len,
int  edges_len,
int  tessface_len,
int  loops_len,
int  polys_len 
)

◆ BKE_mesh_new_nomain_from_template_ex()

struct Mesh* BKE_mesh_new_nomain_from_template_ex ( const struct Mesh me_src,
int  verts_len,
int  edges_len,
int  tessface_len,
int  loops_len,
int  polys_len,
struct CustomData_MeshMasks  mask 
)

◆ BKE_mesh_nomain_to_mesh()

void BKE_mesh_nomain_to_mesh ( struct Mesh mesh_src,
struct Mesh mesh_dst,
struct Object ob,
const struct CustomData_MeshMasks mask,
bool  take_ownership 
)

◆ BKE_mesh_nomain_to_meshkey()

void BKE_mesh_nomain_to_meshkey ( struct Mesh mesh_src,
struct Mesh mesh_dst,
struct KeyBlock kb 
)

◆ BKE_mesh_normals_loop_custom_from_vertices_set()

void BKE_mesh_normals_loop_custom_from_vertices_set ( const struct MVert mverts,
const float(*)  vert_normals[3],
float(*)  r_custom_vertnors[3],
int  numVerts,
struct MEdge medges,
int  numEdges,
struct MLoop mloops,
int  numLoops,
struct MPoly mpolys,
const float(*)  polynors[3],
int  numPolys,
short(*)  r_clnors_data[2] 
)

◆ BKE_mesh_normals_loop_custom_set()

void BKE_mesh_normals_loop_custom_set ( const struct MVert mverts,
const float(*)  vert_normals[3],
int  numVerts,
struct MEdge medges,
int  numEdges,
struct MLoop mloops,
float(*)  r_custom_loopnors[3],
int  numLoops,
struct MPoly mpolys,
const float(*)  polynors[3],
int  numPolys,
short(*)  r_clnors_data[2] 
)

◆ BKE_mesh_normals_loop_split()

void BKE_mesh_normals_loop_split ( const struct MVert mverts,
const float(*)  vert_normals[3],
int  numVerts,
struct MEdge medges,
int  numEdges,
struct MLoop mloops,
float(*)  r_loopnors[3],
int  numLoops,
struct MPoly mpolys,
const float(*)  polynors[3],
int  numPolys,
bool  use_split_normals,
float  split_angle,
MLoopNorSpaceArray r_lnors_spacearr,
short(*)  clnors_data[2],
int *  r_loop_to_poly 
)

Compute split normals, i.e. vertex normals associated with each poly (hence 'loop normals'). Useful to materialize sharp edges (or non-smooth faces) without actually modifying the geometry (splitting edges).

Referenced by apply_weights_vertex_normal(), BKE_keyblock_mesh_calc_normals(), BKE_mesh_calc_normals_split_ex(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_remap_calc_loops_from_mesh(), data_transfer_dtdata_type_preprocess(), mesh_render_data_update_normals(), and normalEditModifier_do().

◆ BKE_mesh_normals_loop_to_vertex()

void BKE_mesh_normals_loop_to_vertex ( int  numVerts,
const struct MLoop mloops,
int  numLoops,
const float(*)  clnors[3],
float(*)  r_vert_clnors[3] 
)

Computes average per-vertex normals from given custom loop normals.

Parameters
clnorsThe computed custom loop normals.
r_vert_clnorsThe (already allocated) array where to store averaged per-vertex normals.

Referenced by displaceModifier_do().

◆ BKE_mesh_normals_tag_dirty()

void BKE_mesh_normals_tag_dirty ( struct Mesh mesh)

Tag mesh vertex and face normals to be recalculated when/if they are needed later.

Note
Dirty tagged normals are the default state of a new mesh, so tagging them dirty explicitly is not always necessary if the mesh is created locally.

Definition at line 95 of file mesh_normals.cc.

References mesh, Mesh_Runtime::poly_normals_dirty, Mesh::runtime, and Mesh_Runtime::vert_normals_dirty.

Referenced by BKE_mesh_tag_coords_changed(), ED_mesh_join_objects_exec(), ED_mesh_update(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), mesh_blend_read_data(), mesh_copy_data(), mesh_init_data(), MOD_solidify_extrude_modifyMesh(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), blender::io::alembic::process_no_normals(), and sculpt_symmetrize_exec().

◆ BKE_mesh_orco_ensure()

void BKE_mesh_orco_ensure ( struct Object ob,
struct Mesh mesh 
)

◆ BKE_mesh_orco_verts_get()

float(* BKE_mesh_orco_verts_get ( struct Object ob) )[3]

◆ BKE_mesh_orco_verts_transform()

void BKE_mesh_orco_verts_transform ( struct Mesh me,
float(*)  orco[3],
int  totvert,
int  invert 
)

◆ BKE_mesh_poly_edgebitmap_insert()

void BKE_mesh_poly_edgebitmap_insert ( unsigned int *  edge_bitmap,
const struct MPoly mp,
const struct MLoop mloop 
)

◆ BKE_mesh_poly_edgehash_insert()

void BKE_mesh_poly_edgehash_insert ( struct EdgeHash ehash,
const struct MPoly mp,
const struct MLoop mloop 
)

Referenced by make_edges_mdata_extend().

◆ BKE_mesh_poly_normals_are_dirty()

bool BKE_mesh_poly_normals_are_dirty ( const struct Mesh mesh)

Return true if the mesh polygon normals either are not stored or are dirty. This can be used to help decide whether to transfer them when copying a mesh.

Referenced by BKE_mesh_tag_coords_changed_uniformly(), BKE_subdiv_to_mesh(), C_BVHTree_FromObject(), and mesh_calc_tri_tessface().

◆ BKE_mesh_poly_normals_clear_dirty()

void BKE_mesh_poly_normals_clear_dirty ( struct Mesh mesh)

Mark the mesh's poly normals non-dirty, for when they are calculated or assigned manually.

Definition at line 131 of file mesh_normals.cc.

References BKE_mesh_assert_normals_dirty_or_calculated(), mesh, Mesh_Runtime::poly_normals_dirty, and Mesh::runtime.

Referenced by BKE_mesh_poly_normals_ensure(), BKE_mesh_tag_coords_changed_uniformly(), and BKE_mesh_vertex_normals_ensure().

◆ BKE_mesh_poly_normals_ensure()

const float(* BKE_mesh_poly_normals_ensure ( const struct Mesh mesh) )[3]

◆ BKE_mesh_poly_normals_for_write()

float(* BKE_mesh_poly_normals_for_write ( struct Mesh mesh) )[3]

Retrieve write access to the poly normal layer, ensuring that it exists and that it is not shared. The provided poly normals should be the same as if they were calculated automatically.

Note
In order to clear the dirty flag, this function should be followed by a call to BKE_mesh_poly_normals_clear_dirty. This is separate so that normals are still tagged dirty while they are being assigned.
Warning
The memory returned by this function is not initialized if it was not previously allocated.

Definition at line 113 of file mesh_normals.cc.

References BLI_assert, float(), MEM_allocN_len, MEM_malloc_arrayN, mesh, Mesh_Runtime::poly_normals, Mesh::runtime, and Mesh::totpoly.

Referenced by BKE_mesh_poly_normals_ensure(), BKE_mesh_vertex_normals_ensure(), normalEditModifier_do_directional(), and normalEditModifier_do_radial().

◆ BKE_mesh_polygon_flip()

void BKE_mesh_polygon_flip ( struct MPoly mpoly,
struct MLoop mloop,
struct CustomData ldata 
)

Definition at line 714 of file mesh_evaluate.cc.

References BKE_mesh_polygon_flip_ex(), CD_MDISPS, and CustomData_get_layer().

◆ BKE_mesh_polygon_flip_ex()

void BKE_mesh_polygon_flip_ex ( struct MPoly mpoly,
struct MLoop mloop,
struct CustomData ldata,
float(*)  lnors[3],
struct MDisps mdisp,
bool  use_loop_mdisp_flip 
)

Flip (invert winding of) the given mpoly, i.e. reverse order of its loops (keeping the same vertex as 'start point').

Parameters
mpolythe polygon to flip.
mloopthe full loops array.
ldatathe loops custom data.

Definition at line 671 of file mesh_evaluate.cc.

References BKE_mesh_mdisp_flip(), CD_MLOOP, CustomData_get_layer(), CustomData_swap(), e, MLoop::e, MPoly::loopstart, SWAP, swap_v3_v3(), and MPoly::totloop.

Referenced by BKE_mesh_polygon_flip(), BKE_mesh_polygons_flip(), and polygons_check_flip().

◆ BKE_mesh_polygons_flip()

void BKE_mesh_polygons_flip ( struct MPoly mpoly,
struct MLoop mloop,
struct CustomData ldata,
int  totpoly 
)

Flip (invert winding of) all polygons (used to inverse their normals).

Note
Invalidates tessellation, caller must handle that.

Definition at line 720 of file mesh_evaluate.cc.

References BKE_mesh_polygon_flip_ex(), CD_MDISPS, and CustomData_get_layer().

◆ BKE_mesh_recalc_looptri()

void BKE_mesh_recalc_looptri ( const struct MLoop mloop,
const struct MPoly mpoly,
const struct MVert mvert,
int  totloop,
int  totpoly,
struct MLoopTri mlooptri 
)

◆ BKE_mesh_recalc_looptri_with_normals()

void BKE_mesh_recalc_looptri_with_normals ( const struct MLoop mloop,
const struct MPoly mpoly,
const struct MVert mvert,
int  totloop,
int  totpoly,
struct MLoopTri mlooptri,
const float(*)  poly_normals[3] 
)

A version of BKE_mesh_recalc_looptri which takes pre-calculated polygon normals (used to avoid having to calculate the face normal for NGON tessellation).

Note
Only use this function if normals have already been calculated, there is no need to calculate normals just to use this function as it will cause the normals for triangles to be calculated which aren't needed for tessellation.

Referenced by mesh_calc_tri_tessface(), and mesh_render_data_update_looptris().

◆ BKE_mesh_set_custom_normals()

void BKE_mesh_set_custom_normals ( struct Mesh mesh,
float(*)  r_custom_loopnors[3] 
)

Higher level functions hiding most of the code needed around call to BKE_mesh_normals_loop_custom_set().

Parameters
r_custom_loopnorsis not const, since code will replace zero_v3 normals there with automatically computed vectors.

Definition at line 2075 of file mesh_normals.cc.

References mesh, and mesh_set_custom_normals().

Referenced by mesh_wrapper_ensure_subdivision(), modifyMesh(), blender::io::alembic::process_loop_normals(), and triangulate_mesh().

◆ BKE_mesh_set_custom_normals_from_vertices()

void BKE_mesh_set_custom_normals_from_vertices ( struct Mesh mesh,
float(*)  r_custom_vertnors[3] 
)

Higher level functions hiding most of the code needed around call to BKE_mesh_normals_loop_custom_from_vertices_set().

Parameters
r_custom_vertnorsis not const, since code will replace zero_v3 normals there with automatically computed vectors.

Definition at line 2080 of file mesh_normals.cc.

References mesh, and mesh_set_custom_normals().

Referenced by blender::io::alembic::process_vertex_normals().

◆ BKE_mesh_smooth_flag_set()

void BKE_mesh_smooth_flag_set ( struct Mesh me,
bool  use_smooth 
)

◆ BKE_mesh_split_faces()

void BKE_mesh_split_faces ( struct Mesh mesh,
bool  free_loop_normals 
)

◆ BKE_mesh_strip_loose_edges()

void BKE_mesh_strip_loose_edges ( struct Mesh me)

◆ BKE_mesh_strip_loose_faces()

void BKE_mesh_strip_loose_faces ( struct Mesh me)

◆ BKE_mesh_strip_loose_polysloops()

void BKE_mesh_strip_loose_polysloops ( struct Mesh me)

Works on both loops and polys!

Note
It won't try to guess which loops of an invalid poly to remove! this is the work of the caller, to mark those loops. See e.g. BKE_mesh_validate_arrays().

Definition at line 1184 of file mesh_validate.cc.

References Freestyle::a, usdtokens::b(), CustomData_copy_data(), CustomData_free_elem(), BMLoop::e, INVALID_LOOP_EDGE_MARKER, l, Mesh::ldata, MPoly::loopstart, MEM_freeN, MEM_mallocN, Mesh::mloop, Mesh::mpoly, Mesh::pdata, Mesh::totloop, MPoly::totloop, and Mesh::totpoly.

Referenced by BKE_mesh_validate_arrays().

◆ BKE_mesh_tag_coords_changed()

void BKE_mesh_tag_coords_changed ( struct Mesh mesh)

◆ BKE_mesh_tag_coords_changed_uniformly()

void BKE_mesh_tag_coords_changed_uniformly ( struct Mesh mesh)

◆ BKE_mesh_tessface_clear()

void BKE_mesh_tessface_clear ( struct Mesh mesh)

◆ BKE_mesh_texspace_calc()

void BKE_mesh_texspace_calc ( struct Mesh me)

◆ BKE_mesh_texspace_copy_from_object()

void BKE_mesh_texspace_copy_from_object ( struct Mesh me,
struct Object ob 
)

◆ BKE_mesh_texspace_ensure()

void BKE_mesh_texspace_ensure ( struct Mesh me)

◆ BKE_mesh_texspace_get()

void BKE_mesh_texspace_get ( struct Mesh me,
float  r_loc[3],
float  r_size[3] 
)

Definition at line 1275 of file mesh.cc.

References BKE_mesh_texspace_ensure(), copy_v3_v3(), Mesh::loc, and Mesh::size.

Referenced by BKE_mesh_orco_verts_transform().

◆ BKE_mesh_texspace_get_reference()

void BKE_mesh_texspace_get_reference ( struct Mesh me,
char **  r_texflag,
float **  r_loc,
float **  r_size 
)

◆ BKE_mesh_to_bmesh()

struct BMesh* BKE_mesh_to_bmesh ( struct Mesh me,
struct Object ob,
bool  add_key_index,
const struct BMeshCreateParams params 
)

◆ BKE_mesh_to_bmesh_ex()

struct BMesh* BKE_mesh_to_bmesh_ex ( const struct Mesh me,
const struct BMeshCreateParams create_params,
const struct BMeshFromMeshParams convert_params 
)

◆ BKE_mesh_to_curve()

void BKE_mesh_to_curve ( struct Main bmain,
struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob 
)

Referenced by object_convert_exec().

◆ BKE_mesh_to_curve_nurblist()

void BKE_mesh_to_curve_nurblist ( const struct Mesh me,
struct ListBase nurblist,
int  edge_users_test 
)

◆ BKE_mesh_to_pointcloud()

void BKE_mesh_to_pointcloud ( struct Main bmain,
struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob 
)

Referenced by object_convert_exec().

◆ BKE_mesh_transform()

void BKE_mesh_transform ( struct Mesh me,
const float  mat[4][4],
bool  do_keys 
)

◆ BKE_mesh_translate()

void BKE_mesh_translate ( struct Mesh me,
const float  offset[3],
bool  do_keys 
)

◆ BKE_mesh_update_customdata_pointers()

void BKE_mesh_update_customdata_pointers ( struct Mesh me,
bool  do_ensure_tess_cd 
)

Definition at line 874 of file mesh.cc.

References CD_MCOL, CD_MDEFORMVERT, CD_MEDGE, CD_MFACE, CD_MLOOP, CD_MLOOPUV, CD_MPOLY, CD_MTFACE, CD_MVERT, CD_PROP_BYTE_COLOR, CustomData_get_layer(), Mesh::dvert, Mesh::edata, Mesh::fdata, Mesh::ldata, Mesh::mcol, Mesh::medge, mesh_update_linked_customdata(), Mesh::mface, Mesh::mloop, Mesh::mloopcol, Mesh::mloopuv, Mesh::mpoly, Mesh::mtface, Mesh::mvert, Mesh::pdata, and Mesh::vdata.

Referenced by add_orco_mesh(), BKE_mesh_convert_mfaces_to_mpolys(), BKE_mesh_do_versions_convert_mfaces_to_mpolys(), BKE_mesh_from_metaball(), BKE_mesh_new_nomain(), BKE_mesh_new_nomain_from_template_ex(), BKE_mesh_nomain_to_mesh(), BKE_mesh_split_faces(), BKE_mesh_tessface_calc(), BKE_mesh_transform(), BKE_mesh_translate(), BKE_sculpt_color_layer_create_if_needed(), blo_do_versions_280(), BM_mesh_bm_to_me(), BM_mesh_bm_to_me_for_eval(), blender::bke::create_attribute_providers_for_mesh(), customdata_version_242(), delete_customdata_layer(), ED_mesh_color_add(), ED_mesh_color_ensure(), ED_mesh_join_objects_exec(), ED_mesh_sculpt_color_add(), ED_mesh_sculpt_color_ensure(), ED_mesh_uv_add(), blender::nodes::node_geo_extrude_mesh_cc::expand_mesh(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), blender::ed::geometry::geometry_color_attribute_remove_exec(), hair_create_input_mesh(), mesh_add_edges(), mesh_add_loops(), mesh_add_polys(), mesh_add_verts(), mesh_clear_geometry(), mesh_copy_data(), SCULPT_dynamic_topology_disable_ex(), sculpt_undo_geometry_restore_data(), um_arraystore_compact_ex(), and um_arraystore_expand().

◆ BKE_mesh_validate()

bool BKE_mesh_validate ( struct Mesh me,
bool  do_verbose,
bool  cddata_check_mask 
)

◆ BKE_mesh_validate_all_customdata()

bool BKE_mesh_validate_all_customdata ( struct CustomData vdata,
uint  totvert,
struct CustomData edata,
uint  totedge,
struct CustomData ldata,
uint  totloop,
struct CustomData pdata,
uint  totpoly,
bool  check_meshmask,
bool  do_verbose,
bool  do_fixes,
bool r_change 
)

◆ BKE_mesh_validate_arrays()

bool BKE_mesh_validate_arrays ( struct Mesh me,
struct MVert mverts,
unsigned int  totvert,
struct MEdge medges,
unsigned int  totedge,
struct MFace mfaces,
unsigned int  totface,
struct MLoop mloops,
unsigned int  totloop,
struct MPoly mpolys,
unsigned int  totpoly,
struct MDeformVert dverts,
bool  do_verbose,
bool  do_fixes,
bool r_change 
)

Validate the mesh, do_fixes requires mesh to be non-null.

Returns
false if no changes needed to be made.

Vertex Normals

While zeroed normals are checked, these checks aren't comprehensive. Technically, to detect errors here a normal recalculation and comparison is necessary. However this function is mainly to prevent severe errors in geometry (invalid data that will crash Blender, or cause some features to behave incorrectly), not to detect subtle differences in the resulting normals which could be caused by importers that load normals (for example).

Definition at line 204 of file mesh_validate.cc.

References BKE_defvert_remove_group(), BKE_mesh_assert_normals_dirty_or_calculated(), BKE_mesh_calc_edges(), BKE_mesh_strip_loose_edges(), BKE_mesh_strip_loose_faces(), BKE_mesh_strip_loose_polysloops(), BKE_mesh_vertex_normals_are_dirty(), BKE_mesh_vertex_normals_ensure(), BLI_assert, BLI_BITMAP_DISABLE, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_edgehash_free(), BLI_edgehash_haskey(), BLI_edgehash_insert(), BLI_edgehash_lookup(), BLI_edgehash_new_ex(), CHECK_FACE_EDGE, CHECK_FACE_VERT_INDEX, CLAMP, MDeformWeight::def_nr, MDeformVert::dw, MLoop::e, edge_store_from_mface_quad(), edge_store_from_mface_tri(), SortFace::es, faces, float(), if(), SortFace::index, SortPoly::index, MSelect::index, int64_cmp(), int_cmp(), SortPoly::invalid, IS_REMOVED_EDGE, is_valid, is_zero_v3(), CCL_NAMESPACE_BEGIN::isfinite(), SortPoly::loopstart, ME_ESEL, ME_FSEL, ME_VSEL, MEM_callocN, MEM_freeN, MEM_mallocN, mesh, Mesh::mselect, normal, SortPoly::numverts, POINTER_AS_INT, POINTER_FROM_INT, PRINT_ERR, PRINT_MSG, blender::bke::attribute_accessor_functions::remove(), REMOVE_EDGE_TAG, REMOVE_FACE_TAG, REMOVE_LOOP_TAG, REMOVE_POLY_TAG, search_face_cmp(), search_poly_cmp(), search_polyloop_cmp(), Mesh::totedge, Mesh::totpoly, Mesh::totselect, Mesh::totvert, MSelect::type, v, MLoop::v, v1, MEdge::v1, MFace::v1, v2, MEdge::v2, MFace::v2, MFace::v3, MFace::v4, SortPoly::verts, verts, MDeformWeight::weight, and zero_v3().

Referenced by BKE_mesh_is_valid(), BKE_mesh_runtime_is_valid(), BKE_mesh_validate(), and blo_do_versions_290().

◆ BKE_mesh_validate_material_indices()

bool BKE_mesh_validate_material_indices ( struct Mesh me)

Check all material indices of polygons are valid, invalid ones are set to 0.

Returns
True if the material indices are valid.

Definition at line 1133 of file mesh_validate.cc.

References DEG_id_tag_update(), Mesh::id, ID_RECALC_GEOMETRY_ALL_MODES, is_valid, MPoly::mat_nr, max_ii(), Mesh::mpoly, Mesh::totcol, and Mesh::totpoly.

◆ BKE_mesh_vert_coords_alloc()

float(* BKE_mesh_vert_coords_alloc ( const struct Mesh mesh,
int *  r_vert_len 
) )[3]

◆ BKE_mesh_vert_coords_apply()

void BKE_mesh_vert_coords_apply ( struct Mesh mesh,
const float(*)  vert_coords[3] 
)

◆ BKE_mesh_vert_coords_apply_with_mat4()

void BKE_mesh_vert_coords_apply_with_mat4 ( struct Mesh mesh,
const float(*)  vert_coords[3],
const float  mat[4][4] 
)

◆ BKE_mesh_vert_coords_get()

void BKE_mesh_vert_coords_get ( const struct Mesh mesh,
float(*)  vert_coords[3] 
)

◆ BKE_mesh_vertex_normals_are_dirty()

bool BKE_mesh_vertex_normals_are_dirty ( const struct Mesh mesh)

Return true if the mesh vertex normals either are not stored or are dirty. This can be used to help decide whether to transfer them when copying a mesh.

Referenced by arrayModifier_doArray(), BKE_mesh_new_nomain_from_template_ex(), BKE_mesh_tag_coords_changed_uniformly(), BKE_mesh_validate_arrays(), BKE_object_data_transfer_ex(), BKE_subdiv_to_mesh(), MOD_solidify_extrude_modifyMesh(), split_faces_split_new_verts(), and undomesh_to_editmesh().

◆ BKE_mesh_vertex_normals_clear_dirty()

void BKE_mesh_vertex_normals_clear_dirty ( struct Mesh mesh)

◆ BKE_mesh_vertex_normals_ensure()

const float(* BKE_mesh_vertex_normals_ensure ( const struct Mesh mesh) )[3]

Returns the normals for each vertex, which is defined as the weighted average of the normals from a vertices surrounding faces, or the normalized position of vertices connected to no faces.

Warning
May still return null if the mesh is empty.

Referenced by arrayModifier_doArray(), BKE_bvhtree_from_mesh_get(), BKE_mesh_calc_loop_tangents(), BKE_mesh_calc_normals_split_ex(), BKE_mesh_foreach_mapped_subdiv_face_center(), BKE_mesh_foreach_mapped_vert(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_mesh_validate_arrays(), BKE_pbvh_build_mesh(), BKE_shrinkwrap_remesh_target_project(), BM_mesh_bm_from_me(), cdDM_from_mesh_ex(), contarget_get_mesh_mat(), GeometryExporter::create_normals(), data_transfer_dtdata_type_postprocess(), data_transfer_dtdata_type_preprocess(), displaceModifier_do(), distribute_from_volume_exec(), do_multires_bake(), dynamicPaint_applySurfaceDisplace(), dynamicPaint_generateBakeData(), dynamicPaint_Modifier_apply(), dynamicPaint_paintMesh(), get_effector_data(), gpencil_generate_edgeloops(), make_duplis_verts(), mesh_calc_hq_normal(), mesh_calc_tri_tessface(), blender::bke::mesh_normals_varray(), mesh_render_data_update_normals(), MOD_deform_mesh_eval_get(), MOD_solidify_extrude_modifyMesh(), modifyMesh(), normalEditModifier_do(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), pointdensity_cache_vertex_normal(), proj_paint_state_mesh_eval_init(), psys_particle_on_dm(), recalc_emitter_field(), shrinkwrap_build_boundary_data(), shrinkwrapModifier_deform(), split_faces_prepare_new_verts(), and waveModifier_do().

◆ BKE_mesh_vertex_normals_for_write()

float(* BKE_mesh_vertex_normals_for_write ( struct Mesh mesh) )[3]

Retrieve write access to the vertex normal layer, ensuring that it exists and that it is not shared. The provided vertex normals should be the same as if they were calculated automatically.

Note
In order to clear the dirty flag, this function should be followed by a call to BKE_mesh_vertex_normals_clear_dirty. This is separate so that normals are still tagged dirty while they are being assigned.
Warning
The memory returned by this function is not initialized if it was not previously allocated.

Definition at line 101 of file mesh_normals.cc.

References BLI_assert, float(), MEM_allocN_len, MEM_malloc_arrayN, mesh, Mesh::runtime, Mesh::totvert, and Mesh_Runtime::vert_normals.

Referenced by arrayModifier_doArray(), BKE_mesh_vertex_normals_ensure(), BKE_pbvh_build_mesh(), blender::nodes::node_geo_mesh_primitive_uv_sphere_cc::create_uv_sphere_mesh(), mesh_merge_transform(), blender::io::alembic::read_mverts(), split_faces_prepare_new_verts(), and split_faces_split_new_verts().

◆ BKE_mesh_wrapper_deferred_finalize_mdata()

void BKE_mesh_wrapper_deferred_finalize_mdata ( struct Mesh me_eval,
const struct CustomData_MeshMasks cd_mask_finalize 
)

◆ BKE_pointcloud_from_mesh()

void BKE_pointcloud_from_mesh ( struct Mesh me,
struct PointCloud pointcloud 
)

◆ BKE_pointcloud_to_mesh()

void BKE_pointcloud_to_mesh ( struct Main bmain,
struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob 
)

Referenced by object_convert_exec().

◆ poly_find_loop_from_vert()

int poly_find_loop_from_vert ( const struct MPoly poly,
const struct MLoop loopstart,
uint  vert 
)

Find the index of the loop in 'poly' which references vertex, returns -1 if not found

Referenced by MeshFairingContext::adjacents_coords_from_loop(), and adjacet_vertices_index_from_adjacent_edge().

◆ poly_get_adj_loops_from_vert()

int poly_get_adj_loops_from_vert ( const struct MPoly poly,
const struct MLoop mloop,
unsigned int  vert,
unsigned int  r_adj[2] 
)

Fill r_adj with the loop indices in poly adjacent to the vertex. Returns the index of the loop matching vertex, or -1 if the vertex is not in poly

Referenced by sculpt_vertex_neighbors_get_faces().

Variable Documentation

◆ BKE_mesh_batch_cache_dirty_tag_cb

void(* BKE_mesh_batch_cache_dirty_tag_cb) (struct Mesh *me, eMeshBatchDirtyMode mode) ( struct Mesh me,
eMeshBatchDirtyMode  mode 
)
extern

Definition at line 291 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_dirty_tag(), and DRW_engines_register().

◆ BKE_mesh_batch_cache_free_cb

void(* BKE_mesh_batch_cache_free_cb) (struct Mesh *me) ( struct Mesh me)
extern

Definition at line 292 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_free(), and DRW_engines_register().