|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "DNA_listBase.h"#include "DNA_scene_types.h"#include "BLI_bitmap.h"#include "BLI_linklist_stack.h"#include "BLI_listbase.h"#include "BLI_math.h"#include "BLI_stack.h"#include "BLI_task.h"#include "BLI_utildefines.h"#include "BKE_editmesh.h"#include "BKE_global.h"#include "BKE_mesh.h"#include "BKE_multires.h"#include "atomic_ops.h"#include "intern/bmesh_private.h"Go to the source code of this file.
Classes | |
| struct | BMEdgesCalcVectorsData |
| struct | BMVertsCalcNormalsData |
Macros | |
| #define | BM_LNORSPACE_UPDATE _FLAG_MF |
| #define | FLT_EQ_NONAN(_fa, _fb) (*((const uint32_t *)&_fa) == *((const uint32_t *)&_fb)) |
| #define | LNOR_SPACE_TRIGO_THRESHOLD (1.0f - 1e-4f) |
| #define | CLEAR_SPACEARRAY_THRESHOLD(x) ((x) / 2) |
| #define | MAP_VERT(ele) vtable_dst[BM_elem_index_get(ele)] |
| #define | MAP_EDGE(ele) etable_dst[BM_elem_index_get(ele)] |
| #define | MAP_LOOP(ele) ltable_dst[BM_elem_index_get(ele)] |
| #define | MAP_FACE(ele) ftable_dst[BM_elem_index_get(ele)] |
| #define | REMAP_VERT(ele) |
| #define | REMAP_EDGE(ele) |
| #define | REMAP_LOOP(ele) |
| #define | REMAP_FACE(ele) |
Typedefs | |
| typedef struct BMEdgesCalcVectorsData | BMEdgesCalcVectorsData |
| typedef struct BMVertsCalcNormalsData | BMVertsCalcNormalsData |
Functions | |
| static void | bm_mempool_init_ex (const BMAllocTemplate *allocsize, const bool use_toolflags, BLI_mempool **r_vpool, BLI_mempool **r_epool, BLI_mempool **r_lpool, BLI_mempool **r_fpool) |
| static void | bm_mempool_init (BMesh *bm, const BMAllocTemplate *allocsize, const bool use_toolflags) |
| void | BM_mesh_elem_toolflags_ensure (BMesh *bm) |
| void | BM_mesh_elem_toolflags_clear (BMesh *bm) |
| BMesh * | BM_mesh_create (const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params) |
| BMesh Make Mesh. More... | |
| void | BM_mesh_data_free (BMesh *bm) |
| BMesh Free Mesh Data. More... | |
| void | BM_mesh_clear (BMesh *bm) |
| BMesh Clear Mesh. More... | |
| void | BM_mesh_free (BMesh *bm) |
| BMesh Free Mesh. More... | |
| static void | mesh_edges_calc_vectors_cb (void *userdata, MempoolIterData *mp_e) |
| static void | bm_mesh_edges_calc_vectors (BMesh *bm, float(*edgevec)[3], const float(*vcos)[3]) |
| static void | mesh_verts_calc_normals_accum_cb (void *userdata, MempoolIterData *mp_f) |
| static void | mesh_verts_calc_normals_normalize_cb (void *userdata, MempoolIterData *mp_v) |
| static void | bm_mesh_verts_calc_normals (BMesh *bm, const float(*edgevec)[3], const float(*fnos)[3], const float(*vcos)[3], float(*vnos)[3]) |
| static void | mesh_faces_calc_normals_cb (void *UNUSED(userdata), MempoolIterData *mp_f) |
| void | BM_mesh_normals_update (BMesh *bm) |
| BMesh Compute Normals. More... | |
| void | BM_verts_calc_normal_vcos (BMesh *bm, const float(*fnos)[3], const float(*vcos)[3], float(*vnos)[3]) |
| BMesh Compute Normals from/to external data. More... | |
| static void | bm_mesh_edges_sharp_tag (BMesh *bm, const float(*vnos)[3], const float(*fnos)[3], float(*r_lnos)[3], const float split_angle, const bool do_sharp_edges_tag) |
| bool | BM_loop_check_cyclic_smooth_fan (BMLoop *l_curr) |
| static void | bm_mesh_loops_calc_normals (BMesh *bm, const float(*vcos)[3], const float(*fnos)[3], float(*r_lnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, const short(*clnors_data)[2], const int cd_loop_clnors_offset, const bool do_rebuild) |
| static bool | bm_mesh_loops_split_lnor_fans (BMesh *bm, MLoopNorSpaceArray *lnors_spacearr, const float(*new_lnors)[3]) |
| static void | bm_mesh_loops_assign_normal_data (BMesh *bm, MLoopNorSpaceArray *lnors_spacearr, short(*r_clnors_data)[2], const int cd_loop_clnors_offset, const float(*new_lnors)[3]) |
| static void | bm_mesh_loops_custom_normals_set (BMesh *bm, const float(*vcos)[3], const float(*vnos)[3], const float(*fnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, short(*r_clnors_data)[2], const int cd_loop_clnors_offset, float(*new_lnors)[3], const int cd_new_lnors_offset, bool do_split_fans) |
| static void | bm_mesh_loops_calc_normals_no_autosmooth (BMesh *bm, const float(*vnos)[3], const float(*fnos)[3], float(*r_lnos)[3]) |
| void | BM_loops_calc_normal_vcos (BMesh *bm, const float(*vcos)[3], const float(*vnos)[3], const float(*fnos)[3], const bool use_split_normals, const float split_angle, float(*r_lnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], const int cd_loop_clnors_offset, const bool do_rebuild) |
| BMesh Compute Loop Normals from/to external data. More... | |
| void | BM_edges_sharp_from_angle_set (BMesh *bm, const float split_angle) |
| void | BM_lnorspacearr_store (BMesh *bm, float(*r_lnors)[3]) |
| void | BM_lnorspace_invalidate (BMesh *bm, const bool do_invalidate_all) |
| void | BM_lnorspace_rebuild (BMesh *bm, bool preserve_clnor) |
| void | BM_lnorspace_update (BMesh *bm) |
| void | BM_normals_loops_edges_tag (BMesh *bm, const bool do_edges) |
| void | BM_lnorspace_err (BMesh *bm) |
| static void | bm_loop_normal_mark_indiv_do_loop (BMLoop *l, BLI_bitmap *loops, MLoopNorSpaceArray *lnor_spacearr, int *totloopsel, const bool do_all_loops_of_vert) |
| static int | bm_loop_normal_mark_indiv (BMesh *bm, BLI_bitmap *loops, const bool do_all_loops_of_vert) |
| static void | loop_normal_editdata_init (BMesh *bm, BMLoopNorEditData *lnor_ed, BMVert *v, BMLoop *l, const int offset) |
| BMLoopNorEditDataArray * | BM_loop_normal_editdata_array_init (BMesh *bm, const bool do_all_loops_of_vert) |
| void | BM_loop_normal_editdata_array_free (BMLoopNorEditDataArray *lnors_ed_arr) |
| bool | BM_custom_loop_normals_to_vector_layer (BMesh *bm) |
| void | BM_custom_loop_normals_from_vector_layer (BMesh *bm, bool add_sharp_edges) |
| void | bmesh_edit_begin (BMesh *UNUSED(bm), BMOpTypeFlag UNUSED(type_flag)) |
| BMesh Begin Edit. More... | |
| void | bmesh_edit_end (BMesh *bm, BMOpTypeFlag type_flag) |
| BMesh End Edit. More... | |
| void | BM_mesh_elem_index_ensure_ex (BMesh *bm, const char htype, int elem_offset[4]) |
| void | BM_mesh_elem_index_ensure (BMesh *bm, const char htype) |
| void | BM_mesh_elem_index_validate (BMesh *bm, const char *location, const char *func, const char *msg_a, const char *msg_b) |
| bool | BM_mesh_elem_table_check (BMesh *bm) |
| void | BM_mesh_elem_table_ensure (BMesh *bm, const char htype) |
| void | BM_mesh_elem_table_init (BMesh *bm, const char htype) |
| void | BM_mesh_elem_table_free (BMesh *bm, const char htype) |
| BMVert * | BM_vert_at_index_find (BMesh *bm, const int index) |
| BMEdge * | BM_edge_at_index_find (BMesh *bm, const int index) |
| BMFace * | BM_face_at_index_find (BMesh *bm, const int index) |
| BMLoop * | BM_loop_at_index_find (BMesh *bm, const int index) |
| BMVert * | BM_vert_at_index_find_or_table (BMesh *bm, const int index) |
| BMEdge * | BM_edge_at_index_find_or_table (BMesh *bm, const int index) |
| BMFace * | BM_face_at_index_find_or_table (BMesh *bm, const int index) |
| int | BM_mesh_elem_count (BMesh *bm, const char htype) |
| void | BM_mesh_remap (BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx) |
| void | BM_mesh_rebuild (BMesh *bm, const struct BMeshCreateParams *params, BLI_mempool *vpool_dst, BLI_mempool *epool_dst, BLI_mempool *lpool_dst, BLI_mempool *fpool_dst) |
| void | BM_mesh_toolflags_set (BMesh *bm, bool use_toolflags) |
BMesh Coordinate Access | |
| void | BM_mesh_vert_coords_get (BMesh *bm, float(*vert_coords)[3]) |
| float(* | BM_mesh_vert_coords_alloc (BMesh *bm, int *r_vert_len))[3] |
| void | BM_mesh_vert_coords_apply (BMesh *bm, const float(*vert_coords)[3]) |
| void | BM_mesh_vert_coords_apply_with_mat4 (BMesh *bm, const float(*vert_coords)[3], const float mat[4][4]) |
Variables | |
| const BMAllocTemplate | bm_mesh_allocsize_default = {512, 1024, 2048, 512} |
| const BMAllocTemplate | bm_mesh_chunksize_default = {512, 1024, 2048, 512} |
BM mesh level functions.
Definition in file bmesh_mesh.c.
| #define BM_LNORSPACE_UPDATE _FLAG_MF |
Helpers for BM_mesh_normals_update and BM_verts_calc_normal_vcos
Definition at line 327 of file bmesh_mesh.c.
Definition at line 1416 of file bmesh_mesh.c.
| #define LNOR_SPACE_TRIGO_THRESHOLD (1.0f - 1e-4f) |
Definition at line 1011 of file bmesh_mesh.c.
| #define MAP_EDGE | ( | ele | ) | etable_dst[BM_elem_index_get(ele)] |
| #define MAP_FACE | ( | ele | ) | ftable_dst[BM_elem_index_get(ele)] |
| #define MAP_LOOP | ( | ele | ) | ltable_dst[BM_elem_index_get(ele)] |
| #define MAP_VERT | ( | ele | ) | vtable_dst[BM_elem_index_get(ele)] |
| #define REMAP_EDGE | ( | ele | ) |
| #define REMAP_FACE | ( | ele | ) |
| #define REMAP_LOOP | ( | ele | ) |
| #define REMAP_VERT | ( | ele | ) |
| typedef struct BMEdgesCalcVectorsData BMEdgesCalcVectorsData |
| typedef struct BMVertsCalcNormalsData BMVertsCalcNormalsData |
| void BM_custom_loop_normals_from_vector_layer | ( | BMesh * | bm, |
| bool | add_sharp_edges | ||
| ) |
Definition at line 1940 of file bmesh_mesh.c.
References bm, bm_mesh_loops_custom_normals_set(), BM_SPACEARR_DIRTY, BM_SPACEARR_DIRTY_ALL, CD_CUSTOMLOOPNORMAL, CD_NORMAL, CustomData_get_offset(), CustomData_has_layer(), BMesh::ldata, BMesh::lnor_spacearr, MEM_callocN, NULL, and BMesh::spacearr_dirty.
Referenced by edbm_connect_vert_pair(), edbm_delete_exec(), edbm_dissolve_edges_exec(), edbm_dissolve_faces_exec(), edbm_dissolve_limited_exec(), edbm_dissolve_verts_exec(), edbm_edge_split_selected_edges(), edbm_edge_split_selected_verts(), edbm_knife_cut_exec(), edbm_merge_exec(), edbm_quads_convert_to_tris_exec(), edbm_remove_doubles_exec(), edbm_rip_invoke(), edbm_split_exec(), edbm_tris_convert_to_quads_exec(), edbm_vert_connect_path_exec(), and mesh_separate_arrays().
| bool BM_custom_loop_normals_to_vector_layer | ( | BMesh * | bm | ) |
Definition at line 1903 of file bmesh_mesh.c.
References BKE_lnor_space_custom_data_to_normal(), bm, BM_data_layer_add(), BM_ELEM_CD_GET_VOID_P, BM_elem_index_get, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_lnorspace_update(), BM_LOOP, BM_LOOPS_OF_FACE, BM_mesh_elem_index_ensure(), CD_CUSTOMLOOPNORMAL, CD_FLAG_TEMPORARY, CD_NORMAL, CustomData_get_offset(), CustomData_has_layer(), CustomData_set_layer_flag(), l, BMesh::ldata, BMesh::lnor_spacearr, MLoopNorSpaceArray::lspacearr, and normal.
Referenced by edbm_connect_vert_pair(), edbm_delete_exec(), edbm_dissolve_edges_exec(), edbm_dissolve_faces_exec(), edbm_dissolve_limited_exec(), edbm_dissolve_verts_exec(), edbm_edge_split_selected_edges(), edbm_edge_split_selected_verts(), edbm_knife_cut_exec(), edbm_merge_exec(), edbm_quads_convert_to_tris_exec(), edbm_remove_doubles_exec(), edbm_rip_invoke(), edbm_split_exec(), edbm_tris_convert_to_quads_exec(), edbm_vert_connect_path_exec(), and mesh_separate_loose().
Definition at line 2381 of file bmesh_mesh.c.
References BLI_mempool_findelem(), bm, and BMesh::epool.
Referenced by BM_edge_at_index_find_or_table(), and ED_view3d_gizmo_mesh_preselect_get_active().
Definition at line 2425 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_edge_at_index_find(), BMesh::elem_table_dirty, BMesh::etable, and NULL.
Referenced by EDBM_edge_find_nearest_ex(), EDBM_elem_from_index_any(), and edbm_select_id_bm_elem_get().
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 autosmooth!
Definition at line 1382 of file bmesh_mesh.c.
References bm, bm_mesh_edges_sharp_tag(), M_PI, and NULL.
Referenced by bevel_harden_normals(), BKE_editmesh_lnorspace_update(), and mesh_customdata_custom_splitnormals_add_exec().
Definition at line 2386 of file bmesh_mesh.c.
References BLI_mempool_findelem(), bm, and BMesh::fpool.
Referenced by BM_face_at_index_find_or_table(), and ED_view3d_gizmo_mesh_preselect_get_active().
Definition at line 2433 of file bmesh_mesh.c.
References bm, BM_FACE, BM_face_at_index_find(), BMesh::elem_table_dirty, BMesh::ftable, and NULL.
Referenced by EDBM_elem_from_index_any(), EDBM_face_find_nearest_ex(), edbm_select_id_bm_elem_get(), and uv_shortest_path_pick_exec().
| void BM_lnorspace_err | ( | BMesh * | bm | ) |
Auxiliary function only used by rebuild to detect if any spaces were not marked as invalid. Reports error if any of the lnor spaces change after rebuilding, meaning that all the possible lnor spaces to be rebuilt were not correctly marked.
Definition at line 1623 of file bmesh_mesh.c.
References BKE_lnor_spacearr_free(), BKE_lnor_spacearr_init(), BLI_assert, bm, BM_loops_calc_normal_vcos(), BM_SPACEARR_DIRTY_ALL, CD_CUSTOMLOOPNORMAL, clear(), compare_ff(), compare_v3v3(), CustomData_get_offset(), float(), BMesh::ldata, BMesh::lnor_spacearr, MLoopNorSpaceArray::lspacearr, M_PI, MEM_callocN, MEM_freeN, MLNOR_SPACEARR_BMLOOP_PTR, NULL, MLoopNorSpace::ref_alpha, MLoopNorSpace::ref_beta, BMesh::spacearr_dirty, BMesh::totloop, MLoopNorSpace::vec_lnor, MLoopNorSpace::vec_ortho, and MLoopNorSpace::vec_ref.
Referenced by BM_lnorspace_rebuild().
| void BM_lnorspace_invalidate | ( | BMesh * | bm, |
| const bool | do_invalidate_all | ||
| ) |
Definition at line 1418 of file bmesh_mesh.c.
References BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, bm, BM_ELEM_API_FLAG_ENABLE, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_SELECT, BM_ITER_ELEM, BM_ITER_MESH, BM_LNORSPACE_UPDATE, BM_LOOPS_OF_VERT, BM_mesh_elem_index_ensure(), BM_SPACEARR_DIRTY, BM_SPACEARR_DIRTY_ALL, BM_VERT, BM_VERTS_OF_MESH, CLEAR_SPACEARRAY_THRESHOLD, l, BMesh::lnor_spacearr, MEM_freeN, BMLoop::next, NULL, BMLoop::prev, BMesh::spacearr_dirty, BMesh::totvert, BMesh::totvertsel, BMLoop::v, and v.
Referenced by EDBM_update_generic(), and initTransform().
| void BM_lnorspace_rebuild | ( | BMesh * | bm, |
| bool | preserve_clnor | ||
| ) |
Definition at line 1486 of file bmesh_mesh.c.
References BKE_lnor_space_custom_data_to_normal(), BKE_lnor_space_custom_normal_to_data(), BKE_lnor_spacearr_clear(), BLI_assert, bm, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_TEST, BM_ELEM_CD_GET_VOID_P, BM_elem_index_get, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_lnorspace_err(), BM_LNORSPACE_UPDATE, BM_LOOP, BM_loops_calc_normal_vcos(), BM_LOOPS_OF_FACE, BM_mesh_elem_index_ensure(), BM_SPACEARR_DIRTY, BM_SPACEARR_DIRTY_ALL, CD_CUSTOMLOOPNORMAL, CustomData_get_offset(), float(), l, BMesh::ldata, BMesh::lnor_spacearr, MLoopNorSpaceArray::lspacearr, M_PI, MEM_callocN, MEM_freeN, MEM_mallocN, MEM_SAFE_FREE, NULL, BMesh::spacearr_dirty, and BMesh::totloop.
Referenced by BM_lnorspace_update(), and transformEnd().
| void BM_lnorspace_update | ( | BMesh * | bm | ) |
Definition at line 1565 of file bmesh_mesh.c.
References bm, BM_lnorspace_rebuild(), BM_lnorspacearr_store(), BM_SPACEARR_DIRTY, BM_SPACEARR_DIRTY_ALL, float(), BMesh::lnor_spacearr, MLoopNorSpaceArray::lspacearr, MEM_callocN, MEM_freeN, NULL, BMesh::spacearr_dirty, and BMesh::totloop.
Referenced by bevel_harden_normals(), BKE_editmesh_lnorspace_update(), BM_custom_loop_normals_to_vector_layer(), edbm_flip_normals_exec(), flip_custom_normals(), and flip_custom_normals_init_data().
Definition at line 1392 of file bmesh_mesh.c.
References BLI_assert, bm, BM_data_layer_add(), BM_loops_calc_normal_vcos(), BM_SPACEARR_DIRTY, BM_SPACEARR_DIRTY_ALL, CD_CUSTOMLOOPNORMAL, CustomData_get_offset(), CustomData_has_layer(), BMesh::ldata, BMesh::lnor_spacearr, M_PI, NULL, and BMesh::spacearr_dirty.
Referenced by BM_lnorspace_update().
Definition at line 2391 of file bmesh_mesh.c.
References bm, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BMFace::len, len, BMLoop::next, and NULL.
Referenced by uv_shortest_path_pick_exec().
| bool BM_loop_check_cyclic_smooth_fan | ( | BMLoop * | l_curr | ) |
Check whether given loop is part of an unknown-so-far cyclic smooth fan, or not. Needed because cyclic smooth fans have no obvious 'entry point', and yet we need to walk them once, and only once.
Definition at line 636 of file bmesh_mesh.c.
References BLI_assert, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_TAG, BM_vert_step_fan_loop(), and BMLoop::e.
Referenced by bm_mesh_loops_calc_normals(), edbm_average_normals_exec(), and normals_split().
| void BM_loop_normal_editdata_array_free | ( | BMLoopNorEditDataArray * | lnors_ed_arr | ) |
Definition at line 1892 of file bmesh_mesh.c.
References BMLoopNorEditDataArray::lidx_to_lnor_editdata, BMLoopNorEditDataArray::lnor_editdata, MEM_freeN, and MEM_SAFE_FREE.
Referenced by edbm_flip_normals_exec(), edbm_normals_make_consistent_exec(), edbm_normals_tools_exec(), edbm_smooth_normals_exec(), flip_custom_normals(), freeCustomNormalArray(), normals_split_merge(), and point_normals_free().
| BMLoopNorEditDataArray* BM_loop_normal_editdata_array_init | ( | BMesh * | bm, |
| const bool | do_all_loops_of_vert | ||
| ) |
Definition at line 1844 of file bmesh_mesh.c.
References BLI_assert, BLI_BITMAP_NEW, BLI_BITMAP_TEST, bm, BM_data_layer_add(), BM_elem_index_get, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOP, bm_loop_normal_mark_indiv(), BM_LOOPS_OF_VERT, BM_mesh_elem_index_ensure(), BM_VERTS_OF_MESH, BMLoopNorEditDataArray::cd_custom_normal_offset, CD_CUSTOMLOOPNORMAL, CustomData_get_offset(), CustomData_has_layer(), l, BMesh::ldata, BMLoopNorEditDataArray::lidx_to_lnor_editdata, BMLoopNorEditDataArray::lnor_editdata, loop_normal_editdata_init(), MEM_callocN, MEM_freeN, MEM_mallocN, BMesh::spacearr_dirty, BMesh::totloop, BMLoopNorEditDataArray::totloop, and v.
Referenced by edbm_flip_normals_exec(), edbm_normals_tools_exec(), edbm_smooth_normals_exec(), flip_custom_normals(), flip_custom_normals_init_data(), normals_split_merge(), point_normals_init(), and storeCustomLNorValue().
|
static |
Definition at line 1710 of file bmesh_mesh.c.
References BLI_assert, bm, BM_EDGE, BM_EDGES_OF_MESH, BM_elem_flag_test, BM_ELEM_SELECT, BM_FACE, BM_face_vert_share_loop(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOP, bm_loop_normal_mark_indiv_do_loop(), BM_LOOPS_OF_EDGE, BM_LOOPS_OF_FACE, BM_LOOPS_OF_VERT, BM_mesh_elem_index_ensure(), BM_VERT, BM_vert_in_edge(), BM_VERTS_OF_MESH, MLoopNorSpaceArray::data_type, e, BMEditSelection::ele, BMEditSelection::htype, l, ListBase::last, BMesh::lnor_spacearr, MLNOR_SPACEARR_BMLOOP_PTR, BMLoop::next, NULL, BMLoop::prev, BMEditSelection::prev, SCE_SELECT_EDGE, SCE_SELECT_FACE, SCE_SELECT_VERTEX, BMesh::selected, BMesh::selectmode, BMLoop::v, and v.
Referenced by BM_loop_normal_editdata_array_init().
|
static |
Definition at line 1665 of file bmesh_mesh.c.
References BLI_BITMAP_ENABLE, BLI_BITMAP_TEST, BM_elem_index_get, BM_ITER_ELEM, BM_LOOPS_OF_VERT, MLoopNorSpace::flags, l, MLoopNorSpace::loops, MLoopNorSpaceArray::lspacearr, MLNOR_SPACE_IS_SINGLE, node, NULL, and BMLoop::v.
Referenced by bm_loop_normal_mark_indiv().
| void BM_loops_calc_normal_vcos | ( | BMesh * | bm, |
| const float(*) | vcos[3], | ||
| const float(*) | vnos[3], | ||
| const float(*) | fnos[3], | ||
| const bool | use_split_normals, | ||
| const float | split_angle, | ||
| float(*) | r_lnos[3], | ||
| MLoopNorSpaceArray * | r_lnors_spacearr, | ||
| short(*) | clnors_data[2], | ||
| const int | cd_loop_clnors_offset, | ||
| const bool | do_rebuild | ||
| ) |
BMesh Compute Loop Normals from/to external data.
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).
Definition at line 1346 of file bmesh_mesh.c.
References BLI_assert, bm, bm_mesh_edges_sharp_tag(), bm_mesh_loops_calc_normals(), bm_mesh_loops_calc_normals_no_autosmooth(), and M_PI.
Referenced by BM_lnorspace_err(), BM_lnorspace_rebuild(), BM_lnorspacearr_store(), and mesh_render_data_update_normals().
|
static |
Definition at line 89 of file bmesh_mesh.c.
References BLI_mempool_create(), BLI_MEMPOOL_NOP, bm, bm_mempool_init_ex(), BMesh::epool, BMesh::fpool, BMesh::lpool, and BMesh::vpool.
Referenced by BM_mesh_clear(), and BM_mesh_create().
|
static |
Definition at line 49 of file bmesh_mesh.c.
References BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_create(), BLI_MEMPOOL_NOP, bm_mesh_chunksize_default, BMAllocTemplate::totedge, BMAllocTemplate::totface, BMAllocTemplate::totloop, and BMAllocTemplate::totvert.
Referenced by bm_mempool_init(), and BM_mesh_toolflags_set().
| void BM_mesh_clear | ( | BMesh * | bm | ) |
Clear all data in bm
Definition at line 281 of file bmesh_mesh.c.
References bm, bm_mempool_init(), bm_mesh_allocsize_default, BM_mesh_data_free(), CustomData_reset(), BMesh::edata, BMesh::ldata, BMesh::pdata, BMesh::toolflag_index, BMesh::totflags, BMesh::use_toolflags, and BMesh::vdata.
Referenced by bpy_bmesh_clear(), and EDBM_mesh_clear().
| BMesh* BM_mesh_create | ( | const BMAllocTemplate * | allocsize, |
| const struct BMeshCreateParams * | params | ||
| ) |
Allocates a new BMesh structure.
Definition at line 157 of file bmesh_mesh.c.
References bm, bm_mempool_init(), CustomData_reset(), BMesh::edata, BMesh::ldata, MEM_callocN, params, BMesh::pdata, BMesh::toolflag_index, BMesh::totflags, BMesh::use_toolflags, and BMesh::vdata.
Referenced by bc_triangulate_mesh(), BKE_mesh_remesh_voxel_fix_poles(), BKE_mesh_to_bmesh_ex(), BM_mesh_copy(), BMD_mesh_bm_create(), bpy_bm_new(), build_skin(), blender::nodes::create_cube_mesh(), blender::nodes::create_ico_sphere_mesh(), ED_uvedit_add_simple_uvs(), edbm_separate_exec(), geometry_extract_apply(), get_bmesh_from_mesh(), lineart_geometry_object_load(), mesh_customdatacorrect_init_container_generic(), mesh_separate_arrays(), mesh_separate_tagged(), paint_mask_slice_exec(), SCULPT_dynamic_topology_enable_ex(), sculpt_face_set_create_exec(), sculpt_face_set_delete_geometry(), sculpt_face_sets_init_flood_fill(), sculpt_face_sets_init_loop(), sculpt_gesture_apply_trim(), sculpt_gesture_trim_normals_update(), sculpt_undo_bmesh_enable(), TEST(), and undomesh_to_editmesh().
| void BM_mesh_data_free | ( | BMesh * | bm | ) |
Frees a BMesh structure.
Definition at line 185 of file bmesh_mesh.c.
References BKE_lnor_spacearr_free(), BLI_freelistN(), BLI_mempool_destroy(), bm, BM_EDGES_OF_MESH, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, BM_mesh_elem_toolflags_clear(), BM_VERTS_OF_MESH, BMO_error_clear(), CustomData_bmesh_free_block(), CustomData_bmesh_has_free(), CustomData_free(), BMHeader::data, e, BMesh::edata, BMesh::epool, BMesh::etable, BMesh::fpool, BMesh::ftable, BMVert::head, BMLoop::head, BMFace::head, l, BMesh::ldata, BMesh::lnor_spacearr, BMesh::lpool, MEM_freeN, BMesh::pdata, CustomData::pool, BMesh::selected, CustomData::totlayer, v, BMesh::vdata, BMesh::vpool, and BMesh::vtable.
Referenced by BM_mesh_clear(), BM_mesh_free(), EDBM_redo_state_free(), and EDBM_redo_state_restore().
|
static |
Definition at line 353 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_EDGES_OF_MESH, BM_mesh_elem_index_ensure(), BM_OMP_LIMIT, BM_VERT, data, mesh_edges_calc_vectors_cb(), and BMesh::totedge.
Referenced by BM_mesh_normals_update(), and BM_verts_calc_normal_vcos().
|
static |
Helpers for #BM_mesh_loop_normals_update and BM_loops_calc_normal_vcos
Definition at line 558 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_edge_loop_pair(), BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_elem_index_get, BM_elem_index_set, BM_ELEM_SMOOTH, BM_ELEM_TAG, BM_FACE, BM_ITER_MESH_INDEX, BM_LOOP, BM_mesh_elem_index_ensure(), BM_VERT, copy_v3_v3(), cosf, dot_v3v3(), e, BMesh::elem_index_dirty, BMLoop::f, float(), l_b, M_PI, BMVert::no, BMFace::no, and BMLoop::v.
Referenced by BM_edges_sharp_from_angle_set(), BM_loops_calc_normal_vcos(), and bm_mesh_loops_custom_normals_set().
| int BM_mesh_elem_count | ( | BMesh * | bm, |
| const char | htype | ||
| ) |
Return the amount of element of type 'type' in a given bmesh.
Definition at line 2444 of file bmesh_mesh.c.
References BLI_assert, bm, BM_ALL_NOLOOP, BM_EDGE, BM_FACE, BM_VERT, BMesh::totedge, BMesh::totface, and BMesh::totvert.
Referenced by SCULPT_vertex_count_get(), and TEST().
| void BM_mesh_elem_index_ensure | ( | BMesh * | bm, |
| const char | htype | ||
| ) |
Definition at line 2152 of file bmesh_mesh.c.
References bm, BM_mesh_elem_index_ensure_ex(), and NULL.
Referenced by armature_deform_coords_impl(), BKE_bmbvh_new_ex(), BKE_editmesh_cache_ensure_poly_centers(), BKE_editmesh_cache_ensure_poly_normals(), BKE_editmesh_cache_ensure_vert_normals(), BKE_editmesh_loop_tangent_calc(), BKE_mesh_foreach_mapped_edge(), BKE_mesh_foreach_mapped_loop(), BKE_pbvh_node_raycast(), BM_custom_loop_normals_to_vector_layer(), bm_decim_triangulate_begin(), bm_edge_info_average_length_fallback(), BM_lnorspace_invalidate(), BM_lnorspace_rebuild(), BM_loop_normal_editdata_array_init(), bm_loop_normal_mark_indiv(), BM_mesh_calc_path_edge(), BM_mesh_decimate_dissolve_ex(), BM_mesh_edgenet(), bm_mesh_edges_calc_vectors(), bm_mesh_edges_sharp_tag(), BM_mesh_intersect(), bm_mesh_loops_calc_normals(), bm_mesh_loops_calc_normals_no_autosmooth(), BM_mesh_normals_update(), BM_mesh_region_match(), bm_mesh_verts_calc_normals(), BM_uv_element_map_create(), BM_uv_vert_map_create(), BMeshFairingContext::BMeshFairingContext(), bmo_offset_edgeloops_exec(), bmo_smooth_laplacian_vert_exec(), bpy_bmelemseq_index_update(), calc_solidify_normals(), construct_param_handle(), construct_param_handle_subsurfed(), DRW_text_edit_mesh_measure_stats(), ED_mesh_mirrtopo_init(), edbm_face_split_by_edges_exec(), edbm_mod_weighted_strength_exec(), EDBM_preselect_edgering_update_from_edge(), EDBM_preselect_elem_update_from_single(), edbm_select_linked_pick_invoke(), edbm_shortest_path_pick_invoke(), EDBM_unified_findnearest_from_raycast(), EDBM_verts_mirror_cache_begin_ex(), gizmo_preselect_edgering_test_select(), gizmo_preselect_elem_test_select(), knifetool_init_bmbvh(), lattice_deform_coords_impl(), lineart_geometry_object_load(), loopcut_finish(), math_layer_info_init(), mesh_calc_path_region_elem(), mesh_render_data_create(), SCULPT_stroke_get_location(), SCULPT_vertex_random_access_ensure(), snap_mesh_polygon(), snapEditMesh(), solidify_add_thickness(), statvis_calc_distort(), statvis_calc_intersect(), statvis_calc_thickness(), stitch_process_data(), transform_convert_mesh_islands_calc(), uv_find_nearest_edge(), uv_find_nearest_vert(), uv_select_overlap(), uv_set_connectivity_distance(), uv_shortest_path_pick_invoke(), and vgroup_smooth_subset().
| void BM_mesh_elem_index_ensure_ex | ( | BMesh * | bm, |
| const char | htype, | ||
| int | elem_offset[4] | ||
| ) |
Definition at line 2038 of file bmesh_mesh.c.
References BLI_assert, bm, BM_EDGE, BM_EDGES_OF_MESH, BM_elem_index_set, BM_ELEM_INDEX_VALIDATE, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_LOOP, BM_VERT, BM_VERTS_OF_MESH, BMesh::elem_index_dirty, elem_offset(), BMLoop::next, NULL, BMesh::totedge, BMesh::totface, BMesh::totloop, and BMesh::totvert.
Referenced by BM_mesh_elem_index_ensure(), and EDBM_mesh_elem_index_ensure_multi().
| void BM_mesh_elem_index_validate | ( | BMesh * | bm, |
| const char * | location, | ||
| const char * | func, | ||
| const char * | msg_a, | ||
| const char * | msg_b | ||
| ) |
Array checking/setting macros
Currently vert/edge/loop/face index data is being abused, in a few areas of the code.
To avoid correcting them afterwards, set 'bm->elem_index_dirty' however its possible this flag is set incorrectly which could crash blender.
Code that calls this functions may depend on dirty indices on being set. Keep this function read-only.
Definition at line 2169 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_EDGES_OF_MESH, BM_elem_index_get, BM_FACE, BM_FACES_OF_MESH, BM_ITER_MESH, BM_VERT, BM_VERTS_OF_MESH, and BMesh::elem_index_dirty.
| bool BM_mesh_elem_table_check | ( | BMesh * | bm | ) |
Definition at line 2242 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_EDGES_OF_MESH, BM_FACE, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_VERT, BM_VERTS_OF_MESH, BMesh::elem_table_dirty, BMesh::etable, BMesh::ftable, and BMesh::vtable.
Referenced by BM_mesh_elem_table_ensure(), and EDBM_update_generic().
| void BM_mesh_elem_table_ensure | ( | BMesh * | bm, |
| const char | htype | ||
| ) |
Definition at line 2276 of file bmesh_mesh.c.
References BLI_assert, bm, BM_ALL_NOLOOP, BM_EDGE, BM_EDGES_OF_MESH, BM_FACE, BM_FACES_OF_MESH, BM_iter_as_array(), BM_mesh_elem_table_check(), BM_VERT, BM_VERTS_OF_MESH, BMesh::elem_table_dirty, BMesh::etable, BMesh::etable_tot, BMesh::ftable, BMesh::ftable_tot, MEM_freeN, MEM_mallocN, NULL, BMesh::totedge, BMesh::totface, BMesh::totvert, BMesh::vtable, and BMesh::vtable_tot.
Referenced by bm_mesh_calc_uv_islands(), BM_mesh_elem_table_init(), BM_mesh_intersect(), BM_mesh_intersect_edges(), BM_mesh_remap(), BMeshFairingContext::BMeshFairingContext(), bmo_recalc_face_normals_exec(), bpy_bmelemseq_ensure_lookup_table(), bvhtree_from_editmesh_edges_create_tree(), bvhtree_from_editmesh_verts_create_tree(), construct_param_handle_subsurfed(), draw_select_id_edit_mesh(), ED_mesh_mirror_spatial_table_begin(), ED_mesh_mirrtopo_init(), ED_transverts_create_from_obedit(), ED_vgroup_parray_mirror_assign(), ED_vgroup_parray_mirror_sync(), edbm_face_split_by_edges_exec(), EDBM_select_interior_faces(), edbm_select_similar_region_exec(), EDBM_verts_mirror_cache_begin_ex(), blender::ed::spreadsheet::GeometryDataSource::get_selected_element_indices(), get_vert_def_nr(), give_parvert(), lineart_geometry_object_load(), loopcut_init(), math_layer_info_init(), mesh_foreachScreenEdge(), mesh_foreachScreenEdge_clip_bb_segment(), mesh_foreachScreenFace(), mesh_foreachScreenVert(), mesh_render_data_create(), mesh_symmetry_snap_exec(), multires_unsubdivide_extract_grids(), multires_unsubdivide_prepare_original_bmesh_for_extract(), multires_unsubdivide_single_level(), sculpt_face_set_delete_geometry(), sculpt_face_sets_init_flood_fill(), SCULPT_stroke_get_location(), SCULPT_vertex_random_access_ensure(), snap_mesh_polygon(), snapEditMesh(), stitch_init(), transform_convert_mesh_islands_calc(), uv_select_flush_from_tag_face(), uv_select_flush_from_tag_loop(), uv_select_linked_multi(), uv_select_overlap(), and vgroup_smooth_subset().
| void BM_mesh_elem_table_free | ( | BMesh * | bm, |
| const char | htype | ||
| ) |
Definition at line 2361 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_FACE, BM_VERT, BMesh::etable, BMesh::ftable, MEM_SAFE_FREE, and BMesh::vtable.
Referenced by BM_mesh_elem_table_init().
| void BM_mesh_elem_table_init | ( | BMesh * | bm, |
| const char | htype | ||
| ) |
Definition at line 2352 of file bmesh_mesh.c.
References BLI_assert, bm, BM_ALL_NOLOOP, BM_mesh_elem_table_ensure(), and BM_mesh_elem_table_free().
Referenced by multires_unsubdivide_single_level(), sculpt_face_set_delete_geometry(), and sculpt_face_sets_init_flood_fill().
| void BM_mesh_elem_toolflags_clear | ( | BMesh * | bm | ) |
Definition at line 132 of file bmesh_mesh.c.
References BLI_mempool_destroy(), bm, BMesh::etoolflagpool, BMesh::ftoolflagpool, NULL, and BMesh::vtoolflagpool.
Referenced by BM_mesh_data_free(), and select_linked_delimit_end().
| void BM_mesh_elem_toolflags_ensure | ( | BMesh * | bm | ) |
Definition at line 98 of file bmesh_mesh.c.
References BLI_assert, BLI_mempool_calloc(), BLI_mempool_create(), BLI_MEMPOOL_NOP, bm, BM_EDGES_OF_MESH, BM_FACES_OF_MESH, BM_ITER_MESH, BM_VERTS_OF_MESH, BMesh::etoolflagpool, BMesh::ftoolflagpool, BMVert_OFlag::oflags, BMEdge_OFlag::oflags, BMFace_OFlag::oflags, BMesh::totedge, BMesh::totface, BMesh::totflags, BMesh::totvert, BMesh::use_toolflags, and BMesh::vtoolflagpool.
Referenced by BMO_op_exec(), build_skin(), mesh_separate_tagged(), select_linked_delimit_begin(), and walker_deselect_nth().
| void BM_mesh_free | ( | BMesh * | bm | ) |
Frees a BMesh data and its structure.
Definition at line 307 of file bmesh_mesh.c.
References bm, BM_mesh_data_free(), bpy_bm_generic_invalidate(), MEM_freeN, NULL, and BMesh::py_handle.
Referenced by base_skin(), bc_triangulate_mesh(), BKE_editmesh_free(), BKE_mesh_mirror_apply_mirror_on_axis(), BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(), BKE_mesh_remesh_voxel_fix_poles(), BKE_sculptsession_free(), bpy_bmesh_dealloc(), bpy_bmesh_free(), blender::nodes::create_cube_mesh(), blender::nodes::create_ico_sphere_mesh(), blender::io::alembic::ABCGenericMeshWriter::do_write(), doEdgeSplit(), ED_uvedit_add_simple_uvs(), EDBM_automerge_and_split(), edbm_separate_exec(), mesh_customdatacorrect_free_cb(), mesh_separate_arrays(), mesh_separate_tagged(), modifyMesh(), multires_unsubdivide_extract_grids(), multires_unsubdivide_private_extract_data_free(), multires_unsubdivide_to_basemesh(), paint_mask_slice_exec(), SCULPT_dynamic_topology_disable_ex(), sculpt_face_set_create_exec(), sculpt_face_set_delete_geometry(), sculpt_face_sets_init_flood_fill(), sculpt_face_sets_init_loop(), sculpt_gesture_apply_trim(), sculpt_gesture_trim_normals_update(), TEST(), triangulate_mesh(), and WireframeModifier_do().
|
static |
Assign custom normal data from given normal vectors, averaging normals from one smooth fan as necessary.
Definition at line 1113 of file bmesh_mesh.c.
References add_v3_v3(), BKE_lnor_space_custom_normal_to_data(), BLI_assert, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, bm, BM_ELEM_CD_GET_VOID_P, BM_elem_index_get, MLoopNorSpaceArray::data_type, MLoopNorSpace::flags, G, G_DEBUG, LinkNode::link, MLoopNorSpace::loops, MLoopNorSpaceArray::lspacearr, MEM_freeN, MLNOR_SPACE_IS_SINGLE, MLNOR_SPACEARR_BMLOOP_PTR, mul_v3_fl(), LinkNode::next, nor, BMesh::totloop, and zero_v3().
Referenced by bm_mesh_loops_custom_normals_set().
|
static |
BMesh version of BKE_mesh_normals_loop_split() in mesh_evaluate.c Will use first clnors_data array, and fallback to cd_loop_clnors_offset (use NULL and -1 to not use clnors).
Definition at line 676 of file bmesh_mesh.c.
References BKE_lnor_space_add_loop(), BKE_lnor_space_create(), BKE_lnor_space_custom_data_to_normal(), BKE_lnor_space_define(), BKE_lnor_spacearr_free(), BKE_lnor_spacearr_init(), BLI_assert, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, BLI_stack_free(), BLI_stack_is_empty(), BLI_stack_new, BLI_stack_push(), bm, BM_edge_other_vert(), BM_ELEM_API_FLAG_TEST, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_elem_index_get, BM_elem_index_set, BM_ELEM_TAG, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_LNORSPACE_UPDATE, BM_LOOP, BM_loop_check_cyclic_smooth_fan(), BM_mesh_elem_index_ensure(), BM_SPACEARR_DIRTY_ALL, BM_VERT, BM_vert_step_fan_loop(), BMVert::co, copy_v3_v3(), dot_v3v3(), BMLoop::e, BMesh::elem_index_dirty, BMLoop::f, LIKELY, madd_v3_v3fl(), MLNOR_SPACEARR_BMLOOP_PTR, BMLoop::next, BMFace::no, nor, normal, normalize_v3(), NULL, BMLoop::prev, saacos(), BMesh::spacearr_dirty, sub_v3_v3v3(), BMesh::totloop, UNLIKELY, and BMLoop::v.
Referenced by BM_loops_calc_normal_vcos(), and bm_mesh_loops_custom_normals_set().
|
static |
Definition at line 1272 of file bmesh_mesh.c.
References bm, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_SMOOTH, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_LOOP, BM_mesh_elem_index_ensure(), BM_VERT, copy_v3_v3(), BMLoop::next, BMVert::no, BMFace::no, and BMLoop::v.
Referenced by BM_loops_calc_normal_vcos().
|
static |
Compute internal representation of given custom normals (as an array of float[2] or data layer).
It also makes sure the mesh matches those custom normals, by marking new sharp edges to split the smooth fans when loop normals for the same vertex are different, or averaging the normals instead, depending on the do_split_fans parameter.
Definition at line 1198 of file bmesh_mesh.c.
References BKE_lnor_spacearr_clear(), bm, BM_ELEM_CD_GET_VOID_P, BM_elem_index_get, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, bm_mesh_edges_sharp_tag(), bm_mesh_loops_assign_normal_data(), bm_mesh_loops_calc_normals(), bm_mesh_loops_split_lnor_fans(), copy_v3_v3(), float(), is_zero_v3(), l, M_PI, MEM_freeN, MEM_mallocN, normal, normalize_v3(), NULL, and BMesh::totloop.
Referenced by BM_custom_loop_normals_from_vector_layer().
|
static |
Check each current smooth fan (one lnor space per smooth fan!), and if all its matching custom lnors are not (enough) equal, add sharp edges as needed.
Definition at line 1017 of file bmesh_mesh.c.
References BLI_assert, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, bm, BM_elem_flag_disable, BM_elem_index_get, BM_ELEM_SMOOTH, BM_ELEM_TAG, MLoopNorSpaceArray::data_type, dot_v3v3(), BMLoop::e, e, MLoopNorSpace::flags, G, G_DEBUG, LinkNode::link, LNOR_SPACE_TRIGO_THRESHOLD, MLoopNorSpace::loops, MLoopNorSpaceArray::lspacearr, MEM_freeN, MLNOR_SPACE_IS_SINGLE, MLNOR_SPACEARR_BMLOOP_PTR, LinkNode::next, nor, NULL, BMLoop::prev, and BMesh::totloop.
Referenced by bm_mesh_loops_custom_normals_set().
| void BM_mesh_normals_update | ( | BMesh * | bm | ) |
BMesh Compute Normals.
Updates the normals of a mesh.
Definition at line 500 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_elem_index_set, BM_FACE, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, bm_mesh_edges_calc_vectors(), BM_mesh_elem_index_ensure(), bm_mesh_verts_calc_normals(), BM_OMP_LIMIT, BM_VERT, BM_VERTS_OF_MESH, BMesh::elem_index_dirty, float(), MEM_freeN, MEM_mallocN, mesh_faces_calc_normals_cb(), BMVert::no, NULL, BMesh::totedge, BMesh::totface, v, and zero_v3().
Referenced by bevel_harden_normals(), BKE_mesh_remesh_voxel_fix_poles(), bmesh_edit_begin(), bmesh_edit_end(), bpy_bmesh_normal_update(), ED_transverts_update_obedit(), EDBM_mesh_normals_update(), lineart_geometry_object_load(), mesh_separate_tagged(), modwrap_dependsOnNormals(), SCULPT_dynamic_topology_enable_ex(), and slice_paint_mask().
| void BM_mesh_rebuild | ( | BMesh * | bm, |
| const struct BMeshCreateParams * | params, | ||
| BLI_mempool * | vpool_dst, | ||
| BLI_mempool * | epool_dst, | ||
| BLI_mempool * | lpool_dst, | ||
| BLI_mempool * | fpool_dst | ||
| ) |
Use new memory pools for this mesh.
Definition at line 2762 of file bmesh_mesh.c.
References BMesh::act_face, BLI_mempool_alloc(), BLI_mempool_calloc(), BLI_mempool_destroy(), bm, BM_EDGE, BM_EDGES_OF_MESH, BM_elem_index_set, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_LOOP, BM_VERT, BM_VERTS_OF_MESH, BMVert::e, BMLoop::e, e, BMesh::elem_table_dirty, BMesh::epool, BMesh::etable, BMesh::etable_tot, BMesh::etoolflagpool, BMLoop::f, BMesh::fpool, BMesh::ftable, BMesh::ftable_tot, BMesh::ftoolflagpool, BMFace::l_first, LISTBASE_FOREACH, BMesh::lpool, MAP_EDGE, MAP_FACE, MAP_VERT, MEM_freeN, MEM_mallocN, BMLoop::next, NULL, params, BMLoop::prev, BMLoop::radial_next, BMLoop::radial_prev, REMAP_EDGE, REMAP_FACE, REMAP_LOOP, REMAP_VERT, BMesh::selected, SWAP, BMesh::totedge, BMesh::totface, BMesh::totloop, BMesh::totvert, BMLoop::v, v, BMesh::vpool, BMesh::vtable, BMesh::vtable_tot, and BMesh::vtoolflagpool.
Referenced by BM_mesh_toolflags_set().
| void BM_mesh_remap | ( | BMesh * | bm, |
| const uint * | vert_idx, | ||
| const uint * | edge_idx, | ||
| const uint * | face_idx | ||
| ) |
Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays (xxx_idx[org_index] = new_index).
A NULL array means no changes.
Definition at line 2476 of file bmesh_mesh.c.
References BMesh::act_face, BLI_assert, BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_ptr_new_ex(), bm, BM_EDGE, BM_EDGES_OF_MESH, BM_ELEM_CD_GET_VOID_P, BM_FACE, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOP, BM_LOOPS_OF_FACE, BM_mesh_elem_table_ensure(), BM_VERT, BM_VERTS_OF_MESH, CD_BM_ELEM_PYPTR, CustomData_get_offset(), BMVert::e, BMLoop::e, BMesh::edata, BMEditSelection::ele, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMesh::etable, BMLoop::f, ListBase::first, BMesh::ftable, BMEditSelection::htype, MEM_freeN, MEM_mallocN, BMDiskLink::next, BMEditSelection::next, NULL, BMesh::pdata, BMDiskLink::prev, BMesh::selected, BMesh::totedge, BMesh::totface, BMesh::totvert, BMLoop::v, BMEdge::v1, BMEdge::v1_disk_link, BMEdge::v2, BMEdge::v2_disk_link, BMesh::vdata, and BMesh::vtable.
Referenced by BM_log_mesh_elems_reorder(), and sort_bmelem_flag().
| void BM_mesh_toolflags_set | ( | BMesh * | bm, |
| bool | use_toolflags | ||
| ) |
Re-allocates mesh data with/without toolflags.
Definition at line 3016 of file bmesh_mesh.c.
References BLI_mempool_destroy(), bm, bm_mempool_init_ex(), BM_mesh_rebuild(), BMALLOC_TEMPLATE_FROM_BM, BMesh::etoolflagpool, BMesh::ftoolflagpool, NULL, BMesh::use_toolflags, and BMesh::vtoolflagpool.
Referenced by sculpt_symmetrize_exec().
Definition at line 3066 of file bmesh_mesh.c.
References bm, BM_mesh_vert_coords_get(), float(), MEM_mallocN, and BMesh::totvert.
Referenced by BKE_editmesh_vert_coords_alloc_orco().
Definition at line 3074 of file bmesh_mesh.c.
References bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, copy_v3_v3(), and v.
Referenced by ED_object_data_xform_restore().
| void BM_mesh_vert_coords_apply_with_mat4 | ( | BMesh * | bm, |
| const float(*) | vert_coords[3], | ||
| const float | mat[4][4] | ||
| ) |
Definition at line 3084 of file bmesh_mesh.c.
References bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, mul_v3_m4v3(), and v.
Referenced by ED_object_data_xform_by_mat4().
Definition at line 3056 of file bmesh_mesh.c.
References bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, copy_v3_v3(), and v.
Referenced by BM_mesh_vert_coords_alloc(), and ED_object_data_xform_create_ex().
|
static |
Definition at line 462 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_FACE, BM_FACES_OF_MESH, BM_mesh_elem_index_ensure(), BM_OMP_LIMIT, BM_VERT, BM_VERTS_OF_MESH, data, mesh_verts_calc_normals_accum_cb(), mesh_verts_calc_normals_normalize_cb(), BMesh::totface, and BMesh::totvert.
Referenced by BM_mesh_normals_update(), and BM_verts_calc_normal_vcos().
| void BM_normals_loops_edges_tag | ( | BMesh * | bm, |
| const bool | do_edges | ||
| ) |
Definition at line 1582 of file bmesh_mesh.c.
References bm, BM_EDGE, BM_edge_loop_pair(), BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_elem_index_set, BM_ELEM_SMOOTH, BM_ELEM_TAG, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_LOOP, e, BMesh::elem_index_dirty, l_b, BMLoop::next, and BMLoop::v.
Referenced by edbm_average_normals_exec(), normals_merge(), and normals_split().
Definition at line 2376 of file bmesh_mesh.c.
References BLI_mempool_findelem(), bm, and BMesh::vpool.
Referenced by BM_vert_at_index_find_or_table(), and ED_view3d_gizmo_mesh_preselect_get_active().
Use lookup table when available, else use slower find functions.
Definition at line 2417 of file bmesh_mesh.c.
References bm, BM_VERT, BM_vert_at_index_find(), BMesh::elem_table_dirty, NULL, and BMesh::vtable.
Referenced by EDBM_elem_from_index_any(), edbm_select_id_bm_elem_get(), and EDBM_vert_find_nearest_ex().
| void BM_verts_calc_normal_vcos | ( | BMesh * | bm, |
| const float(*) | fnos[3], | ||
| const float(*) | vcos[3], | ||
| float(*) | vnos[3] | ||
| ) |
BMesh Compute Normals from/to external data.
Computes the vertex normals of a mesh into vnos, using given vertex coordinates (vcos) and polygon normals (fnos).
Definition at line 538 of file bmesh_mesh.c.
References bm, bm_mesh_edges_calc_vectors(), bm_mesh_verts_calc_normals(), float(), MEM_freeN, MEM_mallocN, and BMesh::totedge.
Referenced by BKE_editmesh_cache_ensure_vert_normals().
| void bmesh_edit_begin | ( | BMesh * | UNUSEDbm, |
| BMOpTypeFlag | UNUSEDtype_flag | ||
| ) |
BMesh Begin Edit.
Functions for setting up a mesh for editing and cleaning up after the editing operations are done. These are called by the tools/operator API for each time a tool is executed.
Definition at line 1975 of file bmesh_mesh.c.
References bm, BM_mesh_normals_update(), BMO_OPTYPE_FLAG_UNTAN_MULTIRES, CD_MDISPS, CustomData_has_layer(), and BMesh::ldata.
Referenced by BMO_op_exec(), build_skin(), and mesh_customdatacorrect_init_container_generic().
| void bmesh_edit_end | ( | BMesh * | bm, |
| BMOpTypeFlag | type_flag | ||
| ) |
BMesh End Edit.
Definition at line 1998 of file bmesh_mesh.c.
References BLI_listbase_clear(), bm, BM_mesh_normals_update(), BM_mesh_select_mode_flush(), BM_SPACEARR_DIRTY_ALL, BMO_OPTYPE_FLAG_INVALIDATE_CLNOR_ALL, BMO_OPTYPE_FLAG_NORMALS_CALC, BMO_OPTYPE_FLAG_SELECT_FLUSH, BMO_OPTYPE_FLAG_SELECT_VALIDATE, BMO_OPTYPE_FLAG_UNTAN_MULTIRES, CD_MDISPS, CustomData_has_layer(), BMesh::ldata, BMesh::selected, and BMesh::spacearr_dirty.
Referenced by BMO_op_exec(), build_skin(), and mesh_customdatacorrect_free_cb().
|
static |
Definition at line 1821 of file bmesh_mesh.c.
References BKE_lnor_space_custom_data_to_normal(), BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_elem_index_get, BMLoopNorEditData::clnors_data, BMVert::co, copy_v3_v3(), l, BMesh::lnor_spacearr, BMLoopNorEditData::loc, BMLoopNorEditData::loop, BMLoopNorEditData::loop_index, MLoopNorSpaceArray::lspacearr, BMLoopNorEditData::niloc, BMLoopNorEditData::nloc, NULL, and v.
Referenced by BM_loop_normal_editdata_array_init().
|
static |
Definition at line 337 of file bmesh_mesh.c.
References BM_elem_index_get, BMVert::co, data, e, normalize_v3(), and sub_v3_v3v3().
Referenced by bm_mesh_edges_calc_vectors().
|
static |
Definition at line 488 of file bmesh_mesh.c.
References BM_face_normal_update().
Referenced by BM_mesh_normals_update().
|
static |
Definition at line 376 of file bmesh_mesh.c.
References atomic_cas_float(), BLI_assert, BM_elem_index_get, BM_FACE_FIRST_LOOP, data, dot_v3v3(), BMLoop::e, FLT_EQ_NONAN, BMLoop::next, BMVert::no, BMFace::no, BMLoop::prev, saacos(), BMLoop::v, and BMEdge::v1.
Referenced by bm_mesh_verts_calc_normals().
|
static |
Definition at line 450 of file bmesh_mesh.c.
References BM_elem_index_get, BMVert::co, data, BMVert::no, normalize_v3(), normalize_v3_v3(), UNLIKELY, and v.
Referenced by bm_mesh_verts_calc_normals().
| const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512} |
Definition at line 46 of file bmesh_mesh.c.
Referenced by bc_triangulate_mesh(), BM_mesh_clear(), BM_mesh_copy_init_customdata(), BM_mesh_copy_init_customdata_all_layers(), BM_mesh_copy_init_customdata_from_mesh(), bpy_bm_new(), build_skin(), ED_uvedit_add_simple_uvs(), edbm_separate_exec(), mesh_customdatacorrect_init_container_generic(), mesh_separate_tagged(), sculpt_undo_bmesh_enable(), and TEST().
| const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512} |
Definition at line 47 of file bmesh_mesh.c.
Referenced by bm_mempool_init_ex(), and CustomData_bmesh_init_pool().