Cleanup: use enum class for bmesh selection flush flags
This commit is contained in:
@@ -407,7 +407,7 @@ static void bm_mesh_select_mode_flush_edge_to_face(BMesh *bm)
|
||||
bm->totfacesel += chunk_data.delta_selection_len;
|
||||
}
|
||||
|
||||
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, eBMSelectionFlushFLags flags)
|
||||
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, BMSelectFlushFlag flag)
|
||||
{
|
||||
if (selectmode & SCE_SELECT_VERTEX) {
|
||||
bm_mesh_select_mode_flush_vert_to_edge(bm);
|
||||
@@ -420,13 +420,13 @@ void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, eBMSelectio
|
||||
/* Remove any deselected elements from the BMEditSelection */
|
||||
BM_select_history_validate(bm);
|
||||
|
||||
if (flags & BM_SELECT_LEN_FLUSH_RECALC_VERT) {
|
||||
if (bool(flag & BMSelectFlushFlag::RecalcLenVert)) {
|
||||
recount_totvertsel(bm);
|
||||
}
|
||||
if (flags & BM_SELECT_LEN_FLUSH_RECALC_EDGE) {
|
||||
if (bool(flag & BMSelectFlushFlag::RecalcLenEdge)) {
|
||||
recount_totedgesel(bm);
|
||||
}
|
||||
if (flags & BM_SELECT_LEN_FLUSH_RECALC_FACE) {
|
||||
if (bool(flag & BMSelectFlushFlag::RecalcLenFace)) {
|
||||
recount_totfacesel(bm);
|
||||
}
|
||||
BLI_assert(recount_totsels_are_ok(bm));
|
||||
@@ -434,7 +434,7 @@ void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, eBMSelectio
|
||||
|
||||
void BM_mesh_select_mode_flush(BMesh *bm)
|
||||
{
|
||||
BM_mesh_select_mode_flush_ex(bm, bm->selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL);
|
||||
BM_mesh_select_mode_flush_ex(bm, bm->selectmode, BMSelectFlushFlag_All);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -2,29 +2,31 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bmesh_class.hh"
|
||||
|
||||
/** \file
|
||||
* \ingroup bmesh
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bmesh_class.hh"
|
||||
|
||||
struct BMEditSelection {
|
||||
struct BMEditSelection *next, *prev;
|
||||
BMElem *ele;
|
||||
char htype;
|
||||
};
|
||||
|
||||
enum eBMSelectionFlushFLags {
|
||||
BM_SELECT_LEN_FLUSH_RECALC_NOTHING = 0,
|
||||
BM_SELECT_LEN_FLUSH_RECALC_VERT = (1 << 0),
|
||||
BM_SELECT_LEN_FLUSH_RECALC_EDGE = (1 << 1),
|
||||
BM_SELECT_LEN_FLUSH_RECALC_FACE = (1 << 2),
|
||||
BM_SELECT_LEN_FLUSH_RECALC_ALL = (BM_SELECT_LEN_FLUSH_RECALC_VERT |
|
||||
BM_SELECT_LEN_FLUSH_RECALC_EDGE |
|
||||
BM_SELECT_LEN_FLUSH_RECALC_FACE),
|
||||
enum class BMSelectFlushFlag : uint8_t {
|
||||
None = 0,
|
||||
RecalcLenVert = (1 << 0),
|
||||
RecalcLenEdge = (1 << 1),
|
||||
RecalcLenFace = (1 << 2),
|
||||
};
|
||||
ENUM_OPERATORS(BMSelectFlushFlag, BMSelectFlushFlag::RecalcLenFace)
|
||||
|
||||
#define BMSelectFlushFlag_All \
|
||||
(BMSelectFlushFlag::RecalcLenVert | BMSelectFlushFlag::RecalcLenEdge | \
|
||||
BMSelectFlushFlag::RecalcLenFace)
|
||||
|
||||
/* Geometry hiding code. */
|
||||
|
||||
@@ -104,7 +106,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
|
||||
* (ie: all verts of an edge selects the edge and so on).
|
||||
* This should only be called by system and not tool authors.
|
||||
*/
|
||||
void BM_mesh_select_mode_flush_ex(BMesh *bm, short selectmode, eBMSelectionFlushFLags flags);
|
||||
void BM_mesh_select_mode_flush_ex(BMesh *bm, short selectmode, BMSelectFlushFlag flag);
|
||||
void BM_mesh_select_mode_flush(BMesh *bm);
|
||||
|
||||
/**
|
||||
|
||||
@@ -383,7 +383,8 @@ static bool edbm_bevel_calc(wmOperator *op)
|
||||
em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
|
||||
|
||||
if ((em->bm->selectmode & SCE_SELECT_VERTEX) == 0) {
|
||||
BM_mesh_select_mode_flush_ex(em->bm, SCE_SELECT_VERTEX, BM_SELECT_LEN_FLUSH_RECALC_EDGE);
|
||||
BM_mesh_select_mode_flush_ex(
|
||||
em->bm, SCE_SELECT_VERTEX, BMSelectFlushFlag::RecalcLenEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ void EDBM_selectmode_to_scene(bContext *C)
|
||||
|
||||
void EDBM_selectmode_flush_ex(BMEditMesh *em, const short selectmode)
|
||||
{
|
||||
BM_mesh_select_mode_flush_ex(em->bm, selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL);
|
||||
BM_mesh_select_mode_flush_ex(em->bm, selectmode, BMSelectFlushFlag_All);
|
||||
}
|
||||
|
||||
void EDBM_selectmode_flush(BMEditMesh *em)
|
||||
|
||||
@@ -4799,8 +4799,7 @@ static bool mesh_circle_select(const ViewContext *vc,
|
||||
changed |= data.is_changed;
|
||||
|
||||
if (changed) {
|
||||
BM_mesh_select_mode_flush_ex(
|
||||
vc->em->bm, vc->em->selectmode, BM_SELECT_LEN_FLUSH_RECALC_NOTHING);
|
||||
BM_mesh_select_mode_flush_ex(vc->em->bm, vc->em->selectmode, BMSelectFlushFlag::None);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
@@ -5492,8 +5491,7 @@ static void view3d_circle_select_recalc(void *user_data)
|
||||
vc.scene, vc.view_layer, vc.v3d, vc.obact->type, vc.obact->mode, ob_iter)
|
||||
{
|
||||
ED_view3d_viewcontext_init_object(&vc, ob_iter);
|
||||
BM_mesh_select_mode_flush_ex(
|
||||
vc.em->bm, vc.em->selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL);
|
||||
BM_mesh_select_mode_flush_ex(vc.em->bm, vc.em->selectmode, BMSelectFlushFlag_All);
|
||||
}
|
||||
FOREACH_OBJECT_IN_MODE_END;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user