Blender  V3.3
Functions
bmesh_structure.h File Reference
#include "intern/bmesh_structure_inline.h"

Go to the source code of this file.

Functions

bool bmesh_loop_validate (BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void bmesh_disk_edge_append (BMEdge *e, BMVert *v) ATTR_NONNULL()
 
void bmesh_disk_edge_remove (BMEdge *e, BMVert *v) ATTR_NONNULL()
 
BLI_INLINE BMEdgebmesh_disk_edge_next_safe (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BLI_INLINE BMEdgebmesh_disk_edge_prev_safe (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BLI_INLINE BMEdgebmesh_disk_edge_next (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BLI_INLINE BMEdgebmesh_disk_edge_prev (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
int bmesh_disk_facevert_count_at_most (const BMVert *v, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
int bmesh_disk_facevert_count (const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 DISK COUNT FACE VERT. More...
 
BMEdgebmesh_disk_faceedge_find_first (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 FIND FIRST FACE EDGE. More...
 
BMLoopbmesh_disk_faceloop_find_first (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BMLoopbmesh_disk_faceloop_find_first_visible (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BMEdgebmesh_disk_faceedge_find_next (const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void bmesh_radial_loop_append (BMEdge *e, BMLoop *l) ATTR_NONNULL()
 
void bmesh_radial_loop_remove (BMEdge *e, BMLoop *l) ATTR_NONNULL()
 BMESH RADIAL REMOVE LOOP. More...
 
void bmesh_radial_loop_unlink (BMLoop *l) ATTR_NONNULL()
 
int bmesh_radial_facevert_count_at_most (const BMLoop *l, const BMVert *v, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
int bmesh_radial_facevert_count (const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 RADIAL COUNT FACE VERT. More...
 
bool bmesh_radial_facevert_check (const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 RADIAL CHECK FACE VERT. More...
 
BMLoopbmesh_radial_faceloop_find_first (const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 BME RADIAL FIND FIRST FACE VERT. More...
 
BMLoopbmesh_radial_faceloop_find_next (const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BMLoopbmesh_radial_faceloop_find_vert (const BMFace *f, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
bool bmesh_radial_validate (int radlen, BMLoop *l) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void bmesh_disk_vert_swap (BMEdge *e, BMVert *v_dst, BMVert *v_src) ATTR_NONNULL()
 
void bmesh_edge_vert_swap (BMEdge *e, BMVert *v_dst, BMVert *v_src) ATTR_NONNULL()
 
void bmesh_disk_vert_replace (BMEdge *e, BMVert *v_dst, BMVert *v_src) ATTR_NONNULL()
 
BMEdgebmesh_disk_edge_exists (const BMVert *v1, const BMVert *v2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
bool bmesh_disk_validate (int len, BMEdge *e, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 

Detailed Description

The lowest level of functionality for manipulating bmesh structures. None of these functions should ever be exported to the rest of Blender.

in the vast majority of cases there shouldn't be used directly. if absolutely necessary, see function definitions in code for descriptive comments. but seriously, don't use this stuff.

Definition in file bmesh_structure.h.

Function Documentation

◆ bmesh_disk_edge_append()

void bmesh_disk_edge_append ( BMEdge e,
BMVert v 
)

BMesh Cycles

NOTE(@joeedh): this is somewhat outdated, though bits of its API are still used.

Cycles are circular doubly linked lists that form the basis of adjacency information in the BME modeler. Full adjacency relations can be derived from examining these cycles very quickly. Although each cycle is a double circular linked list, each one is considered to have a 'base' or 'head', and care must be taken by Euler code when modifying the contents of a cycle.

The contents of this file are split into two parts. First there are the bmesh_cycle family of functions which are generic circular double linked list procedures. The second part contains higher level procedures for supporting modification of specific cycle types.

The three cycles explicitly stored in the BM data structure are as follows: 1: The Disk Cycle - A circle of edges around a vertex Base: vertex->edge pointer.

This cycle is the most complicated in terms of its structure. Each bmesh_Edge contains two bmesh_CycleNode structures to keep track of that edges membership in the disk cycle of each of its vertices. However for any given vertex it may be the first in some edges in its disk cycle and the second for others. The bmesh_disk_XXX family of functions contain some nice utilities for navigating disk cycles in a way that hides this detail from the tool writer.

Note that the disk cycle is completely independent from face data. One advantage of this is that wire edges are fully integrated into the topology database. Another is that the the disk cycle has no problems dealing with non-manifold conditions involving faces.

Functions relating to this cycle:

The radial cycle is similar to the radial cycle in the radial edge data structure.* Unlike the radial edge however, the radial cycle does not require a large amount of memory to store non-manifold conditions since BM does not keep track of region/shell information.

Functions relating to this cycle:

The loop cycle keeps track of a faces vertices and edges. It should be noted that the direction of a loop cycle is either CW or CCW depending on the face normal, and is not oriented to the faces edit-edges.

Functions relating to this cycle:

  • bmesh_cycle_XXX family of functions.
    Note
    the order of elements in all cycles except the loop cycle is undefined. This leads to slightly increased seek time for deriving some adjacency relations, however the advantage is that no intrinsic properties of the data structures are dependent upon the cycle order and all non-manifold conditions are represented trivially.

Definition at line 136 of file bmesh_structure.c.

References BMVert::e, e, BMDiskLink::next, NULL, BMDiskLink::prev, and v.

Referenced by BM_edge_create(), bmesh_disk_vert_replace(), and bmesh_kernel_split_edge_make_vert().

◆ bmesh_disk_edge_exists()

BMEdge* bmesh_disk_edge_exists ( const BMVert v1,
const BMVert v2 
)

Definition at line 183 of file bmesh_structure.c.

References BM_verts_in_edge(), bmesh_disk_edge_next(), NULL, v1, and v2.

◆ bmesh_disk_edge_next()

BLI_INLINE BMEdge* bmesh_disk_edge_next ( const BMEdge e,
const BMVert v 
)

◆ bmesh_disk_edge_next_safe()

BLI_INLINE BMEdge* bmesh_disk_edge_next_safe ( const BMEdge e,
const BMVert v 
)

◆ bmesh_disk_edge_prev()

BLI_INLINE BMEdge* bmesh_disk_edge_prev ( const BMEdge e,
const BMVert v 
)

Referenced by bmesh_disk_validate().

◆ bmesh_disk_edge_prev_safe()

BLI_INLINE BMEdge* bmesh_disk_edge_prev_safe ( const BMEdge e,
const BMVert v 
)

◆ bmesh_disk_edge_remove()

void bmesh_disk_edge_remove ( BMEdge e,
BMVert v 
)

◆ bmesh_disk_faceedge_find_first()

BMEdge* bmesh_disk_faceedge_find_first ( const BMEdge e,
const BMVert v 
)

FIND FIRST FACE EDGE.

Finds the first edge in a vertices Disk cycle that has one of this vert's loops attached to it.

Definition at line 289 of file bmesh_structure.c.

References bmesh_disk_edge_next(), BMLoop::e, e, BMEdge::l, BMLoop::next, NULL, BMLoop::v, and v.

◆ bmesh_disk_faceedge_find_next()

BMEdge* bmesh_disk_faceedge_find_next ( const BMEdge e,
const BMVert v 
)

◆ bmesh_disk_faceloop_find_first()

BMLoop* bmesh_disk_faceloop_find_first ( const BMEdge e,
const BMVert v 
)

Special case for BM_LOOPS_OF_VERT & BM_FACES_OF_VERT, avoids 2x calls.

The returned BMLoop.e matches the result of bmesh_disk_faceedge_find_first

Definition at line 300 of file bmesh_structure.c.

References bmesh_disk_edge_next(), e, BMEdge::l, BMLoop::next, NULL, BMLoop::v, and v.

Referenced by BM_vert_find_first_loop(), bmiter__face_of_vert_begin(), and bmiter__loop_of_vert_begin().

◆ bmesh_disk_faceloop_find_first_visible()

BMLoop* bmesh_disk_faceloop_find_first_visible ( const BMEdge e,
const BMVert v 
)

◆ bmesh_disk_facevert_count()

int bmesh_disk_facevert_count ( const BMVert v)

DISK COUNT FACE VERT.

Counts the number of loop users for this vertex. Note that this is equivalent to counting the number of faces incident upon this vertex

Definition at line 250 of file bmesh_structure.c.

References bmesh_disk_edge_next(), bmesh_radial_facevert_count(), count, BMVert::e, BMEdge::l, and v.

Referenced by BM_vert_face_count(), bmiter__face_of_vert_begin(), and bmiter__loop_of_vert_begin().

◆ bmesh_disk_facevert_count_at_most()

int bmesh_disk_facevert_count_at_most ( const BMVert v,
int  count_max 
)

◆ bmesh_disk_validate()

bool bmesh_disk_validate ( int  len,
BMEdge e,
BMVert v 
)

◆ bmesh_disk_vert_replace()

void bmesh_disk_vert_replace ( BMEdge e,
BMVert v_dst,
BMVert v_src 
)

◆ bmesh_disk_vert_swap()

void bmesh_disk_vert_swap ( BMEdge e,
BMVert v_dst,
BMVert v_src 
)

MISC utility functions.

Definition at line 19 of file bmesh_structure.c.

References BLI_assert, e, and NULL.

Referenced by bmesh_disk_vert_replace().

◆ bmesh_edge_vert_swap()

void bmesh_edge_vert_swap ( BMEdge e,
BMVert v_dst,
BMVert v_src 
)

Handles all connected data, use with care.

Assumes caller has setup correct state before the swap is done.

Definition at line 34 of file bmesh_structure.c.

References BLI_assert, bmesh_disk_vert_replace(), e, BMLoop::next, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.

Referenced by BM_vert_splice(), bmesh_kernel_join_vert_kill_edge(), bmesh_kernel_unglue_region_make_vert(), and bmesh_kernel_vert_separate().

◆ bmesh_loop_validate()

bool bmesh_loop_validate ( BMFace f)

◆ bmesh_radial_faceloop_find_first()

BMLoop* bmesh_radial_faceloop_find_first ( const BMLoop l,
const BMVert v 
)

BME RADIAL FIND FIRST FACE VERT.

Finds the first loop of v around radial cycle

Definition at line 442 of file bmesh_structure.c.

References l, NULL, BMLoop::radial_next, BMLoop::v, and v.

Referenced by bmiter__face_of_vert_step(), and bmiter__loop_of_vert_step().

◆ bmesh_radial_faceloop_find_next()

BMLoop* bmesh_radial_faceloop_find_next ( const BMLoop l,
const BMVert v 
)

Definition at line 454 of file bmesh_structure.c.

References l, BMLoop::radial_next, BMLoop::v, and v.

Referenced by bmiter__face_of_vert_step(), and bmiter__loop_of_vert_step().

◆ bmesh_radial_faceloop_find_vert()

BMLoop* bmesh_radial_faceloop_find_vert ( const BMFace f,
const BMVert v 
)

◆ bmesh_radial_facevert_check()

bool bmesh_radial_facevert_check ( const BMLoop l,
const BMVert v 
)

RADIAL CHECK FACE VERT.

Quicker check for bmesh_radial_facevert_count(...) != 0.

Definition at line 523 of file bmesh_structure.c.

References l, BMLoop::radial_next, BMLoop::v, and v.

Referenced by bmesh_disk_faceedge_find_next().

◆ bmesh_radial_facevert_count()

int bmesh_radial_facevert_count ( const BMLoop l,
const BMVert v 
)

RADIAL COUNT FACE VERT.

Returns the number of times a vertex appears in a radial cycle

Definition at line 492 of file bmesh_structure.c.

References count, l, BMLoop::radial_next, BMLoop::v, and v.

Referenced by bmesh_disk_facevert_count().

◆ bmesh_radial_facevert_count_at_most()

int bmesh_radial_facevert_count_at_most ( const BMLoop l,
const BMVert v,
int  count_max 
)

Definition at line 506 of file bmesh_structure.c.

References count, l, BMLoop::radial_next, BMLoop::v, and v.

Referenced by bmesh_disk_facevert_count_at_most().

◆ bmesh_radial_loop_append()

void bmesh_radial_loop_append ( BMEdge e,
BMLoop l 
)

◆ bmesh_radial_loop_remove()

void bmesh_radial_loop_remove ( BMEdge e,
BMLoop l 
)

BMESH RADIAL REMOVE LOOP.

Removes a loop from an radial cycle. If edge e is non-NULL it should contain the radial cycle, and it will also get updated (in the case that the edge's link into the radial cycle was the loop which is being removed from the cycle).

Definition at line 399 of file bmesh_structure.c.

References BMESH_ASSERT, BMLoop::e, e, l, NULL, BMLoop::radial_next, BMLoop::radial_prev, and UNLIKELY.

Referenced by BM_edge_splice(), BM_face_kill(), BM_face_kill_loose(), bmesh_kernel_edge_separate(), bmesh_kernel_loop_reverse(), and bmesh_kernel_unglue_region_make_vert_multi().

◆ bmesh_radial_loop_unlink()

void bmesh_radial_loop_unlink ( BMLoop l)

A version of bmesh_radial_loop_remove which only performs the radial unlink, leaving the edge untouched.

Definition at line 429 of file bmesh_structure.c.

References BMLoop::e, l, NULL, BMLoop::radial_next, and BMLoop::radial_prev.

Referenced by bmesh_kernel_split_edge_make_vert().

◆ bmesh_radial_validate()

bool bmesh_radial_validate ( int  radlen,
BMLoop l 
)