Blender V5.0
bmo_dissolve.cc File Reference
#include <cmath>
#include "MEM_guardedalloc.h"
#include "BLI_math_vector.h"
#include "BLI_stack.h"
#include "BLI_vector.hh"
#include "bmesh.hh"
#include "bmesh_tools.hh"
#include "intern/bmesh_operators_private.hh"

Go to the source code of this file.

Macros

#define FACE_MARK   1
#define FACE_ORIG   2
#define FACE_NEW   4
#define FACE_TAG   8
#define EDGE_TAG   2
#define EDGE_ISGC   8
#define EDGE_CHAIN   16
#define VERT_MARK   1
#define VERT_MARK_PAIR   4
#define VERT_TAG   2
#define VERT_ISGC   8
#define VERT_MARK_TEAR   16

Functions

Internal Utility API
static bool UNUSED_FUNCTION check_hole_in_region (BMesh *bm, BMFace *f)
static float bmo_vert_calc_edge_angle_blended (const BMVert *v)
static BMEdgebm_vert_collapse_edge_and_merge (BMesh *bm, BMVert *v, const bool do_del)
static void bm_face_split (BMesh *bm, const short oflag, bool use_edge_delete)

Public Execute Functions

#define EDGE_MARK   1
#define EDGE_MARK   1
#define EDGE_COLLAPSE   2
void bmo_dissolve_faces_exec (BMesh *bm, BMOperator *op)
static BMVertbmo_find_end_of_chain (BMesh *bm, BMEdge *e, BMVert *v, const short edge_oflag=0)
static bool bmo_vert_touches_unselected_face (BMesh *bm, BMVert *v)
static int bmo_vert_tagged_edges_count_at_most (BMesh *bm, BMVert *v, const short edge_oflag, const int max)
void bmo_dissolve_edges_init (BMOperator *op)
void bmo_dissolve_edges_exec (BMesh *bm, BMOperator *op)
void bmo_dissolve_verts_exec (BMesh *bm, BMOperator *op)
void bmo_dissolve_limit_exec (BMesh *bm, BMOperator *op)
static void bm_mesh_edge_collapse_flagged (BMesh *bm, const int flag, const short oflag)
void bmo_dissolve_degenerate_exec (BMesh *bm, BMOperator *op)

Detailed Description

Removes isolated geometry regions without creating holes in the mesh.

Definition in file bmo_dissolve.cc.

Macro Definition Documentation

◆ EDGE_CHAIN

#define EDGE_CHAIN   16

Set when the edge is part of a chain, where at least of it's vertices has exactly one other connected edge.

Definition at line 40 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_edges_exec().

◆ EDGE_COLLAPSE

#define EDGE_COLLAPSE   2

Definition at line 822 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_degenerate_exec().

◆ EDGE_ISGC

#define EDGE_ISGC   8

Definition at line 35 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_edges_exec(), and bmo_dissolve_verts_exec().

◆ EDGE_MARK [1/2]

#define EDGE_MARK   1

Definition at line 33 of file bmo_dissolve.cc.

◆ EDGE_MARK [2/2]

#define EDGE_MARK   1

Definition at line 33 of file bmo_dissolve.cc.

◆ EDGE_TAG

#define EDGE_TAG   2

Definition at line 34 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_edges_exec(), and bmo_vert_touches_unselected_face().

◆ FACE_MARK

#define FACE_MARK   1

Definition at line 28 of file bmo_dissolve.cc.

◆ FACE_NEW

#define FACE_NEW   4

◆ FACE_ORIG

#define FACE_ORIG   2

Definition at line 29 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_faces_exec().

◆ FACE_TAG

#define FACE_TAG   8

Definition at line 31 of file bmo_dissolve.cc.

◆ VERT_ISGC

#define VERT_ISGC   8

Definition at line 45 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_edges_exec(), and bmo_dissolve_verts_exec().

◆ VERT_MARK

◆ VERT_MARK_PAIR

#define VERT_MARK_PAIR   4

Definition at line 43 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_verts_exec().

◆ VERT_MARK_TEAR

