Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_sort_utils.h"
#include "BKE_customdata.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
Go to the source code of this file.
Macros | |
#define | SELECT 1 |
Functions | |
bool | BM_verts_from_edges (BMVert **vert_arr, BMEdge **edge_arr, const int len) |
bool | BM_edges_from_verts (BMEdge **edge_arr, BMVert **vert_arr, const int len) |
void | BM_edges_from_verts_ensure (BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, const int len) |
static void | bm_loop_attrs_copy (BMesh *bm_src, BMesh *bm_dst, const BMLoop *l_src, BMLoop *l_dst, eCustomDataMask mask_exclude) |
BMFace * | BM_face_create_quad_tri (BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag) |
Make Quad/Triangle. More... | |
void | BM_face_copy_shared (BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data) |
copies face loop data from shared adjacent faces. More... | |
static bool | bm_edges_sort_winding (BMVert *v1, BMVert *v2, BMEdge **edges, const int len, BMEdge **edges_sort, BMVert **verts_sort) |
BMFace * | BM_face_create_ngon (BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag) |
Make NGon. More... | |
BMFace * | BM_face_create_ngon_verts (BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool calc_winding, const bool create_edges) |
void | BM_verts_sort_radial_plane (BMVert **vert_arr, int len) |
static void | bm_vert_attrs_copy (BMesh *bm_src, BMesh *bm_dst, const BMVert *v_src, BMVert *v_dst, eCustomDataMask mask_exclude) |
static void | bm_edge_attrs_copy (BMesh *bm_src, BMesh *bm_dst, const BMEdge *e_src, BMEdge *e_dst, eCustomDataMask mask_exclude) |
static void | bm_face_attrs_copy (BMesh *bm_src, BMesh *bm_dst, const BMFace *f_src, BMFace *f_dst, eCustomDataMask mask_exclude) |
void | BM_elem_attrs_copy_ex (BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v, const char hflag_mask, const uint64_t cd_mask_exclude) |
void | BM_elem_attrs_copy (BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst) |
void | BM_elem_select_copy (BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v) |
static BMFace * | bm_mesh_copy_new_face (BMesh *bm_new, BMesh *bm_old, BMVert **vtable, BMEdge **etable, BMFace *f) |
void | BM_mesh_copy_init_customdata_from_mesh_array (BMesh *bm_dst, const Mesh *me_src_array[], const int me_src_array_len, const BMAllocTemplate *allocsize) |
void | BM_mesh_copy_init_customdata_from_mesh (BMesh *bm_dst, const Mesh *me_src, const BMAllocTemplate *allocsize) |
void | BM_mesh_copy_init_customdata (BMesh *bm_dst, BMesh *bm_src, const BMAllocTemplate *allocsize) |
void | BM_mesh_copy_init_customdata_all_layers (BMesh *bm_dst, BMesh *bm_src, const char htype, const BMAllocTemplate *allocsize) |
BMesh * | BM_mesh_copy (BMesh *bm_old) |
char | BM_vert_flag_from_mflag (const char mflag) |
char | BM_edge_flag_from_mflag (const short mflag) |
char | BM_face_flag_from_mflag (const char mflag) |
char | BM_vert_flag_to_mflag (BMVert *v) |
short | BM_edge_flag_to_mflag (BMEdge *e) |
char | BM_face_flag_to_mflag (BMFace *f) |
BM construction functions.
Definition in file bmesh_construct.c.
#define SELECT 1 |
Definition at line 24 of file bmesh_construct.c.
|
static |
Definition at line 341 of file bmesh_construct.c.
References BLI_assert_msg, CustomData_bmesh_copy_data_exclude_by_type(), CustomData_bmesh_free_block_data_exclude_by_type(), BMHeader::data, BMesh::edata, and BMEdge::head.
Referenced by BM_elem_attrs_copy_ex().
char BM_edge_flag_from_mflag | ( | const short | mflag | ) |
Definition at line 719 of file bmesh_construct.c.
References BM_ELEM_DRAW, BM_ELEM_HIDDEN, BM_ELEM_SEAM, BM_ELEM_SELECT, BM_ELEM_SMOOTH, ME_EDGEDRAW, ME_HIDE, ME_SEAM, ME_SHARP, and SELECT.
Referenced by BM_mesh_bm_from_me().
short BM_edge_flag_to_mflag | ( | BMEdge * | e | ) |
Definition at line 739 of file bmesh_construct.c.
References BM_edge_is_wire(), BM_ELEM_DRAW, BM_ELEM_HIDDEN, BM_ELEM_SEAM, BM_ELEM_SELECT, BM_ELEM_SMOOTH, e, BMVert::head, BMHeader::hflag, ME_EDGEDRAW, ME_EDGERENDER, ME_HIDE, ME_LOOSEEDGE, ME_SEAM, ME_SHARP, and SELECT.
Referenced by BM_mesh_bm_to_me(), and BM_mesh_bm_to_me_for_eval().
Fill in an edge array from a vertex array (connected polygon loop).
Definition at line 39 of file bmesh_construct.c.
References BM_edge_exists(), len, and NULL.
Referenced by bm_edgenet_face_from_path(), and BM_face_create_verts().
Fill in an edge array from a vertex array (connected polygon loop). Creating edges as-needed.
Definition at line 52 of file bmesh_construct.c.
References bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), len, and NULL.
Referenced by BM_face_create_verts().
|
static |
Given an array of edges, order them using the winding defined by v1 & v2 into edges_sort & verts_sort.
All arrays must be len long.
Definition at line 136 of file bmesh_construct.c.
References _FLAG_MF, _FLAG_MV, BM_edge_other_vert(), BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, bmesh_disk_edge_next(), error(), len, UNLIKELY, v1, and v2.
Referenced by BM_face_create_ngon().
Definition at line 439 of file bmesh_construct.c.
References BM_elem_attrs_copy_ex(), and BM_ELEM_SELECT.
Referenced by bev_create_ngon(), bev_rebuild_polygon(), bevel_build_edge_polygons(), bm_edge_copy_with_arrays(), BM_edge_create(), BM_edge_split(), bm_extrude_copy_face_loop_attributes(), BM_face_copy(), bm_face_copy_shared_all(), bm_face_copy_with_arrays(), BM_face_create(), bm_face_create__sfme(), BM_face_interp_from_face_ex(), BM_face_triangulate(), BM_faces_join(), bm_grid_fill_array(), bm_mesh_copy_new_face(), BM_mesh_wireframe(), bm_vert_copy(), BM_vert_create(), bmo_edge_copy(), bmo_extrude_discrete_faces_exec(), bmo_face_copy(), bmo_face_inset_individual(), bmo_inset_region_exec(), bmo_poke_exec(), bmo_vert_copy(), bpy_bmedgeseq_new(), bpy_bmvertseq_new(), bridge_loop_pair(), edbm_tagged_loop_pairs_do_fill_faces(), remdoubles_createface(), tc_mesh_customdatacorrect_restore(), and weld_cross_attrs_copy().
void BM_elem_attrs_copy_ex | ( | BMesh * | bm_src, |
BMesh * | bm_dst, | ||
const void * | ele_src_v, | ||
void * | ele_dst_v, | ||
char | hflag_mask, | ||
uint64_t | cd_mask_exclude | ||
) |
Copies attributes, e.g. customdata, header flags, etc, from one element to another of the same type.
Definition at line 381 of file bmesh_construct.c.
References BLI_assert, BM_EDGE, bm_edge_attrs_copy(), BM_elem_flag_test, BM_ELEM_SELECT, BM_elem_select_set(), BM_FACE, bm_face_attrs_copy(), BM_LOOP, bm_loop_attrs_copy(), BM_VERT, bm_vert_attrs_copy(), BMHeader::hflag, and BMHeader::htype.
Referenced by BM_elem_attrs_copy(), BM_mesh_copy(), bm_mesh_copy_new_face(), and bpy_bm_elem_copy_from().
Definition at line 445 of file bmesh_construct.c.
References BLI_assert, BM_ELEM_SELECT, BM_elem_select_set(), BMHeader::hflag, and BMHeader::htype.
Referenced by bmesh_kernel_edge_separate(), and bmesh_kernel_vert_separate().
|
static |
Definition at line 365 of file bmesh_construct.c.
References BLI_assert_msg, CD_MASK_NORMAL, copy_v3_v3(), CustomData_bmesh_copy_data_exclude_by_type(), CustomData_bmesh_free_block_data_exclude_by_type(), BMHeader::data, BMFace::head, BMFace::mat_nr, BMFace::no, and BMesh::pdata.
Referenced by BM_elem_attrs_copy_ex().
void BM_face_copy_shared | ( | BMesh * | bm, |
BMFace * | f, | ||
BMLoopFilterFunc | filter_fn, | ||
void * | user_data | ||
) |
copies face loop data from shared adjacent faces.
filter_fn | A function that filters the source loops before copying (don't always want to copy all). |
Definition at line 81 of file bmesh_construct.c.
References _FLAG_OVERLAP, BLI_assert, bm, BM_ELEM_API_FLAG_DISABLE, BM_ELEM_API_FLAG_ENABLE, BM_ELEM_API_FLAG_TEST, BM_FACE_FIRST_LOOP, bm_loop_attrs_copy(), BMLoop::next, NULL, BMLoop::radial_next, user_data, BMLoop::v, and v.
Referenced by bm_face_copy_shared_all(), bmo_contextual_create_exec(), and bmo_inset_region_exec().
BMFace* BM_face_create_ngon | ( | BMesh * | bm, |
BMVert * | v1, | ||
BMVert * | v2, | ||
BMEdge ** | edges, | ||
int | len, | ||
const BMFace * | f_example, | ||
eBMCreateFlag | create_flag | ||
) |
Make NGon.
Makes an ngon from an unordered list of edges. Verts v1 and v2 define the winding of the new face.
edges are not required to be ordered, simply to form a single closed loop as a whole.
Definition at line 212 of file bmesh_construct.c.
References BLI_array_alloca, BLI_assert, bm, bm_edges_sort_winding(), BM_face_create(), len, NULL, v1, and v2.
Referenced by BM_face_create_ngon_verts(), and BM_faces_join().
BMFace* BM_face_create_ngon_verts | ( | BMesh * | bm, |
BMVert ** | vert_arr, | ||
int | len, | ||
const BMFace * | f_example, | ||
eBMCreateFlag | create_flag, | ||
bool | calc_winding, | ||
bool | create_edges | ||
) |
Create an ngon from an array of sorted verts
Special features this has over other functions.
Definition at line 232 of file bmesh_construct.c.
References BLI_array_alloca, BLI_assert, bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), BM_edge_exists(), BM_edge_ordered_verts(), BM_face_create_ngon(), ELEM, l, len, and NULL.
Referenced by bmo_contextual_create_exec(), and bmo_edgeloop_fill_exec().
BMFace* BM_face_create_quad_tri | ( | BMesh * | bm, |
BMVert * | v1, | ||
BMVert * | v2, | ||
BMVert * | v3, | ||
BMVert * | v4, | ||
const BMFace * | f_example, | ||
eBMCreateFlag | create_flag | ||
) |
Make Quad/Triangle.
Creates a new quad or triangle from a list of 3 or 4 vertices. If no_double is true, then a check is done to see if a face with these vertices already exists and returns it instead.
If a pointer to an example face is provided, its custom data and properties will be copied to the new face.
Definition at line 69 of file bmesh_construct.c.
References bm, BM_face_create_verts(), v1, and v2.
Referenced by bm_grid_fill_array(), BM_mesh_wireframe(), bmo_create_circle_exec(), bmo_create_cone_exec(), bmo_create_icosphere_exec(), bmo_create_monkey_exec(), bmo_extrude_discrete_faces_exec(), bmo_face_inset_individual(), bmo_poke_exec(), and bmo_triangle_fill_exec().
char BM_face_flag_from_mflag | ( | const char | mflag | ) |
Definition at line 726 of file bmesh_construct.c.
References BM_ELEM_HIDDEN, BM_ELEM_SELECT, BM_ELEM_SMOOTH, ME_FACE_SEL, ME_HIDE, and ME_SMOOTH.
Referenced by BM_mesh_bm_from_me().
char BM_face_flag_to_mflag | ( | BMFace * | f | ) |
Definition at line 750 of file bmesh_construct.c.
References BM_ELEM_HIDDEN, BM_ELEM_SELECT, BM_ELEM_SMOOTH, BMFace::head, BMHeader::hflag, ME_FACE_SEL, ME_HIDE, and ME_SMOOTH.
Referenced by BM_mesh_bm_to_me(), and BM_mesh_bm_to_me_for_eval().
|
static |
Definition at line 353 of file bmesh_construct.c.
References BLI_assert_msg, CustomData_bmesh_copy_data_exclude_by_type(), CustomData_bmesh_free_block_data_exclude_by_type(), BMHeader::data, BMLoop::head, and BMesh::ldata.
Referenced by BM_elem_attrs_copy_ex(), and BM_face_copy_shared().
Definition at line 597 of file bmesh_construct.c.
References BMesh::act_face, BLI_assert, BM_CREATE_SKIP_CD, BM_EDGE, BM_edge_create(), BM_EDGES_OF_MESH, BM_elem_attrs_copy_ex(), BM_elem_index_get, BM_elem_index_set, BM_FACE, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_mesh_copy_init_customdata(), bm_mesh_copy_new_face(), BM_mesh_create(), BM_select_history_store, BM_VERT, BM_vert_create(), BM_VERTS_OF_MESH, BMALLOC_TEMPLATE_FROM_BM, BMVert::co, e, BMEditSelection::ele, BMesh::elem_index_dirty, ListBase::first, BMVert::head, BMEdge::head, BMHeader::hflag, BMEditSelection::htype, MEM_freeN, MEM_mallocN, BMEditSelection::next, NULL, BMesh::selected, BMesh::selectmode, BMesh::shapenr, BMesh::totedge, BMesh::totedgesel, BMesh::totface, BMesh::totfacesel, BMesh::totvert, BMesh::totvertsel, BMesh::use_toolflags, and v.
Referenced by BKE_editmesh_copy(), bpy_bmesh_copy(), EDBM_automerge_and_split(), EDBM_redo_state_restore(), and EDBM_redo_state_store().
void BM_mesh_copy_init_customdata | ( | BMesh * | bm_dst, |
BMesh * | bm_src, | ||
const BMAllocTemplate * | allocsize | ||
) |
Definition at line 547 of file bmesh_construct.c.
References BM_EDGE, BM_FACE, BM_LOOP, bm_mesh_allocsize_default, BM_VERT, CD_CALLOC, CD_MASK_BMESH, CustomData_bmesh_init_pool(), CustomData_copy(), BMesh::edata, CustomData_MeshMasks::emask, BMesh::ldata, CustomData_MeshMasks::lmask, NULL, BMesh::pdata, CustomData_MeshMasks::pmask, BMAllocTemplate::totedge, BMAllocTemplate::totface, BMAllocTemplate::totloop, BMAllocTemplate::totvert, BMesh::vdata, and CustomData_MeshMasks::vmask.
Referenced by BM_mesh_copy(), mesh_separate_arrays(), and mesh_separate_tagged().
void BM_mesh_copy_init_customdata_all_layers | ( | BMesh * | bm_dst, |
BMesh * | bm_src, | ||
const char | htype, | ||
const BMAllocTemplate * | allocsize | ||
) |
Definition at line 564 of file bmesh_construct.c.
References BLI_assert, BM_EDGE, BM_FACE, BM_LOOP, bm_mesh_allocsize_default, BM_VERT, CD_CALLOC, CustomData_add_layer_named(), CustomData_bmesh_init_pool(), BMesh::edata, l, BMesh::ldata, NULL, BMesh::pdata, size(), src, BMAllocTemplate::totedge, BMAllocTemplate::totface, BMAllocTemplate::totloop, BMAllocTemplate::totvert, and BMesh::vdata.
Referenced by mesh_separate_arrays(), and tc_mesh_customdatacorrect_init_container_generic().
void BM_mesh_copy_init_customdata_from_mesh | ( | BMesh * | bm_dst, |
const Mesh * | me_src, | ||
const BMAllocTemplate * | allocsize | ||
) |
Definition at line 540 of file bmesh_construct.c.
References BM_mesh_copy_init_customdata_from_mesh_array().
void BM_mesh_copy_init_customdata_from_mesh_array | ( | BMesh * | bm_dst, |
const Mesh * | me_src_array[], | ||
const int | me_src_array_len, | ||
const BMAllocTemplate * | allocsize | ||
) |
Definition at line 500 of file bmesh_construct.c.
References BM_EDGE, BM_FACE, BM_LOOP, bm_mesh_allocsize_default, BM_mesh_cd_flag_apply(), BM_mesh_cd_flag_from_bmesh(), BM_VERT, CD_CALLOC, Mesh::cd_flag, CD_MASK_BMESH, CustomData_bmesh_init_pool(), CustomData_copy(), CustomData_merge(), BMesh::edata, Mesh::edata, CustomData_MeshMasks::emask, BMesh::ldata, Mesh::ldata, CustomData_MeshMasks::lmask, NULL, BMesh::pdata, Mesh::pdata, CustomData_MeshMasks::pmask, BMAllocTemplate::totedge, BMAllocTemplate::totface, BMAllocTemplate::totloop, BMAllocTemplate::totvert, BMesh::vdata, Mesh::vdata, and CustomData_MeshMasks::vmask.
Referenced by BM_mesh_copy_init_customdata_from_mesh(), and BMD_mesh_bm_create().
|
static |
Definition at line 458 of file bmesh_construct.c.
References BLI_array_alloca, BM_CREATE_SKIP_CD, BM_elem_attrs_copy(), BM_elem_attrs_copy_ex(), BM_elem_index_get, BM_elem_index_set, BM_face_create(), BM_FACE_FIRST_LOOP, BMLoop::e, BMFace::head, BMHeader::hflag, BMFace::len, BMLoop::next, NULL, BMesh::totface, UNLIKELY, BMLoop::v, and verts.
Referenced by BM_mesh_copy().
|
static |
Definition at line 326 of file bmesh_construct.c.
References BLI_assert_msg, CD_MASK_NORMAL, copy_v3_v3(), CustomData_bmesh_copy_data_exclude_by_type(), CustomData_bmesh_free_block_data_exclude_by_type(), BMHeader::data, BMVert::head, BMVert::no, and BMesh::vdata.
Referenced by BM_elem_attrs_copy_ex().
char BM_vert_flag_from_mflag | ( | const char | mflag | ) |
Definition at line 715 of file bmesh_construct.c.
References BM_ELEM_HIDDEN, BM_ELEM_SELECT, ME_HIDE, and SELECT.
Referenced by BM_mesh_bm_from_me().
char BM_vert_flag_to_mflag | ( | BMVert * | v | ) |
Definition at line 732 of file bmesh_construct.c.
References BM_ELEM_HIDDEN, BM_ELEM_SELECT, BMVert::head, BMHeader::hflag, ME_HIDE, SELECT, and v.
Referenced by BM_mesh_bm_to_me(), and BM_mesh_bm_to_me_for_eval().
Fill in a vertex array from an edge array.
Definition at line 26 of file bmesh_construct.c.
References BM_edge_share_vert(), len, and NULL.
Referenced by BM_face_exists_multi_edge().
Makes an NGon from an un-ordered set of verts.
Assumes:
There can be concave areas but overlapping folds from the center point will fail.
A brief explanation of the method used
Definition at line 297 of file bmesh_construct.c.
References angle_signed_on_axis_v3v3v3_v3(), BLI_array_alloca, BLI_sortutil_cmp_float(), BM_verts_calc_normal_from_cloud_ex(), BMVert::co, SortIntByFloat::data, len, nor, and SortIntByFloat::sort_value.
Referenced by bmo_contextual_create_exec().