Blender  V2.93
Functions
bmesh_construct.h File Reference
#include "bmesh_core.h"

Go to the source code of this file.

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)
 
void BM_verts_sort_radial_plane (BMVert **vert_arr, int len)
 
BMFaceBM_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...
 
BMFaceBM_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...
 
BMFaceBM_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_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_v, void *ele_dst_v)
 
void BM_elem_select_copy (BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v)
 
void BM_mesh_copy_init_customdata_from_mesh (BMesh *bm_dst, const struct Mesh *me_src, const struct BMAllocTemplate *allocsize)
 
void BM_mesh_copy_init_customdata (BMesh *bm_dst, BMesh *bm_src, const struct BMAllocTemplate *allocsize)
 
void BM_mesh_copy_init_customdata_all_layers (BMesh *bm_dst, BMesh *bm_src, const char htype, const struct BMAllocTemplate *allocsize)
 
BMeshBM_mesh_copy (BMesh *bm_old)
 
char BM_face_flag_from_mflag (const char mflag)
 
char BM_edge_flag_from_mflag (const short mflag)
 
char BM_vert_flag_from_mflag (const char mflag)
 
char BM_face_flag_to_mflag (BMFace *f)
 
short BM_edge_flag_to_mflag (BMEdge *e)
 
char BM_vert_flag_to_mflag (BMVert *v)
 

Function Documentation

◆ BM_edge_flag_from_mflag()

char BM_edge_flag_from_mflag ( const short  mflag)

◆ BM_edge_flag_to_mflag()

short BM_edge_flag_to_mflag ( BMEdge e)

◆ BM_edges_from_verts()

bool BM_edges_from_verts ( BMEdge **  edge_arr,
BMVert **  vert_arr,
const int  len 
)

Fill in an edge array from a vertex array (connected polygon loop).

Returns
false if any edges aren't found.

Definition at line 65 of file bmesh_construct.c.

References BM_edge_exists(), len, and NULL.

Referenced by bm_edgenet_face_from_path(), and BM_face_create_verts().

◆ BM_edges_from_verts_ensure()

void BM_edges_from_verts_ensure ( BMesh bm,
BMEdge **  edge_arr,
BMVert **  vert_arr,
const int  len 
)

Fill in an edge array from a vertex array (connected polygon loop). Creating edges as-needed.

Definition at line 82 of file bmesh_construct.c.

References bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), len, and NULL.

Referenced by BM_face_create_verts().

◆ BM_elem_attrs_copy()

void BM_elem_attrs_copy ( BMesh bm_src,
BMesh bm_dst,
const void *  ele_src_v,
void *  ele_dst_v 
)

◆ BM_elem_attrs_copy_ex()

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 
)

Copies attributes, e.g. customdata, header flags, etc, from one element to another of the same type.

Definition at line 477 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().

◆ BM_elem_select_copy()

void BM_elem_select_copy ( BMesh bm_dst,
void *  ele_dst_v,
const void *  ele_src_v 
)

◆ BM_face_copy_shared()

void BM_face_copy_shared ( BMesh bm,
BMFace f,
BMLoopFilterFunc  filter_fn,
void *  user_data 
)

copies face loop data from shared adjacent faces.

Parameters
filter_fnA function that filters the source loops before copying (don't always want to copy all).
Note
when a matching edge is found, both loops of that edge are copied this is done since the face may not be completely surrounded by faces, this way: a quad with 2 connected quads on either side will still get all 4 loops updated

Definition at line 132 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().

◆ BM_face_create_ngon()

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.

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.

Note
While this function will work fine when the edges are already sorted, if the edges are always going to be sorted, BM_face_create should be considered over this function as it avoids some unnecessary work.

Definition at line 277 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().

◆ BM_face_create_ngon_verts()

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 
)

Create an ngon from an array of sorted verts

Special features this has over other functions.

  • Optionally calculate winding based on surrounding edges.
  • Optionally create edges between vertices.
  • Uses verts so no need to find edges (handy when you only have verts)

Definition at line 305 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().

◆ BM_face_create_quad_tri()

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.

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.

Note
The winding of the face is determined by the order of the vertices in the vertex array.

Definition at line 110 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().

◆ BM_face_flag_from_mflag()

char BM_face_flag_from_mflag ( const char  mflag)

Definition at line 801 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().

◆ BM_face_flag_to_mflag()

char BM_face_flag_to_mflag ( BMFace f)

◆ BM_mesh_copy()

BMesh* BM_mesh_copy ( BMesh bm_old)

◆ BM_mesh_copy_init_customdata()

void BM_mesh_copy_init_customdata ( BMesh bm_dst,
BMesh bm_src,
const struct BMAllocTemplate allocsize 
)

◆ BM_mesh_copy_init_customdata_all_layers()

void BM_mesh_copy_init_customdata_all_layers ( BMesh bm_dst,
BMesh bm_src,
const char  htype,
const struct BMAllocTemplate allocsize 
)

◆ BM_mesh_copy_init_customdata_from_mesh()

void BM_mesh_copy_init_customdata_from_mesh ( BMesh bm_dst,
const struct Mesh me_src,
const struct BMAllocTemplate allocsize 
)

◆ BM_vert_flag_from_mflag()

char BM_vert_flag_from_mflag ( const char  mflag)

Definition at line 790 of file bmesh_construct.c.

References BM_ELEM_HIDDEN, BM_ELEM_SELECT, ME_HIDE, and SELECT.

Referenced by BM_mesh_bm_from_me().

◆ BM_vert_flag_to_mflag()

char BM_vert_flag_to_mflag ( BMVert v)

◆ BM_verts_from_edges()

bool BM_verts_from_edges ( BMVert **  vert_arr,
BMEdge **  edge_arr,
const int  len 
)

Fill in a vertex array from an edge array.

Returns
false if any verts aren't found.

Definition at line 47 of file bmesh_construct.c.

References BM_edge_share_vert(), len, and NULL.

Referenced by BM_face_exists_multi_edge().

◆ BM_verts_sort_radial_plane()

void BM_verts_sort_radial_plane ( BMVert **  vert_arr,
int  len 
)

Makes an NGon from an un-ordered set of verts

assumes...

  • that verts are only once in the list.
  • that the verts have roughly planer bounds
  • that the verts are roughly circular there can be concave areas but overlapping folds from the center point will fail.

a brief explanation of the method used

  • find the center point
  • find the normal of the vcloud
  • order the verts around the face based on their angle to the normal vector at the center point.
Note
Since this is a vcloud there is no direction.

Definition at line 386 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().