#define VERT_MARK_TEAR   16

Definition at line 46 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_verts_exec().

◆ VERT_TAG

#define VERT_TAG   2

Definition at line 44 of file bmo_dissolve.cc.

Referenced by bmo_dissolve_edges_exec().

Function Documentation

◆ bm_face_split()

◆ bm_mesh_edge_collapse_flagged()

void bm_mesh_edge_collapse_flagged ( BMesh * bm,
const int flag,
const short oflag )
static

Definition at line 824 of file bmo_dissolve.cc.

References bm, BMO_op_callf(), flag, and oflag.

Referenced by bmo_dissolve_degenerate_exec().

◆ bm_vert_collapse_edge_and_merge()

BMEdge * bm_vert_collapse_edge_and_merge ( BMesh * bm,
BMVert * v,
const bool do_del )
static

◆ bmo_dissolve_degenerate_exec()

◆ bmo_dissolve_edges_exec()

◆ bmo_dissolve_edges_init()

void bmo_dissolve_edges_init ( BMOperator * op)

Definition at line 447 of file bmo_dissolve.cc.

References BMO_slot_float_set(), M_PI, and BMOperator::slots_in.

◆ bmo_dissolve_faces_exec()

◆ bmo_dissolve_limit_exec()

◆ bmo_dissolve_verts_exec()

◆ bmo_find_end_of_chain()

BMVert * bmo_find_end_of_chain ( BMesh * bm,
BMEdge * e,
BMVert * v,
const short edge_oflag = 0 )
static

Given an edge, and vert that are part of a chain, finds the vert at the far end of the chain.

If edge_oflag is provided, each edge along the chain is tagged, and walking stops when an edge that is already tagged is found. This avoids repeatedly re-walking the chain.

Returns nullptr if already tagged edges are found, or if the chain loops.

Definition at line 367 of file bmo_dissolve.cc.

References BLI_assert, bm, BM_DISK_EDGE_NEXT, BM_edge_other_vert(), BM_vert_is_edge_pair(), BMO_edge_flag_enable, BMO_edge_flag_test, e, UNLIKELY, and v.

Referenced by bmo_dissolve_edges_exec().

◆ bmo_vert_calc_edge_angle_blended()

float bmo_vert_calc_edge_angle_blended ( const BMVert * v)
static

Calculates the angle of an edge pair, from a combination of raw angle and normal angle.

Definition at line 90 of file bmo_dissolve.cc.

References angle(), angle_on_axis_v3v3v3_v3(), angle_v3v3v3(), BLI_assert, BM_edge_face_pair(), BM_edge_other_vert(), BM_face_calc_normal(), BM_vert_edge_pair(), BMVert::co, dot_v3v3(), interpf(), M_PI, UNUSED_VARS_NDEBUG, and v.

Referenced by bmo_dissolve_edges_exec().

◆ bmo_vert_tagged_edges_count_at_most()

int bmo_vert_tagged_edges_count_at_most ( BMesh * bm,
BMVert * v,
const short edge_oflag,
const int max )
static

Counts how many edges touching a vert are tagged with the specified edge_oflag.

Definition at line 428 of file bmo_dissolve.cc.

References bm, BM_EDGES_OF_VERT, BM_ITER_ELEM, BMO_edge_flag_test, e, max, and v.

Referenced by bmo_dissolve_edges_exec().

◆ bmo_vert_touches_unselected_face()

bool bmo_vert_touches_unselected_face ( BMesh * bm,
BMVert * v )
static

Determines if a vert touches an unselected face that would be altered if the vert was dissolved. This is sometimes desirable (T-junction) and sometimes not (other cases).

Definition at line 402 of file bmo_dissolve.cc.

References bm, BM_ITER_ELEM, BM_loop_other_edge_loop(), BM_LOOPS_OF_VERT, BMO_edge_flag_test, BMO_vert_flag_test, BMLoop::e, EDGE_TAG, l_b, v, and VERT_MARK.

Referenced by bmo_dissolve_edges_exec().

◆ check_hole_in_region()