Blender V5.0
BKE_mesh.h File Reference
#include <cstdint>
#include "BLI_array.hh"
#include "BLI_string_ref.hh"
#include "DNA_mesh_types.h"

Go to the source code of this file.

Classes

struct  MLoopNorSpace
struct  MLoopNorSpaceArray

Enumerations

enum  eMeshBatchDirtyMode : int8_t {
  BKE_MESH_BATCH_DIRTY_ALL = 0 , BKE_MESH_BATCH_DIRTY_SELECT , BKE_MESH_BATCH_DIRTY_SELECT_PAINT , BKE_MESH_BATCH_DIRTY_SHADING ,
  BKE_MESH_BATCH_DIRTY_UVEDIT_ALL , BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT
}
enum  { MLNOR_SPACE_IS_SINGLE = 1 << 0 }
enum  { MLNOR_SPACEARR_LOOP_INDEX = 0 , MLNOR_SPACEARR_BMLOOP_PTR = 1 }

Functions

BMeshBKE_mesh_to_bmesh_ex (const Mesh *mesh, const BMeshCreateParams *create_params, const BMeshFromMeshParams *convert_params)
BMeshBKE_mesh_to_bmesh (Mesh *mesh, int active_shapekey, bool add_key_index, const BMeshCreateParams *params)
MeshBKE_mesh_from_bmesh_nomain (BMesh *bm, const BMeshToMeshParams *params, const Mesh *me_settings)
MeshBKE_mesh_from_bmesh_for_eval_nomain (BMesh *bm, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings)
void BKE_mesh_ensure_default_orig_index_customdata (Mesh *mesh)
void BKE_mesh_ensure_default_orig_index_customdata_no_check (Mesh *mesh)
void BKE_mesh_clear_geometry (Mesh *mesh)
void BKE_mesh_clear_geometry_and_metadata (Mesh *mesh)
MeshBKE_mesh_add (Main *bmain, const char *name)
void BKE_mesh_copy_parameters_for_eval (Mesh *me_dst, const Mesh *me_src)
void BKE_mesh_copy_parameters (Mesh *me_dst, const Mesh *me_src)
void BKE_mesh_ensure_skin_customdata (Mesh *mesh)
void BKE_mesh_face_offsets_ensure_alloc (Mesh *mesh)
MeshBKE_mesh_new_nomain (int verts_num, int edges_num, int faces_num, int corners_num)
MeshBKE_mesh_new_nomain_from_template (const Mesh *me_src, int verts_num, int edges_num, int faces_num, int corners_num)
MeshBKE_mesh_new_nomain_from_template_ex (const Mesh *me_src, int verts_num, int edges_num, int tessface_num, int faces_num, int corners_num, CustomData_MeshMasks mask)
MeshBKE_mesh_copy_for_eval (const Mesh &source)
MeshBKE_mesh_new_nomain_from_curve (const Object *ob)
MeshBKE_mesh_new_nomain_from_curve_displist (const Object *ob, const ListBase *dispbase)
bool BKE_mesh_attribute_required (blender::StringRef name)
blender::Array< blender::float3BKE_mesh_orco_verts_get (const Object *ob)
void BKE_mesh_orco_verts_transform (Mesh *mesh, blender::MutableSpan< blender::float3 > orco, bool invert)
void BKE_mesh_orco_verts_transform (Mesh *mesh, float(*orco)[3], int totvert, bool invert)
void BKE_mesh_orco_ensure (Object *ob, Mesh *mesh)
MeshBKE_mesh_from_object (Object *ob)
void BKE_mesh_assign_object (Main *bmain, Object *ob, Mesh *mesh)
void BKE_mesh_to_curve_nurblist (const Mesh *mesh, ListBase *nurblist, int edge_users_test)
void BKE_mesh_to_curve (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_mesh_to_pointcloud (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_pointcloud_to_mesh (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_mesh_material_index_remove (Mesh *mesh, short index)
bool BKE_mesh_material_index_used (Mesh *mesh, short index)
void BKE_mesh_material_index_clear (Mesh *mesh)
void BKE_mesh_material_remap (Mesh *mesh, const unsigned int *remap, unsigned int remap_len)
void BKE_mesh_texspace_calc (Mesh *mesh)
void BKE_mesh_texspace_ensure (Mesh *mesh)
void BKE_mesh_texspace_get (Mesh *mesh, float r_texspace_location[3], float r_texspace_size[3])
void BKE_mesh_texspace_get_reference (Mesh *mesh, char **r_texspace_flag, float **r_texspace_location, float **r_texspace_size)
MeshBKE_mesh_new_from_object (Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers, bool preserve_origindex, bool ensure_subdivision)
MeshBKE_mesh_new_from_object_to_bmain (Main *bmain, Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers)
void BKE_mesh_nomain_to_mesh (Mesh *mesh_src, Mesh *mesh_dst, Object *ob, bool process_shape_keys=true)
void BKE_mesh_nomain_to_meshkey (Mesh *mesh_src, Mesh *mesh_dst, KeyBlock *kb)
void BKE_mesh_tessface_clear (Mesh *mesh)
void BKE_mesh_mselect_clear (Mesh *mesh)
void BKE_mesh_mselect_validate (Mesh *mesh)
int BKE_mesh_mselect_find (const Mesh *mesh, int index, int type)
int BKE_mesh_mselect_active_get (const Mesh *mesh, int type)
void BKE_mesh_mselect_active_set (Mesh *mesh, int index, int type)
void BKE_mesh_count_selected_items (const Mesh *mesh, int r_count[3])
bool BKE_mesh_vert_normals_are_dirty (const Mesh *mesh)
bool BKE_mesh_face_normals_are_dirty (const Mesh *mesh)
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], const float vec_ref[3], const float vec_other[3], blender::Span< blender::float3 > edge_vectors)
void BKE_lnor_space_add_loop (MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, int corner, void *bm_loop, bool is_single)
void BKE_lnor_space_custom_data_to_normal (const MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3])
void BKE_lnor_space_custom_normal_to_data (const MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2])
bool BKE_mesh_has_custom_loop_normals (Mesh *mesh)
float BKE_mesh_calc_area (const Mesh *mesh)
bool BKE_mesh_center_median (const Mesh *mesh, float r_cent[3])
bool BKE_mesh_center_median_from_faces (const Mesh *mesh, float r_cent[3])
bool BKE_mesh_center_of_surface (const Mesh *mesh, float r_cent[3])
bool BKE_mesh_center_of_volume (const Mesh *mesh, float r_cent[3])
void BKE_mesh_calc_volume (const float(*vert_positions)[3], int mverts_num, const blender::int3 *corner_tris, int corner_tris_num, const int *corner_verts, float *r_volume, float r_center[3])
void BKE_mesh_mdisp_flip (MDisps *md, bool use_loop_mdisp_flip)
void BKE_mesh_merge_customdata_for_apply_modifier (Mesh *mesh)
void BKE_mesh_calc_relative_deform (const int *face_offsets, int faces_num, const int *corner_verts, 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 (Mesh *mesh, bool do_verbose, bool cddata_check_mask)
bool BKE_mesh_is_valid (Mesh *mesh)
bool BKE_mesh_validate_material_indices (Mesh *mesh)
bool BKE_mesh_validate_arrays (Mesh *mesh, float(*vert_positions)[3], unsigned int verts_num, blender::int2 *edges, unsigned int edges_num, MFace *legacy_faces, unsigned int legacy_faces_num, const int *corner_verts, int *corner_edges, unsigned int corners_num, const int *face_offsets, unsigned int faces_num, MDeformVert *dverts, bool do_verbose, bool do_fixes, bool *r_change)
bool BKE_mesh_validate_all_customdata (CustomData *vert_data, uint verts_num, CustomData *edge_data, uint edges_num, CustomData *corner_data, uint corners_num, CustomData *face_data, uint faces_num, bool check_meshmask, bool do_verbose, bool do_fixes, bool *r_change)
void BKE_mesh_strip_loose_faces (Mesh *mesh)
void BKE_mesh_eval_geometry (Depsgraph *depsgraph, Mesh *mesh)
void BKE_mesh_batch_cache_dirty_tag (Mesh *mesh, eMeshBatchDirtyMode mode)
void BKE_mesh_batch_cache_free (void *batch_cache)
char * BKE_mesh_debug_info (const Mesh *mesh) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BKE_mesh_debug_print (const Mesh *mesh) ATTR_NONNULL(1)

Variables

void(* BKE_mesh_batch_cache_dirty_tag_cb )(Mesh *mesh, eMeshBatchDirtyMode mode)
void(* BKE_mesh_batch_cache_free_cb )(void *batch_cache)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

MLoopNorSpaceArray.data_type

Enumerator
MLNOR_SPACEARR_LOOP_INDEX 
MLNOR_SPACEARR_BMLOOP_PTR 

Definition at line 298 of file BKE_mesh.h.

◆ anonymous enum

anonymous enum

MLoopNorSpace.flags

Enumerator
MLNOR_SPACE_IS_SINGLE 

Definition at line 277 of file BKE_mesh.h.

◆ eMeshBatchDirtyMode

enum eMeshBatchDirtyMode : int8_t
Enumerator
BKE_MESH_BATCH_DIRTY_ALL 
BKE_MESH_BATCH_DIRTY_SELECT 
BKE_MESH_BATCH_DIRTY_SELECT_PAINT 
BKE_MESH_BATCH_DIRTY_SHADING 
BKE_MESH_BATCH_DIRTY_UVEDIT_ALL 
BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT 

Definition at line 37 of file BKE_mesh.h.

Function Documentation

◆ BKE_lnor_space_add_loop()

void BKE_lnor_space_add_loop ( MLoopNorSpaceArray * lnors_spacearr,
MLoopNorSpace * lnor_space,
int corner,
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 672 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().

◆ BKE_lnor_space_create()

MLoopNorSpace * BKE_lnor_space_create ( MLoopNorSpaceArray * lnors_spacearr)

◆ BKE_lnor_space_custom_data_to_normal()

◆ BKE_lnor_space_custom_normal_to_data()

◆ BKE_lnor_space_define()

void BKE_lnor_space_define ( MLoopNorSpace * lnor_space,
const float lnor[3],
const float vec_ref[3],
const float vec_other[3],
blender::Span< blender::float3 > edge_vectors )

◆ BKE_lnor_spacearr_clear()

◆ BKE_lnor_spacearr_free()

◆ BKE_lnor_spacearr_init()

◆ 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 544 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 551 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()

◆ BKE_mesh_assign_object()

◆ BKE_mesh_attribute_required()

bool BKE_mesh_attribute_required ( blender::StringRef name)

Definition at line 530 of file blenkernel/intern/mesh.cc.

References ELEM, and name.

Referenced by BKE_attribute_required().

◆ BKE_mesh_batch_cache_dirty_tag()

◆ BKE_mesh_batch_cache_free()

void BKE_mesh_batch_cache_free ( void * batch_cache)

Definition at line 463 of file mesh_runtime.cc.

References BKE_mesh_batch_cache_free_cb.

Referenced by blender::bke::free_batch_cache().

◆ BKE_mesh_calc_area()

float BKE_mesh_calc_area ( const Mesh * mesh)

◆ BKE_mesh_calc_relative_deform()

void BKE_mesh_calc_relative_deform ( const int * face_offsets,
int faces_num,
const int * corner_verts,
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.

Definition at line 713 of file mesh_evaluate.cc.

References add_v3_v3(), copy_v3_v3(), faces, i, MEM_calloc_arrayN(), MEM_freeN(), mul_v3_fl(), blender::IndexRange::size(), blender::IndexRange::start(), and transform_point_by_tri_v3().

Referenced by meshcache_do().

◆ BKE_mesh_calc_volume()

void BKE_mesh_calc_volume ( const float(*) vert_positions[3],
int mverts_num,
const blender::int3 * corner_tris,
int corner_tris_num,
const int * corner_verts,
float * r_volume,
float r_center[3] )

Calculate the volume and center.

Parameters
r_volumeVolume (unsigned).
r_centerCenter of mass.

Definition at line 390 of file mesh_evaluate.cc.

References fabsf, i, madd_v3_v3fl(), mesh_calc_center_centroid_ex(), mul_v3_fl(), v2, volume_tetrahedron_signed_v3(), and zero_v3().

◆ BKE_mesh_center_median()

bool BKE_mesh_center_median ( const Mesh * mesh,
float r_cent[3] )

◆ BKE_mesh_center_median_from_faces()

bool BKE_mesh_center_median_from_faces ( const Mesh * mesh,
float r_cent[3] )

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

Definition at line 254 of file mesh_evaluate.cc.

References add_v3_v3(), faces, Mesh::faces_num, i, mul_v3_fl(), blender::Span< T >::slice(), and zero_v3().

Referenced by BKE_mesh_center_of_volume().

◆ BKE_mesh_center_of_surface()

◆ BKE_mesh_center_of_volume()

◆ BKE_mesh_clear_geometry()

void BKE_mesh_clear_geometry ( Mesh * mesh)

Remove all geometry and derived data like caches from the mesh.

Definition at line 1053 of file blenkernel/intern/mesh.cc.

References BKE_mesh_runtime_clear_cache(), and mesh_clear_geometry().

Referenced by BM_mesh_bm_to_me(), and blender::ed::sculpt_paint::undo::restore_geometry_data().

◆ BKE_mesh_clear_geometry_and_metadata()

void BKE_mesh_clear_geometry_and_metadata ( Mesh * mesh)

Same as BKE_mesh_clear_geometry, but also clears attribute meta-data like active attribute names and vertex group names. Used when the geometry is entirely replaced.

Definition at line 1059 of file blenkernel/intern/mesh.cc.

References BKE_mesh_runtime_clear_cache(), clear_attribute_names(), and mesh_clear_geometry().

Referenced by BKE_mesh_nomain_to_mesh().

◆ BKE_mesh_copy_for_eval()

◆ BKE_mesh_copy_parameters()

◆ BKE_mesh_copy_parameters_for_eval()

◆ BKE_mesh_count_selected_items()

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

Definition at line 2046 of file blenkernel/intern/mesh.cc.

References bm.

◆ BKE_mesh_debug_info()

◆ BKE_mesh_debug_print()

void BKE_mesh_debug_print ( const Mesh * mesh)

Definition at line 73 of file mesh_debug.cc.

References BKE_mesh_debug_info(), MEM_freeN(), and str.

◆ BKE_mesh_ensure_default_orig_index_customdata()

void BKE_mesh_ensure_default_orig_index_customdata ( 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 1437 of file blenkernel/intern/mesh.cc.

References BKE_mesh_ensure_default_orig_index_customdata_no_check(), BLI_assert, and ME_WRAPPER_TYPE_MDATA.

Referenced by blender::bke::create_orco_mesh(), and subdivide_edit_mesh().

◆ BKE_mesh_ensure_default_orig_index_customdata_no_check()

void BKE_mesh_ensure_default_orig_index_customdata_no_check ( 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 1443 of file blenkernel/intern/mesh.cc.

References ensure_orig_index_layer().

Referenced by BKE_mesh_ensure_default_orig_index_customdata(), and BKE_mesh_wrapper_ensure_mdata().

◆ BKE_mesh_ensure_skin_customdata()

◆ BKE_mesh_eval_geometry()

◆ BKE_mesh_face_normals_are_dirty()

bool BKE_mesh_face_normals_are_dirty ( const Mesh * mesh)

Return true if the mesh face normals either are not stored or are dirty.

Definition at line 101 of file mesh_normals.cc.

References Mesh::runtime.

Referenced by C_BVHTree_FromObject(), and mesh_calc_tri_tessface().

◆ BKE_mesh_face_offsets_ensure_alloc()

◆ BKE_mesh_from_bmesh_for_eval_nomain()

◆ BKE_mesh_from_bmesh_nomain()

◆ BKE_mesh_from_object()

Mesh * BKE_mesh_from_object ( Object * ob)

Definition at line 1577 of file blenkernel/intern/mesh.cc.

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

Referenced by blender::bke::build_pbvh_from_ccg(), do_paintface_box_select(), ED_object_texture_paint_mode_enter_ex(), ED_object_texture_paint_mode_exit_ex(), ED_paint_proj_mesh_data_check(), ED_wpaint_ensure_data(), blender::ed::sculpt_paint::boundary::ensure_boundary_info(), blender::ed::sculpt_paint::fill_active_color(), blender::ed::sculpt_paint::vwpaint::mode_enter_generic(), blender::ed::sculpt_paint::vwpaint::mode_exit_generic(), multires_force_external_reload(), multiresModifier_del_levels(), blender::ed::sculpt_paint::object_sculpt_mode_enter(), blender::ed::sculpt_paint::object_sculpt_mode_exit(), paint_proj_new_stroke(), paint_select_less_exec(), paint_select_more_exec(), paintface_deselect_all_visible(), paintface_flush_flags(), paintface_hide(), paintface_minmax(), paintface_mouse_select(), paintface_reveal(), paintface_select_linked(), paintface_select_loop(), paintvert_deselect_all_visible(), paintvert_flush_flags(), paintvert_hide(), paintvert_reveal(), paintvert_select_less_exec(), paintvert_select_linked(), paintvert_select_linked_vertices(), paintvert_select_more_exec(), paintvert_select_ungrouped(), blender::ed::object::quadriflow_remesh_exec(), vertex_color_brightness_contrast_exec(), vertex_color_hsv_exec(), vertex_color_invert_exec(), vertex_color_levels_exec(), vertex_color_set_exec(), vertex_color_smooth(), vertex_paint_from_weight(), vertex_weight_paint_mode_poll(), blender::ed::object::vgroup_selected_get(), vpaint_mode_toggle_exec(), vpaint_stroke_test_start(), weight_sample_group_invoke(), weight_sample_invoke(), wpaint_mode_toggle_exec(), and wpaint_stroke_test_start().

◆ BKE_mesh_has_custom_loop_normals()

bool BKE_mesh_has_custom_loop_normals ( Mesh * mesh)

High-level custom normals functions.

Definition at line 568 of file blenkernel/intern/mesh.cc.

References CD_PROP_INT16_2D, and CustomData_has_layer_named().

Referenced by mesh_customdata_custom_splitnormals_add_exec().

◆ BKE_mesh_is_valid()

bool BKE_mesh_is_valid ( Mesh * mesh)

◆ BKE_mesh_material_index_clear()

void BKE_mesh_material_index_clear ( Mesh * mesh)

◆ BKE_mesh_material_index_remove()

◆ BKE_mesh_material_index_used()

◆ BKE_mesh_material_remap()

◆ BKE_mesh_mdisp_flip()

void BKE_mesh_mdisp_flip ( MDisps * md,
bool use_loop_mdisp_flip )

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

Definition at line 462 of file mesh_evaluate.cc.

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

Referenced by bmesh_kernel_loop_reverse(), and blender::bke::mesh_flip_faces().

◆ BKE_mesh_merge_customdata_for_apply_modifier()

◆ BKE_mesh_mselect_active_get()

int BKE_mesh_mselect_active_get ( const Mesh * mesh,
int type )
Returns
The index of the active element.

Definition at line 2013 of file blenkernel/intern/mesh.cc.

References BLI_assert, ELEM, ME_ESEL, ME_FSEL, and ME_VSEL.

Referenced by ED_mesh_active_dvert_get_ob().

◆ BKE_mesh_mselect_active_set()

void BKE_mesh_mselect_active_set ( Mesh * mesh,
int index,
int type )

◆ BKE_mesh_mselect_clear()

void BKE_mesh_mselect_clear ( Mesh * mesh)

◆ BKE_mesh_mselect_find()

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

Definition at line 2000 of file blenkernel/intern/mesh.cc.

References BLI_assert, ELEM, i, ME_ESEL, ME_FSEL, and ME_VSEL.

Referenced by BKE_mesh_mselect_active_set().

◆ BKE_mesh_mselect_validate()

◆ BKE_mesh_new_from_object()

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

Create new mesh from the given object at its current state. The caller owns the result mesh.

If preserve_all_data_layers is true 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 true, and is ignored otherwise.

Definition at line 874 of file mesh_convert.cc.

References BLI_assert, depsgraph, 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, Mesh::runtime, and ID::us.

Referenced by blender::ed::object::bake(), blender::ed::object::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(), blender::io::usd::USDTextWriter::get_export_mesh(), lineart_object_load_single_instance(), object_copy_mesh_data(), and blender::io::obj::OBJMesh::OBJMesh().

◆ BKE_mesh_new_from_object_to_bmain()

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

◆ BKE_mesh_new_nomain()

Mesh * BKE_mesh_new_nomain ( int verts_num,
int edges_num,
int faces_num,
int corners_num )

Definition at line 1218 of file blenkernel/intern/mesh.cc.

References BKE_idtype_idcode_to_name(), BKE_libblock_alloc(), BKE_libblock_init_empty(), BKE_mesh_face_offsets_ensure_alloc(), ID_ME, LIB_ID_CREATE_LOCALIZE, and blender::bke::mesh_ensure_required_data_layers().

Referenced by BKE_mball_polygonize(), BKE_modifier_deform_verts(), blender::ed::object::convert_curves_to_mesh(), blender::ed::object::convert_grease_pencil_to_mesh(), blender::ed::object::convert_mesh_to_mesh(), blender::io::ply::convert_ply_to_mesh(), blender::ed::object::convert_psys_to_mesh(), blender::nodes::node_geo_mesh_primitive_circle_cc::create_circle_mesh(), blender::geometry::create_cuboid_mesh(), blender::geometry::create_cylinder_or_cone_mesh(), create_empty_mesh(), blender::geometry::create_grid_mesh(), blender::geometry::create_line_mesh(), blender::io::obj::MeshFromGeometry::create_mesh(), blender::bke::tests::ArmatureDeformTestBase::create_test_mesh(), blender::geometry::create_uv_sphere_mesh(), blender::geometry::create_vertex_mesh(), curve_calc_modifiers_post(), blender::bke::curve_to_mesh_sweep(), 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::geometry::extract_mesh_edges(), blender::geometry::extract_mesh_faces(), blender::geometry::extract_mesh_vertices(), blender::ed::sculpt_paint::trim::generate_geometry(), blender::nodes::node_geo_points_to_vertices_cc::geometry_set_points_to_vertices(), get_quick_mesh(), hair_create_input_mesh(), blender::io::fbx::import_meshes(), blender::ed::mesh::join_objects_exec(), blender::bke::mesh_new_no_attributes(), mesh_nurbs_displist_to_mesh(), blender::bke::modifier_modify_mesh_and_geometry_set(), blender::modify_mesh(), blender::io::stl::read_stl_binary(), blender::ed::geometry::store_result_geometry(), blender::io::stl::STLMeshHelper::to_mesh(), and blender::bke::bake::try_load_mesh().

◆ BKE_mesh_new_nomain_from_curve()

Mesh * BKE_mesh_new_nomain_from_curve ( const Object * ob)

These functions construct a new Mesh, contrary to BKE_mesh_to_curve_nurblist which modifies ob itself.

Definition at line 338 of file mesh_convert.cc.

References BKE_mesh_new_nomain_from_curve_displist(), and Object::runtime.

Referenced by blender::io::alembic::ABCCurveMeshWriter::get_export_mesh(), and knifeproject_poly_from_object().

◆ BKE_mesh_new_nomain_from_curve_displist()

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

◆ BKE_mesh_new_nomain_from_template()

◆ BKE_mesh_new_nomain_from_template_ex()

◆ BKE_mesh_nomain_to_mesh()

void BKE_mesh_nomain_to_mesh ( Mesh * mesh_src,
Mesh * mesh_dst,
Object * ob,
bool process_shape_keys = true )

Move data from a mesh outside of the main data-base into a mesh in the data-base. Takes ownership of the source mesh.

Parameters
process_shape_keysWhether to move CD_SHAPEKEY layers to the destination mesh. If there are no such layers and the number of vertices changed, the shape key data will be lost. If this parameter is false, the caller is expected to handle shape keys itself.

Definition at line 1085 of file mesh_convert.cc.

References Mesh::active_color_attribute, BKE_id_free(), BKE_mesh_clear_geometry_and_metadata(), BKE_mesh_copy_parameters(), BLI_assert, CD_MASK_MESH, CD_SHAPEKEY, CLOG_WARN, copy_loose_edge_hint(), copy_loose_vert_hint(), copy_overlapping_hint(), Mesh::corner_data, Mesh::corners_num, CustomData_has_layer(), CustomData_init_from(), Object::data, Mesh::default_color_attribute, Mesh::edge_data, Mesh::edges_num, Mesh::face_data, Mesh::face_offset_indices, Mesh::faces_num, find_object_active_key_uid(), Key::id, Mesh::id, ID_TAG_NO_MAIN, id_us_min(), Mesh::key, LOG, mask(), move_shapekey_layers_to_keyblocks(), ID::name, Mesh::runtime, ID::tag, Mesh::vert_data, Mesh::vertex_group_names, and Mesh::verts_num.

Referenced by blender::ed::sculpt_paint::trim::apply_join_operation(), blender::ed::sculpt_paint::trim::apply_trim(), BKE_mesh_new_from_object_to_bmain(), blender::ed::object::convert_curves_to_mesh(), blender::ed::object::convert_grease_pencil_to_mesh(), blender::ed::object::convert_mesh_to_mesh(), blender::ed::object::convert_psys_to_mesh(), blender::io::obj::MeshFromGeometry::create_mesh_object(), blender::bke::tests::ArmatureDeformTestBase::create_test_mesh_object(), geometry_extract_apply(), blender::io::ply::importer_main(), blender::io::stl::importer_main(), blender::ed::mesh::join_objects_exec(), blender::ed::object::modifier_apply_obdata(), multiresModifier_rebuild_subdiv(), paint_mask_slice_exec(), blender::ed::object::quadriflow_start_job(), blender::io::usd::USDMeshReader::read_object_data(), blender::io::usd::USDShapeReader::read_object_data(), blender::io::alembic::AbcMeshReader::readObjectData(), blender::io::alembic::AbcSubDReader::readObjectData(), blender::ed::geometry::store_result_geometry(), blender::ed::sculpt_paint::store_sculpt_entire_mesh(), and blender::ed::object::voxel_remesh_exec().

◆ BKE_mesh_nomain_to_meshkey()

◆ BKE_mesh_orco_ensure()

void BKE_mesh_orco_ensure ( Object * ob,
Mesh * mesh )

◆ BKE_mesh_orco_verts_get()

blender::Array< blender::float3 > BKE_mesh_orco_verts_get ( const Object * ob)

◆ BKE_mesh_orco_verts_transform() [1/2]

◆ BKE_mesh_orco_verts_transform() [2/2]

void BKE_mesh_orco_verts_transform ( Mesh * mesh,
float(*) orco[3],
int totvert,
bool invert )

Definition at line 1558 of file blenkernel/intern/mesh.cc.

References BKE_mesh_orco_verts_transform(), and invert().

◆ BKE_mesh_strip_loose_faces()

◆ BKE_mesh_tessface_clear()

◆ BKE_mesh_texspace_calc()

◆ BKE_mesh_texspace_ensure()

◆ BKE_mesh_texspace_get()

◆ BKE_mesh_texspace_get_reference()

void BKE_mesh_texspace_get_reference ( Mesh * mesh,
char ** r_texspace_flag,
float ** r_texspace_location,
float ** r_texspace_size )

Definition at line 1504 of file blenkernel/intern/mesh.cc.

References BKE_mesh_texspace_ensure().

Referenced by BKE_object_obdata_texspace_get().

◆ BKE_mesh_to_bmesh()

◆ BKE_mesh_to_bmesh_ex()

◆ BKE_mesh_to_curve()

◆ BKE_mesh_to_curve_nurblist()

◆ BKE_mesh_to_pointcloud()

◆ BKE_mesh_validate()

◆ BKE_mesh_validate_all_customdata()

bool BKE_mesh_validate_all_customdata ( CustomData * vert_data,
uint verts_num,
CustomData * edge_data,
uint edges_num,
CustomData * corner_data,
uint corners_num,
CustomData * face_data,
uint faces_num,
bool check_meshmask,
bool do_verbose,
bool do_fixes,
bool * r_change )

◆ BKE_mesh_validate_arrays()

bool BKE_mesh_validate_arrays ( Mesh * mesh,
float(*) vert_positions[3],
unsigned int verts_num,
blender::int2 * edges,
unsigned int edges_num,
MFace * legacy_faces,
unsigned int legacy_faces_num,
const int * corner_verts,
int * corner_edges,
unsigned int corners_num,
const int * face_offsets,
unsigned int faces_num,
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.

Definition at line 163 of file mesh_validate.cc.

References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), b, Array< T, InlineBufferCapacity, Allocator >::begin(), BKE_defvert_remove_group(), BKE_mesh_strip_loose_faces(), BLI_assert, CHECK_FACE_EDGE, CHECK_FACE_VERT_INDEX, CLAMP, BitVector< InlineBufferCapacity, Allocator >::clear_and_shrink(), Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), SortFace::corner_start, Array< T, InlineBufferCapacity, Allocator >::data(), MDeformWeight::def_nr, MDeformVert::dw, edge_store_from_mface_quad(), edge_store_from_mface_tri(), Array< T, InlineBufferCapacity, Allocator >::end(), SortFaceLegacy::es, faces, blender::bke::AttributeWriter< T >::finish(), i, MSelect::index, SortFace::index, SortFaceLegacy::index, SortFace::invalid, IS_REMOVED_EDGE, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), ME_ESEL, ME_FSEL, ME_VSEL, MEM_freeN(), blender::bke::mesh_calc_edges(), mesh_strip_edges(), SortFace::numverts, blender::parallel_sort(), PRINT_ERR, PRINT_MSG, REMOVE_CORNER_TAG, REMOVE_EDGE_TAG, REMOVE_FACE_TAG, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), search_face_cmp(), search_face_corner_cmp(), search_legacy_face_cmp(), Array< T, InlineBufferCapacity, Allocator >::size(), strip_loose_faces_corners(), MSelect::type, v, MFace::v1, MFace::v2, v2, MFace::v3, MFace::v4, blender::bke::AttributeWriter< T >::varray, SortFace::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 ( Mesh * mesh)

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

Returns
True if the material indices are valid.

Definition at line 1131 of file mesh_validate.cc.

References DEG_id_tag_update(), blender::bke::AttributeWriter< T >::finish(), i, ID_RECALC_GEOMETRY_ALL_MODES, max_ii(), and blender::bke::AttributeWriter< T >::varray.

◆ BKE_mesh_vert_normals_are_dirty()

bool BKE_mesh_vert_normals_are_dirty ( const Mesh * mesh)

Return true if the mesh vertex normals either are not stored or are dirty.

Definition at line 96 of file mesh_normals.cc.

References Mesh::runtime.

Referenced by arrayModifier_doArray().

◆ BKE_pointcloud_to_mesh()

Variable Documentation

◆ BKE_mesh_batch_cache_dirty_tag_cb

void(* BKE_mesh_batch_cache_dirty_tag_cb) (Mesh *mesh, eMeshBatchDirtyMode mode) ( Mesh * mesh,
eMeshBatchDirtyMode mode )
extern

Definition at line 447 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_dirty_tag(), and DRW_module_init().

◆ BKE_mesh_batch_cache_free_cb

void(* BKE_mesh_batch_cache_free_cb) (void *batch_cache) ( void * batch_cache)
extern

Definition at line 448 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_free(), and DRW_module_init().