Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_array.h"
#include "BLI_linklist_stack.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines_stack.h"
#include "BLT_translation.h"
#include "DNA_meshdata_types.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
Go to the source code of this file.
Macros | |
#define | VERT_VISIT _FLAG_WALK |
#define | EDGE_VISIT _FLAG_WALK |
#define | LOOP_VISIT _FLAG_WALK |
#define | EDGE_VISIT _FLAG_WALK |
Core BMesh functions for adding, removing BMesh elements.
Definition in file bmesh_core.c.
#define EDGE_VISIT _FLAG_WALK |
#define EDGE_VISIT _FLAG_WALK |
#define LOOP_VISIT _FLAG_WALK |
#define VERT_VISIT _FLAG_WALK |
BMEdge* BM_edge_create | ( | BMesh * | bm, |
BMVert * | v1, | ||
BMVert * | v2, | ||
const BMEdge * | e_example, | ||
eBMCreateFlag | create_flag | ||
) |
Main function for creating a new edge.
Definition at line 123 of file bmesh_core.c.
References BMHeader::api_flag, BLI_assert, BLI_mempool_alloc(), BLI_mempool_calloc(), bm, BM_CHECK_ELEMENT, BM_CREATE_NO_DOUBLE, BM_CREATE_SKIP_CD, BM_EDGE, BM_edge_exists(), BM_elem_attrs_copy(), BM_ELEM_DRAW, BM_elem_index_set, BM_ELEM_SMOOTH, BM_SPACEARR_DIRTY_ALL, BM_VERT, bmesh_disk_edge_append(), CustomData_bmesh_set_default(), BMHeader::data, e, BMesh::edata, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMesh::epool, BMesh::etoolflagpool, BMVert::head, BMEdge::head, BMHeader::hflag, BMHeader::htype, NULL, BMesh::spacearr_dirty, BMesh::totedge, BMesh::use_toolflags, v1, and v2.
Referenced by bevel_reattach_wires(), bevel_vert_two_edges(), BKE_mesh_remesh_voxel_fix_poles(), bm_edge_copy_with_arrays(), BM_edge_rotate(), bm_edges_from_tri(), BM_edges_from_verts_ensure(), BM_face_copy(), BM_face_create_ngon_verts(), BM_face_split_edgenet_connect_islands(), bm_isect_tri_tri(), BM_mesh_bm_from_me(), BM_mesh_copy(), BM_mesh_intersect_edges(), bm_vert_connect_select_history(), bmesh_kernel_edge_separate(), bmesh_kernel_split_edge_make_vert(), bmesh_kernel_split_face_make_edge(), bmesh_kernel_unglue_region_make_vert_multi(), bmo_contextual_create_exec(), bmo_create_circle_exec(), bmo_create_uvsphere_exec(), bmo_edge_copy(), bmo_edgenet_prepare_exec(), bmo_extrude_face_region_exec(), bmo_extrude_vert_indiv_exec(), bmo_face_inset_individual(), bmo_inset_region_exec(), bmo_weld_verts_exec(), bpy_bmedgeseq_new(), edbm_polybuild_face_at_cursor_invoke(), edbm_rip_invoke__vert(), knife_make_face_cuts(), and pbvh_bmesh_split_edge().
Kills e and all faces that use it.
Definition at line 927 of file bmesh_core.c.
References bm, BM_face_kill(), bm_kill_only_edge(), bmesh_disk_edge_remove(), and e.
Referenced by bm_decim_triangulate_end(), bm_edge_collapse(), BM_edge_splice(), BM_face_edges_kill(), bm_face_split(), BM_face_split_edgenet_connect_islands(), BM_faces_join(), bm_log_faces_unmake(), BM_mesh_decimate_dissolve_ex(), BM_mesh_intersect(), bm_remove_tagged_edges(), BM_vert_kill(), bmesh_kernel_join_vert_kill_edge(), bmo_dissolve_edges_exec(), bmo_dissolve_verts_exec(), bmo_extrude_face_region_exec(), bmo_remove_tagged_edges(), bmo_triangle_fill_exec(), bpy_bmedgeseq_remove(), knife_make_face_cuts(), pbvh_bmesh_collapse_edge(), and pbvh_bmesh_split_edge().
Splice Edge.
Splice two unique edges which share the same two vertices into one edge. (e_src into e_dst, removing e_src).
Definition at line 2332 of file bmesh_core.c.
References BLI_assert, bm, BM_CHECK_ELEMENT, BM_edge_kill(), BM_vert_in_edge(), bmesh_radial_length(), bmesh_radial_loop_append(), bmesh_radial_loop_remove(), BMEdge::l, l, BMLoop::next, BMLoop::v, BMEdge::v1, and BMEdge::v2.
Referenced by bm_edge_collapse(), bmesh_kernel_join_edge_kill_vert(), bmesh_kernel_join_vert_kill_edge(), bmesh_kernel_vert_separate__cleanup(), and bmo_spin_exec().
BLI_INLINE bool bm_edge_supports_separate | ( | const BMEdge * | e | ) |
Definition at line 2077 of file bmesh_core.c.
References e.
Referenced by BM_vert_separate(), and BM_vert_separate_hflag().
Definition at line 1051 of file bmesh_core.c.
References BM_ELEM_API_FLAG_DISABLE.
Referenced by BM_faces_join().
Definition at line 1041 of file bmesh_core.c.
References BM_ELEM_API_FLAG_ENABLE.
Referenced by BM_faces_join().
|
static |
Definition at line 259 of file bmesh_core.c.
References BLI_addtail(), BLI_mempool_calloc(), bm, bm_loop_create(), bmesh_radial_loop_append(), l, BMFace::l_first, and NULL.
Referenced by BM_face_create().
BMFace* BM_face_copy | ( | BMesh * | bm_dst, |
BMesh * | bm_src, | ||
BMFace * | f, | ||
const bool | copy_verts, | ||
const bool | copy_edges | ||
) |
Definition at line 279 of file bmesh_core.c.
References BLI_array_alloca, BLI_assert, BM_CREATE_NOP, BM_CREATE_SKIP_CD, BM_edge_create(), BM_elem_attrs_copy(), BM_face_create(), BM_FACE_FIRST_LOOP, BM_vert_create(), BMVert::co, BMLoop::e, BMFace::len, BMLoop::next, NULL, BMLoop::v, BMEdge::v1, v1, v2, and verts.
Referenced by BM_edge_split(), BM_face_split(), BM_face_split_n(), bmo_extrude_discrete_faces_exec(), bpy_bmface_copy(), tc_mesh_customdatacorrect_face_substitute_set(), and tc_mesh_customdatacorrect_init_vert().
BMFace* BM_face_create | ( | BMesh * | bm, |
BMVert ** | verts, | ||
BMEdge ** | edges, | ||
int | len, | ||
const BMFace * | f_example, | ||
eBMCreateFlag | create_flag | ||
) |
Main face creation function
bm | The mesh |
verts | A sorted array of verts size of len |
edges | A sorted array of edges size of len |
len | Length of the face |
create_flag | Options for creating the face |
Definition at line 395 of file bmesh_core.c.
References BLI_assert, bm, BM_CHECK_ELEMENT, BM_CREATE_NO_DOUBLE, BM_CREATE_SKIP_CD, BM_elem_attrs_copy(), BM_FACE, bm_face_boundary_add(), bm_face_create__internal(), BM_face_exists(), bm_loop_create(), bmesh_radial_loop_append(), copy_v3_v3(), CustomData_bmesh_set_default(), BMHeader::data, BMFace::head, BMHeader::htype, l, BMFace::len, len, BMLoop::next, BMFace::no, NULL, BMesh::pdata, BMLoop::prev, verts, and zero_v3().
Referenced by bm_edgenet_face_from_path(), BM_face_copy(), bm_face_copy_with_arrays(), bm_face_create_from_mpoly(), BM_face_create_ngon(), BM_face_create_verts(), bm_mesh_copy_new_face(), bmo_extrude_face_region_exec(), bmo_face_copy(), pbvh_bmesh_face_create(), and remdoubles_createface().
BLI_INLINE BMFace* bm_face_create__internal | ( | BMesh * | bm | ) |
only create the face, since this calloc's the length is initialized to 0, leave adding loops to the caller.
Definition at line 347 of file bmesh_core.c.
References BMHeader::api_flag, BLI_listbase_clear(), BLI_mempool_alloc(), BLI_mempool_calloc(), bm, BM_elem_index_set, BM_FACE, BM_SPACEARR_DIRTY_ALL, BMHeader::data, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMesh::fpool, BMesh::ftoolflagpool, BMFace::head, BMHeader::hflag, BMHeader::htype, BMFace::l_first, BMFace::len, BMFace::mat_nr, NULL, BMesh::spacearr_dirty, BMesh::totface, and BMesh::use_toolflags.
Referenced by BM_face_create(), and bm_face_create__sfme().
Definition at line 1316 of file bmesh_core.c.
References BLI_addtail(), BLI_mempool_calloc(), bm, BM_elem_attrs_copy(), and bm_face_create__internal().
Referenced by bmesh_kernel_split_face_make_edge().
BMFace* BM_face_create_verts | ( | BMesh * | bm, |
BMVert ** | vert_arr, | ||
int | len, | ||
const BMFace * | f_example, | ||
eBMCreateFlag | create_flag, | ||
bool | create_edges | ||
) |
Wrapper for BM_face_create when you don't have an edge array
Definition at line 464 of file bmesh_core.c.
References BLI_array_alloca, bm, BM_edges_from_verts(), BM_edges_from_verts_ensure(), BM_face_create(), len, and NULL.
Referenced by add_poly(), bev_create_ngon(), BM_face_create_quad_tri(), BM_face_split_edgenet(), BM_face_triangulate(), bm_log_faces_restore(), bmo_create_cube_exec(), bmo_create_grid_exec(), bmo_extrude_edge_only_exec(), bmo_extrude_face_region_exec(), bmo_inset_region_exec(), bpy_bmfaceseq_new(), bridge_loop_pair(), edbm_polybuild_face_at_cursor_invoke(), and edbm_tagged_loop_pairs_do_fill_faces().
Kills all edges associated with f, along with any other faces containing those edges.
Definition at line 794 of file bmesh_core.c.
References BLI_array_alloca, bm, BM_edge_kill(), BM_FACE_FIRST_LOOP, BMLoop::e, BMFace::len, and BMLoop::next.
Kills f and its loops.
Definition at line 828 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_CHECK_ELEMENT, bm_kill_only_face(), bm_kill_only_loop(), bmesh_radial_loop_remove(), BMLoop::e, BMFace::l_first, BMFace::len, and BMLoop::next.
Referenced by bevel_rebuild_existing_polygons(), BKE_mesh_remesh_voxel_fix_poles(), bm_decim_triangulate_begin(), BM_edge_kill(), bm_face_connect_verts(), BM_face_split(), bm_face_split_by_concave(), BM_face_split_edgenet(), BM_face_triangulate(), BM_faces_join(), bm_log_faces_unmake(), BM_mesh_triangulate(), bm_remove_tagged_faces(), bmesh_kernel_join_edge_kill_vert(), bmesh_kernel_join_vert_kill_edge(), bmo_dissolve_edges_exec(), bmo_dissolve_verts_exec(), bmo_holes_fill_exec(), bmo_poke_exec(), bmo_remove_tagged_faces(), bmo_spin_exec(), bmo_weld_verts_exec(), bpy_bmfaceseq_remove(), edbm_quads_convert_to_tris_exec(), pbvh_bmesh_collapse_edge(), pbvh_bmesh_split_edge(), and skin_fix_hole_no_good_verts().
A version of BM_face_kill which removes edges and verts which have no remaining connected geometry.
Definition at line 872 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_CHECK_ELEMENT, bm_kill_only_edge(), bm_kill_only_face(), bm_kill_only_loop(), bm_kill_only_vert(), bmesh_disk_edge_remove(), bmesh_radial_loop_remove(), BMVert::e, BMLoop::e, e, BMFace::l_first, BMLoop::next, NULL, v1, and v2.
Referenced by BM_mesh_intersect().
kills all verts associated with f, along with any other faces containing those vertices
Definition at line 811 of file bmesh_core.c.
References BLI_array_alloca, bm, BM_FACE_FIRST_LOOP, BM_vert_kill(), BMFace::len, BMLoop::next, BMLoop::v, and verts.
Referenced by BM_edge_split(), and BM_face_split_n().
Join Connected Faces.
Joins a collected group of faces into one. Only restriction on the input data is that the faces must be connected to each other.
Definition at line 1123 of file bmesh_core.c.
References _FLAG_JF, BLI_addtail(), BLI_array_alloca, BLI_array_append, BLI_array_free, BLI_array_len, BLI_array_staticdeclare, BLI_assert, BLI_movelisttolist(), BLI_remlink(), bm, BM_CHECK_ELEMENT, BM_CREATE_NOP, BM_DEFAULT_NGON_STACK_SIZE, BM_edge_face_count_is_over, BM_edge_kill(), BM_edge_other_vert(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_elem_attrs_copy(), bm_elements_systag_disable(), bm_elements_systag_enable(), BM_face_calc_center_median(), BM_face_create_ngon(), BM_FACE_FIRST_LOOP, BM_face_kill(), BM_loop_interp_multires_ex(), bm_loop_systag_count_radial(), bm_vert_is_manifold_flagged(), BM_vert_kill(), BMESH_ASSERT, CD_MDISPS, CustomData_get_offset(), BMLoop::e, error(), BMLoop::f, faces, float(), BMesh::ldata, BMLoop::next, NULL, BMLoop::radial_next, UNLIKELY, BMLoop::v, BMEdge::v1, v1, BMEdge::v2, and v2.
Referenced by bm_decim_triangulate_end(), bm_face_split_by_concave(), bm_face_split_by_edges_island_connect(), BM_faces_join_pair(), BM_vert_collapse_faces(), bmo_dissolve_faces_exec(), and bpy_bm_utils_face_join().
low level function, only frees the edge, doesn't change or adjust surrounding geometry
Definition at line 731 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_EDGE, BM_select_history_remove, BM_SPACEARR_DIRTY_ALL, CustomData_bmesh_free_block(), BMHeader::data, e, BMesh::edata, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMesh::epool, BMesh::etoolflagpool, BMVert::head, BMesh::spacearr_dirty, and BMesh::totedge.
Referenced by BM_edge_kill(), BM_face_kill_loose(), and bmesh_kernel_join_edge_kill_vert().
low level function, only frees the face, doesn't change or adjust surrounding geometry
Definition at line 754 of file bmesh_core.c.
References BMesh::act_face, BLI_mempool_free(), bm, BM_FACE, BM_select_history_remove, BM_SPACEARR_DIRTY_ALL, CustomData_bmesh_free_block(), BMHeader::data, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMesh::fpool, BMesh::ftoolflagpool, BMFace::head, NULL, BMesh::pdata, BMesh::spacearr_dirty, and BMesh::totface.
Referenced by BM_face_kill(), and BM_face_kill_loose().
low level function, only frees the loop, doesn't change or adjust surrounding geometry
Definition at line 781 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_LOOP, BM_SPACEARR_DIRTY_ALL, CustomData_bmesh_free_block(), BMHeader::data, BMesh::elem_index_dirty, BMLoop::head, l, BMesh::ldata, BMesh::lpool, BMesh::spacearr_dirty, and BMesh::totloop.
Referenced by BM_face_kill(), BM_face_kill_loose(), bmesh_kernel_join_edge_kill_vert(), and bmesh_kernel_join_vert_kill_edge().
low level function, only frees the vert, doesn't change or adjust surrounding geometry
Definition at line 708 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_select_history_remove, BM_SPACEARR_DIRTY_ALL, BM_VERT, CustomData_bmesh_free_block(), BMHeader::data, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMVert::head, BMesh::spacearr_dirty, BMesh::totvert, v, BMesh::vdata, BMesh::vpool, and BMesh::vtoolflagpool.
Referenced by BM_face_kill_loose(), BM_vert_kill(), bmesh_kernel_join_edge_kill_vert(), and bmesh_kernel_join_vert_kill_edge().
|
static |
Definition at line 193 of file bmesh_core.c.
References BMHeader::api_flag, BLI_assert, BLI_mempool_alloc(), bm, BM_CREATE_SKIP_CD, BM_elem_index_set, BM_LOOP, BM_SPACEARR_DIRTY_ALL, CustomData_bmesh_copy_data(), CustomData_bmesh_free_block_data(), CustomData_bmesh_set_default(), BMHeader::data, BMLoop::e, e, ELEM, BMesh::elem_index_dirty, BMLoop::f, BMLoop::head, BMHeader::hflag, BMHeader::htype, l, BMesh::ldata, BMesh::lpool, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, BMLoop::radial_prev, BMesh::spacearr_dirty, BMesh::totloop, BMLoop::v, and v.
Referenced by bm_face_boundary_add(), BM_face_create(), bmesh_kernel_split_edge_make_vert(), and bmesh_kernel_split_face_make_edge().
|
static |
return the length of the face, should always equal l->f->len
Definition at line 953 of file bmesh_core.c.
References l, and BMLoop::next.
|
static |
Definition at line 1061 of file bmesh_core.c.
References BM_ELEM_API_FLAG_TEST, BMLoop::f, l, and BMLoop::radial_next.
Referenced by BM_faces_join().
BMVert* BM_vert_create | ( | BMesh * | bm, |
const float | co[3], | ||
const BMVert * | v_example, | ||
const eBMCreateFlag | create_flag | ||
) |
Main function for creating a new vertex.
Definition at line 41 of file bmesh_core.c.
References BMHeader::api_flag, BLI_assert, BLI_mempool_alloc(), BLI_mempool_calloc(), bm, BM_CHECK_ELEMENT, BM_CREATE_NO_DOUBLE, BM_CREATE_SKIP_CD, BM_elem_attrs_copy(), BM_elem_index_set, BM_SPACEARR_DIRTY_ALL, BM_VERT, CD_SHAPE_KEYINDEX, BMVert::co, copy_v3_v3(), CustomData_bmesh_get(), CustomData_bmesh_set_default(), BMHeader::data, BMVert::e, BMesh::elem_index_dirty, BMesh::elem_table_dirty, BMVert::head, BMHeader::hflag, BMHeader::htype, BMVert::no, NULL, ORIGINDEX_NONE, BMesh::spacearr_dirty, BMesh::totvert, BMesh::use_toolflags, v, BMesh::vdata, BMesh::vpool, BMesh::vtoolflagpool, and zero_v3().
Referenced by BM_face_copy(), bm_face_split_edgenet_partial_connect(), bm_grid_fill_array(), bm_isect_edge_tri(), bm_log_verts_restore(), BM_mesh_bm_from_me(), BM_mesh_copy(), BM_mesh_wireframe(), bm_vert_copy(), bmesh_kernel_split_edge_make_vert(), bmesh_kernel_unglue_region_make_vert(), bmesh_kernel_unglue_region_make_vert_multi(), bmesh_kernel_unglue_region_make_vert_multi_isolated(), bmesh_kernel_vert_separate(), bmo_create_circle_exec(), bmo_create_cone_exec(), bmo_create_cube_exec(), bmo_create_grid_exec(), bmo_create_icosphere_exec(), bmo_create_monkey_exec(), bmo_create_uvsphere_exec(), bmo_create_vert_exec(), bmo_extrude_vert_indiv_exec(), bmo_face_inset_individual(), bmo_inset_region_exec(), bmo_poke_exec(), bmo_vert_copy(), bpy_bmvertseq_new(), create_mesh_bmvert(), edbm_polybuild_face_at_cursor_invoke(), knife_make_face_cuts(), output_frames(), pbvh_bmesh_vert_create(), skin_hole_detach_partially_attached_frame(), and TEST().
Return true when the vertex is manifold, attached to faces which are all flagged.
Definition at line 1092 of file bmesh_core.c.
References BM_edge_is_boundary(), BM_ELEM_API_FLAG_TEST, bmesh_disk_edge_next(), BMVert::e, BMLoop::e, e, BMLoop::f, l, BMLoop::radial_next, and v.
Referenced by BM_faces_join().
Kills v and all edges that use it.
Definition at line 939 of file bmesh_core.c.
References bm, BM_edge_kill(), bm_kill_only_vert(), BMVert::e, and v.
Referenced by BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(), bm_face_split_edgenet_partial_connect(), BM_face_verts_kill(), BM_faces_join(), bm_log_verts_unmake(), BM_mesh_bevel(), BM_mesh_decimate_dissolve_ex(), BM_mesh_intersect(), BM_mesh_wireframe(), bm_remove_tagged_verts(), bm_remove_tagged_verts_loose(), BM_vert_dissolve(), BM_vert_splice(), bmo_bisect_plane_exec(), bmo_create_cone_exec(), bmo_dissolve_edges_exec(), bmo_dissolve_verts_exec(), bmo_extrude_face_region_exec(), bmo_remove_tagged_verts(), bmo_remove_tagged_verts_loose(), bpy_bmvertseq_remove(), mesh_separate_arrays(), and pbvh_bmesh_collapse_edge().
void BM_vert_separate | ( | BMesh * | bm, |
BMVert * | v, | ||
BMEdge ** | e_in, | ||
int | e_in_len, | ||
bool | copy_select, | ||
BMVert *** | r_vout, | ||
int * | r_vout_len | ||
) |
High level function which wraps both bmesh_kernel_vert_separate and bmesh_kernel_edge_separate
Definition at line 2234 of file bmesh_core.c.
References BLI_assert, BLI_linklist_prepend_alloca, bm, bm_edge_supports_separate(), bmesh_kernel_edge_separate(), bmesh_kernel_vert_separate(), bmesh_kernel_vert_separate__cleanup(), BMLoop::e, e, NULL, and v.
Referenced by bpy_bm_utils_vert_separate(), and edbm_edge_split_selected_verts().
void BM_vert_separate_hflag | ( | BMesh * | bm, |
BMVert * | v, | ||
char | hflag, | ||
bool | copy_select, | ||
BMVert *** | r_vout, | ||
int * | r_vout_len | ||
) |
A version of BM_vert_separate which takes a flag.
Definition at line 2267 of file bmesh_core.c.
References BLI_assert, BLI_linklist_prepend_alloca, bm, BM_DISK_EDGE_NEXT, bm_edge_supports_separate(), BM_elem_flag_test, bmesh_kernel_edge_separate(), bmesh_kernel_vert_separate(), bmesh_kernel_vert_separate__cleanup(), BMVert::e, BMLoop::e, e, NULL, and v.
Referenced by BM_mesh_edgesplit().
void BM_vert_separate_tested_edges | ( | BMesh * | UNUSEDbm, |
BMVert * | v_dst, | ||
BMVert * | v_src, | ||
bool(*)(BMEdge *, void *arg) | testfn, | ||
void * | arg | ||
) |
Definition at line 2306 of file bmesh_core.c.
References BLI_linklist_prepend_alloca, BM_DISK_EDGE_NEXT, bmesh_disk_vert_replace(), BMVert::e, LinkNode::link, LinkNode::next, and NULL.
Referenced by bm_face_split_edgenet_partial_connect().
Splice Vert.
Merges two verts into one (v_src into v_dst, removing v_src).
Definition at line 2046 of file bmesh_core.c.
References BLI_assert, bm, BM_CHECK_ELEMENT, BM_vert_kill(), BM_vert_pair_share_face_check(), bmesh_edge_vert_swap(), BMVert::e, and e.
Referenced by bm_edge_collapse(), BM_face_split_edgenet_connect_islands(), BM_mesh_intersect(), bmo_inset_region_exec(), bmo_spin_exec(), bpy_bm_utils_vert_splice(), edbm_face_split_by_edges_exec(), and edbm_rip_invoke__vert().
Check if splicing vertices would create any double edges.
Definition at line 2003 of file bmesh_core.c.
References BLI_assert, BM_DISK_EDGE_NEXT, BM_edge_exists(), BM_edge_other_vert(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BMVert::e, e, and VERT_VISIT.
Referenced by BM_mesh_intersect().
|
static |
Definition at line 1072 of file bmesh_core.c.
References BM_ELEM_API_FLAG_TEST, bmesh_disk_edge_next(), BMVert::e, e, and v.
Definition at line 2615 of file bmesh_core.c.
References BLI_assert, BM_vert_in_edge(), bmesh_disk_vert_replace(), BMLoop::e, e, ELEM, BMLoop::next, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.
Referenced by bmesh_kernel_unglue_region_make_vert_multi_isolated().
int bmesh_elem_check | ( | void * | element, |
char | htype | ||
) |
Check the element is valid.
BMESH_TODO, when this raises an error the output is incredibly confusing. need to have some nice way to print/debug what the heck's going on.
Definition at line 487 of file bmesh_core.c.
References _FLAG_ELEM_CHECK, BLI_assert, BM_EDGE, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_FACE, BM_FACE_FIRST_LOOP, BM_LOOP, BM_NGON_MAX, BM_VERT, BM_vert_in_edge(), BMESH_ASSERT, bmesh_disk_count_at_most(), bmesh_radial_length(), bmesh_radial_validate(), BMVert::e, BMLoop::e, e, element, err, BMLoop::f, BMVert::head, BMEdge::head, BMFace::head, BMHeader::htype, l, BMFace::l_first, BMFace::len, len, BMLoop::next, NULL, BMLoop::radial_next, BMLoop::radial_prev, BMLoop::v, and v.
Avoid calling this where possible, low level function so both face pointers remain intact but point to swapped data.
Definition at line 2651 of file bmesh_core.c.
References BLI_assert, BM_FACE_FIRST_LOOP, BMHeader::data, BMLoop::f, BMFace::head, BMHeader::index, BMLoop::next, and SWAP.
Referenced by BM_face_split_edgenet(), BM_face_triangulate(), and bmo_weld_verts_exec().
Separate Edge.
Separates a single edge into two edge: the original edge and a new edge that has only l_sep in its radial.
Definition at line 2365 of file bmesh_core.c.
References BLI_assert, bm, BM_CHECK_ELEMENT, BM_CREATE_NOP, BM_edge_create(), BM_edge_is_boundary(), BM_elem_select_copy(), bmesh_radial_length(), bmesh_radial_loop_append(), bmesh_radial_loop_remove(), BMLoop::e, e, BMEdge::l, and BMLoop::radial_next.
Referenced by BM_vert_separate(), BM_vert_separate_hflag(), bmesh_kernel_unglue_region_make_vert(), and bmo_inset_region_exec().
BMEdge* bmesh_kernel_join_edge_kill_vert | ( | BMesh * | bm, |
BMEdge * | e_kill, | ||
BMVert * | v_kill, | ||
bool | do_del, | ||
bool | check_edge_exists, | ||
bool | kill_degenerate_faces, | ||
bool | kill_duplicate_faces | ||
) |
Takes an edge e_kill and pointer to one of its vertices v_kill and collapses the edge on that vertex.
Before: e_old e_kill +-------+-------+ | | | v_old v_kill v_target After: e_old +---------------+ | | v_old v_target
Definition at line 1631 of file bmesh_core.c.
References BLI_assert, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, bm, BM_CHECK_ELEMENT, BM_edge_exists(), BM_edge_other_vert(), BM_edge_splice(), BM_face_find_double(), BM_FACE_FIRST_LOOP, BM_face_kill(), bm_kill_only_edge(), bm_kill_only_loop(), bm_kill_only_vert(), BM_vert_in_edge(), BM_verts_in_edge(), BMESH_ASSERT, bmesh_disk_count(), bmesh_disk_count_at_most(), bmesh_disk_edge_next(), bmesh_disk_edge_remove(), bmesh_disk_validate(), bmesh_disk_vert_replace(), bmesh_loop_validate(), bmesh_radial_length(), bmesh_radial_validate(), BMVert::e, BMLoop::e, BMLoop::f, BMEdge::l, l, BMFace::len, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.
Referenced by BM_vert_collapse_edge(), BM_vert_collapse_faces(), and bmo_offset_edgeloops_exec().
Takes two faces joined by a single 2-manifold edge and fuses them together. The edge shared by the faces must not be connected to any other edges which have Both faces in its radial cycle
A B +--------+ +--------+ | | | | | f1 | | f1 | v1========v2 = Ok! v1==V2==v3 == Wrong! | f2 | | f2 | | | | | +--------+ +--------+
In the example A, faces f1 and f2 are joined by a single edge, and the euler can safely be used. In example B however, f1 and f2 are joined by multiple edges and will produce an error. The caller in this case should call bmesh_kernel_join_edge_kill_vert on the extra edges before attempting to fuse f1 and f2.
Definition at line 1881 of file bmesh_core.c.
References BLI_mempool_free(), bm, BM_CHECK_ELEMENT, BM_EDGE, BM_edge_in_face(), BM_edge_is_manifold(), BM_elem_flag_disable, BM_elem_flag_set, BM_elem_flag_test, BM_ELEM_INTERNAL_TAG, BM_FACE, BM_face_edge_share_loop(), BM_FACE_FIRST_LOOP, BM_face_share_edge_count(), BM_LOOP, BMESH_ASSERT, bmesh_disk_edge_remove(), bmesh_loop_validate(), BMLoop::e, e, BMesh::elem_index_dirty, BMesh::epool, BMesh::etoolflagpool, BMLoop::f, BMesh::fpool, BMesh::ftoolflagpool, BMFace::len, BMesh::lpool, BMLoop::next, NULL, BMLoop::prev, BMesh::totedge, BMesh::totface, BMesh::totloop, BMLoop::v, BMEdge::v1, and BMEdge::v2.
Referenced by bmo_extrude_face_region_exec().
BMVert* bmesh_kernel_join_vert_kill_edge | ( | BMesh * | bm, |
BMEdge * | e_kill, | ||
BMVert * | v_kill, | ||
bool | do_del, | ||
bool | check_edge_exists, | ||
bool | kill_degenerate_faces | ||
) |
Collapse an edge, merging surrounding data.
Unlike BM_vert_collapse_edge & bmesh_kernel_join_edge_kill_vert which only handle 2 valence verts, this can handle any number of connected edges/faces.
Before: -> After: +-+-+-+ +-+-+-+ | | | | | \ / | +-+-+-+ +--+--+ | | | | | / \ | +-+-+-+ +-+-+-+
Definition at line 1798 of file bmesh_core.c.
References BLI_assert, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, bm, BM_CHECK_ELEMENT, BM_edge_exists(), BM_edge_kill(), BM_edge_other_vert(), BM_edge_splice(), BM_FACE_FIRST_LOOP, BM_face_kill(), bm_kill_only_loop(), bm_kill_only_vert(), BM_vert_in_edge(), bmesh_edge_vert_swap(), BMVert::e, e, BMLoop::f, BMEdge::l, BMFace::len, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.
Referenced by BM_edge_collapse().
void bmesh_kernel_loop_reverse | ( | BMesh * | bm, |
BMFace * | f, | ||
int | cd_loop_mdisp_offset, | ||
bool | use_loop_mdisp_flip | ||
) |
Loop Reverse.
Changes the winding order of a face from CW to CCW or vice versa.
cd_loop_mdisp_offset | Cached result of CustomData_get_offset(&bm->ldata, CD_MDISPS) . |
use_loop_mdisp_flip | When set, flip the Z-depth of the mdisp, (use when flipping normals, disable when mirroring, eg: symmetrize). |
Definition at line 965 of file bmesh_core.c.
References BKE_mesh_mdisp_flip(), bm, BM_CHECK_ELEMENT, BM_ELEM_CD_GET_VOID_P, BM_LOOP, bmesh_radial_loop_append(), bmesh_radial_loop_remove(), BMLoop::e, BMesh::elem_index_dirty, BMLoop::f, BMEdge::l, BMFace::l_first, BMFace::len, BMLoop::next, BMLoop::prev, BMLoop::radial_next, BMLoop::radial_prev, SWAP, and BMLoop::v.
Referenced by BM_face_normal_flip_ex(), and BM_faces_join_pair().
Takes e edge and splits it into two, creating a new vert. tv should be one end of e : the newly created edge will be attached to that end and is returned in r_e.
E Before: OV-------------TV E RE After: OV------NV-----TV
Definition at line 1478 of file bmesh_core.c.
References BLI_assert, bm, BM_CHECK_ELEMENT, BM_CREATE_NOP, BM_edge_create(), BM_edge_other_vert(), bm_loop_create(), BM_vert_create(), BM_vert_in_edge(), BM_verts_in_edge(), BMESH_ASSERT, bmesh_disk_count(), bmesh_disk_edge_append(), bmesh_disk_edge_remove(), bmesh_disk_validate(), bmesh_disk_vert_replace(), bmesh_radial_length(), bmesh_radial_loop_append(), bmesh_radial_loop_unlink(), bmesh_radial_validate(), BMVert::co, BMVert::e, BMLoop::e, e, BMLoop::f, BMEdge::l, l, BMFace::len, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, BMLoop::radial_prev, and BMLoop::v.
Referenced by BM_edge_split(), and BM_face_split_n().
BMFace* bmesh_kernel_split_face_make_edge | ( | BMesh * | bm, |
BMFace * | f, | ||
BMLoop * | l_v1, | ||
BMLoop * | l_v2, | ||
BMLoop ** | r_l, | ||
BMEdge * | example, | ||
bool | no_double | ||
) |
Takes as input two vertices in a single face. An edge is created which divides the original face into two distinct regions. One of the regions is assigned to the original face and it is closed off. The second region has a new face assigned to it.
Before: After: +--------+ +--------+ | | | | | | | f1 | v1 f1 v2 v1======v2 | | | f2 | | | | | +--------+ +--------+
Definition at line 1339 of file bmesh_core.c.
References BLI_assert, BLI_mempool_free(), BLI_movelisttolist(), bm, BM_CHECK_ELEMENT, BM_CREATE_NO_DOUBLE, BM_CREATE_NOP, BM_edge_create(), bm_face_create__sfme(), BM_FACE_FIRST_LOOP, bm_loop_create(), bmesh_radial_loop_append(), e, BMLoop::f, BMFace::l_first, BMFace::len, BMLoop::next, NULL, BMLoop::prev, BMLoop::v, v1, and v2.
Referenced by BM_face_split(), and BM_face_split_n().
Un-glue Region Make Vert (URMV)
Disconnects a face from its vertex fan at loop l_sep
Definition at line 2400 of file bmesh_core.c.
References ARRAY_SIZE, BLI_assert, bm, BM_CHECK_ELEMENT, BM_CREATE_NOP, BM_edge_is_boundary(), BM_vert_create(), BM_vert_edge_count_is_equal, bmesh_disk_edge_next(), bmesh_edge_vert_swap(), bmesh_kernel_edge_separate(), BMVert::co, BMVert::e, BMLoop::e, e, ELEM, NULL, BMLoop::prev, and BMLoop::v.
Referenced by BM_face_loop_separate().
A version of bmesh_kernel_unglue_region_make_vert that disconnects multiple loops at once. The loops must all share the same vertex, can be in any order and are all moved to use a single new vertex - which is returned.
This function handles the details of finding fans boundaries.
Definition at line 2462 of file bmesh_core.c.
References ARRAY_SIZE, BLI_array_alloca, BLI_assert, bm, BM_CREATE_NOP, BM_edge_create(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_vert_create(), bmesh_disk_edge_next(), bmesh_disk_vert_replace(), bmesh_radial_loop_append(), bmesh_radial_loop_remove(), BMVert::co, BMVert::e, BMLoop::e, e, EDGE_VISIT, BMEdge::l, LOOP_VISIT, BMLoop::next, BMLoop::prev, BMLoop::radial_next, STACK_DECLARE, STACK_INIT, STACK_PUSH, STACK_SIZE, UNPACK2, and BMLoop::v.
Referenced by BM_face_loop_separate_multi().
This function assumes l_sep is a part of a larger fan which has already been isolated by calling bmesh_kernel_edge_separate to segregate it radially.
Definition at line 2642 of file bmesh_core.c.
References BLI_assert, bm, BM_CREATE_NOP, BM_vert_create(), bmesh_edge_vert_swap__recursive(), BMVert::co, BMLoop::e, and BMLoop::v.
Referenced by BM_face_loop_separate_multi_isolated().
void bmesh_kernel_vert_separate | ( | BMesh * | bm, |
BMVert * | v, | ||
BMVert *** | r_vout, | ||
int * | r_vout_len, | ||
bool | copy_select | ||
) |
Separate Vert.
BMesh Kernel: For modifying structure.
Names are on the verbose side but these are only for low-level access.
Separates all disjoint fans that meet at a vertex, making a unique vertex for each region. returns an array of all resulting vertices.
Definition at line 2082 of file bmesh_core.c.
References BLI_assert, BLI_SMALLSTACK_AS_TABLE, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, bm, BM_CREATE_NOP, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_elem_select_copy(), BM_vert_create(), BM_vert_in_edge(), bmesh_disk_edge_next(), bmesh_edge_vert_swap(), BMVert::co, BMVert::e, BMLoop::e, e, EDGE_VISIT, MEM_mallocN, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, BMLoop::v, v, and verts.
Referenced by BM_vert_separate(), BM_vert_separate_hflag(), bmo_inset_region_exec(), and edbm_rip_invoke__vert().
Utility function for BM_vert_separate
Takes a list of edges, which have been split from their original.
Any edges which failed to split off in bmesh_kernel_vert_separate will be merged back into the original edge.
edges_separate | A list-of-lists, each list is from a single original edge (the first edge is the original), Check for duplicates (not just with the first) but between all. This is O(n2) but radial edges are very rarely >2 and almost never >~10. |
Definition at line 2210 of file bmesh_core.c.
References BLI_assert, bm, BM_edge_splice(), e, LinkNode::link, LinkNode::next, BMEdge::v1, and BMEdge::v2.
Referenced by BM_vert_separate(), and BM_vert_separate_hflag().