Cleanup: Various clang-tidy warnings in bmesh

Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
Brecht Van Lommel
2025-01-26 20:07:59 +01:00
parent d2c688e381
commit 37b95783fa
65 changed files with 218 additions and 300 deletions

View File

@@ -175,12 +175,7 @@
* - Use two different iterator types for BMO map/buffer types.
*/
#include "BKE_customdata.hh"
#include "DNA_customdata_types.h" /* BMesh struct in bmesh_class.hh uses */
#include "DNA_listBase.h" /* selection history uses */
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include "bmesh_class.hh" // IWYU pragma: export

View File

@@ -52,7 +52,7 @@ struct BLI_mempool;
* 3: Unique ID in the #BMesh.
* 4: some elements for internal record keeping.
*/
typedef struct BMHeader {
struct BMHeader {
/** CustomData layers. */
void *data;
@@ -79,7 +79,7 @@ typedef struct BMHeader {
*/
char api_flag;
// char _pad;
} BMHeader;
};
BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
@@ -87,7 +87,7 @@ BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
* make them point directly into structs. and some way to make it only happen to the
* active layer, and properly update when switching active layers. */
typedef struct BMVert {
struct BMVert {
BMHeader head;
float co[3]; /* vertex coordinates */
@@ -101,19 +101,19 @@ typedef struct BMVert {
* (use with care!).
*/
struct BMEdge *e;
} BMVert;
};
typedef struct BMVert_OFlag {
struct BMVert_OFlag {
BMVert base;
struct BMFlagLayer *oflags;
} BMVert_OFlag;
};
/* disk link structure, only used by edges */
typedef struct BMDiskLink {
struct BMDiskLink {
struct BMEdge *next, *prev;
} BMDiskLink;
};
typedef struct BMEdge {
struct BMEdge {
BMHeader head;
/**
@@ -140,14 +140,14 @@ typedef struct BMEdge {
* edge around vertex v1 and d2 does the same for v2.
*/
BMDiskLink v1_disk_link, v2_disk_link;
} BMEdge;
};
typedef struct BMEdge_OFlag {
struct BMEdge_OFlag {
BMEdge base;
struct BMFlagLayer *oflags;
} BMEdge_OFlag;
};
typedef struct BMLoop {
struct BMLoop {
BMHeader head;
/* notice no flags layer */
@@ -237,27 +237,27 @@ typedef struct BMLoop {
* \endcode
*/
struct BMLoop *next, *prev;
} BMLoop;
};
/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
typedef struct BMElemF {
struct BMElemF {
BMHeader head;
} BMElemF;
};
/* can cast anything to this, including BMLoop */
typedef struct BMElem {
struct BMElem {
BMHeader head;
} BMElem;
};
#ifdef USE_BMESH_HOLES
/* eventually, this structure will be used for supporting holes in faces */
typedef struct BMLoopList {
struct BMLoopList {
struct BMLoopList *next, *prev;
struct BMLoop *first, *last;
} BMLoopList;
};
#endif
typedef struct BMFace {
struct BMFace {
BMHeader head;
#ifdef USE_BMESH_HOLES
@@ -286,20 +286,20 @@ typedef struct BMFace {
*/
short mat_nr;
// short _pad[3];
} BMFace;
};
typedef struct BMFace_OFlag {
struct BMFace_OFlag {
BMFace base;
struct BMFlagLayer *oflags;
} BMFace_OFlag;
};
typedef struct BMFlagLayer {
struct BMFlagLayer {
short f; /* flags */
} BMFlagLayer;
};
// #pragma GCC diagnostic ignored "-Wpadded"
typedef struct BMesh {
struct BMesh {
int totvert, totedge, totloop, totface;
int totvertsel, totedgesel, totfacesel;
@@ -384,7 +384,7 @@ typedef struct BMesh {
* Doesn't hold a #PyObject reference, cleared when the last object is de-referenced.
*/
void *py_handle;
} BMesh;
};
/** #BMHeader.htype (char) */
enum {
@@ -394,16 +394,16 @@ enum {
BM_FACE = 8,
};
typedef struct BMLoopNorEditData {
struct BMLoopNorEditData {
int loop_index;
BMLoop *loop;
float niloc[3];
float nloc[3];
float *loc;
short *clnors_data;
} BMLoopNorEditData;
};
typedef struct BMLoopNorEditDataArray {
struct BMLoopNorEditDataArray {
BMLoopNorEditData *lnor_editdata;
/**
* This one has full amount of loops,
@@ -413,7 +413,7 @@ typedef struct BMLoopNorEditDataArray {
int cd_custom_normal_offset;
int totloop;
} BMLoopNorEditDataArray;
};
#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
#define BM_ALL_NOLOOP (BM_VERT | BM_EDGE | BM_FACE)
@@ -500,12 +500,12 @@ enum {
struct BPy_BMGeneric;
extern void bpy_bm_generic_invalidate(struct BPy_BMGeneric *self);
typedef bool (*BMElemFilterFunc)(const BMElem *, void *user_data);
typedef bool (*BMVertFilterFunc)(const BMVert *, void *user_data);
typedef bool (*BMEdgeFilterFunc)(const BMEdge *, void *user_data);
typedef bool (*BMFaceFilterFunc)(const BMFace *, void *user_data);
typedef bool (*BMLoopFilterFunc)(const BMLoop *, void *user_data);
typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const BMLoop *, void *user_data);
using BMElemFilterFunc = bool (*)(const BMElem *, void *user_data);
using BMVertFilterFunc = bool (*)(const BMVert *, void *user_data);
using BMEdgeFilterFunc = bool (*)(const BMEdge *, void *user_data);
using BMFaceFilterFunc = bool (*)(const BMFace *, void *user_data);
using BMLoopFilterFunc = bool (*)(const BMLoop *, void *user_data);
using BMLoopPairFilterFunc = bool (*)(const BMLoop *, const BMLoop *, void *user_data);
/* defines */
#define BM_ELEM_CD_SET_INT(ele, offset, f) \

View File

@@ -16,8 +16,6 @@
#include "BLI_utildefines_stack.h"
#include "BLI_vector.hh"
#include "BLT_translation.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh"

View File

@@ -24,7 +24,7 @@ BMFace *BM_face_copy(BMesh *bm,
bool copy_edges);
BMFace *BM_face_copy(BMesh *bm, BMFace *f, bool copy_verts, bool copy_edges);
typedef enum eBMCreateFlag {
enum eBMCreateFlag {
BM_CREATE_NOP = 0,
/** Faces and edges only. */
BM_CREATE_NO_DOUBLE = (1 << 1),
@@ -34,7 +34,7 @@ typedef enum eBMCreateFlag {
* arguments or setting defaults, speeds up conversion when data is converted all at once.
*/
BM_CREATE_SKIP_CD = (1 << 2),
} eBMCreateFlag;
};
/**
* \brief Main function for creating a new vertex.

View File

@@ -8,8 +8,6 @@
* BM remove functions.
*/
#include "BLI_utildefines.h"
#include "bmesh.hh"
/* BMO functions */

View File

@@ -604,7 +604,7 @@ void BM_edgeloop_calc_center(BMesh * /*bm*/, BMEdgeLoopStore *el_store)
} while (true);
if (totw != 0.0f) {
mul_v3_fl(el_store->co, 1.0f / float(totw));
mul_v3_fl(el_store->co, 1.0f / totw);
}
}

View File

@@ -17,7 +17,7 @@
/**
* \note More can be added as needed.
*/
typedef enum eBMOpErrorLevel {
enum eBMOpErrorLevel {
/**
* Use when the operation could not succeed,
* typically from input that isn't sufficient for completing the operation.
@@ -36,7 +36,7 @@ typedef enum eBMOpErrorLevel {
* See #BMBackup type & function calls.
*/
BMO_ERROR_FATAL = 2,
} eBMOpErrorLevel;
};
/**
* Pushes an error onto the bmesh error stack.

View File

@@ -20,7 +20,7 @@
#include "BLI_memarena.h"
#include "BLI_task.h"
#include "BKE_attribute.hh"
#include "BKE_attribute.h"
#include "BKE_customdata.hh"
#include "BKE_multires.hh"
@@ -282,7 +282,7 @@ static bool quad_co(const float v1[3],
static void mdisp_axis_from_quad(const float v1[3],
const float v2[3],
float[3] /*v3[3]*/,
float /*v3*/[3],
const float v4[3],
float r_axis_x[3],
float r_axis_y[3])

View File

@@ -12,10 +12,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "intern/bmesh_private.hh"
#include "intern/bmesh_structure.hh"
const char bm_iter_itype_htype_map[BM_ITYPE_MAX] = {
'\0',

View File

@@ -31,7 +31,7 @@
*
* be sure to keep 'bm_iter_itype_htype_map' in sync with any changes
*/
typedef enum BMIterType {
enum BMIterType {
BM_VERTS_OF_MESH = 1,
BM_EDGES_OF_MESH = 2,
BM_FACES_OF_MESH = 3,
@@ -53,7 +53,7 @@ typedef enum BMIterType {
* input loop's edge. */
BM_LOOPS_OF_LOOP = 12,
BM_LOOPS_OF_EDGE = 13,
} BMIterType;
};
#define BM_ITYPE_MAX 14
@@ -147,8 +147,8 @@ struct BMIter__loop_of_face {
BMLoop *l_first, *l_next;
};
typedef void (*BMIter__begin_cb)(void *);
typedef void *(*BMIter__step_cb)(void *);
using BMIter__begin_cb = void (*)(void *);
using BMIter__step_cb = void *(*)(void *);
/* Iterator Structure */
/* NOTE: some of these vars are not used,
@@ -279,7 +279,7 @@ BMITER_CB_DEF(loop_of_face);
#undef BMITER_CB_DEF
#include "intern/bmesh_iterators_inline.hh"
#include "intern/bmesh_iterators_inline.hh" /* IWYU pragma: export */
#define BM_ITER_CHECK_TYPE_DATA(data) \
CHECK_TYPE_ANY(data, void *, BMFace *, BMEdge *, BMVert *, BMLoop *, BMElem *)

View File

@@ -33,8 +33,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE void *BM_iter_step(BMIter *it
* it with the appropriate function pointers based
* upon its type.
*/
ATTR_NONNULL(1)
BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
ATTR_NONNULL(1) BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
{
// int argtype;
iter->itype = itype;
@@ -42,91 +41,91 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da
/* inlining optimizes out this switch when called with the defined type */
switch ((BMIterType)itype) {
case BM_VERTS_OF_MESH:
BLI_assert(bm != NULL);
BLI_assert(data == NULL);
BLI_assert(bm != nullptr);
BLI_assert(data == nullptr);
iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin;
iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step;
iter->data.elem_of_mesh.pooliter.pool = bm->vpool;
break;
case BM_EDGES_OF_MESH:
BLI_assert(bm != NULL);
BLI_assert(data == NULL);
BLI_assert(bm != nullptr);
BLI_assert(data == nullptr);
iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin;
iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step;
iter->data.elem_of_mesh.pooliter.pool = bm->epool;
break;
case BM_FACES_OF_MESH:
BLI_assert(bm != NULL);
BLI_assert(data == NULL);
BLI_assert(bm != nullptr);
BLI_assert(data == nullptr);
iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin;
iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step;
iter->data.elem_of_mesh.pooliter.pool = bm->fpool;
break;
case BM_EDGES_OF_VERT:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_VERT);
iter->begin = (BMIter__begin_cb)bmiter__edge_of_vert_begin;
iter->step = (BMIter__step_cb)bmiter__edge_of_vert_step;
iter->data.edge_of_vert.vdata = (BMVert *)data;
break;
case BM_FACES_OF_VERT:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_VERT);
iter->begin = (BMIter__begin_cb)bmiter__face_of_vert_begin;
iter->step = (BMIter__step_cb)bmiter__face_of_vert_step;
iter->data.face_of_vert.vdata = (BMVert *)data;
break;
case BM_LOOPS_OF_VERT:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_VERT);
iter->begin = (BMIter__begin_cb)bmiter__loop_of_vert_begin;
iter->step = (BMIter__step_cb)bmiter__loop_of_vert_step;
iter->data.loop_of_vert.vdata = (BMVert *)data;
break;
case BM_VERTS_OF_EDGE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_EDGE);
iter->begin = (BMIter__begin_cb)bmiter__vert_of_edge_begin;
iter->step = (BMIter__step_cb)bmiter__vert_of_edge_step;
iter->data.vert_of_edge.edata = (BMEdge *)data;
break;
case BM_FACES_OF_EDGE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_EDGE);
iter->begin = (BMIter__begin_cb)bmiter__face_of_edge_begin;
iter->step = (BMIter__step_cb)bmiter__face_of_edge_step;
iter->data.face_of_edge.edata = (BMEdge *)data;
break;
case BM_VERTS_OF_FACE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_FACE);
iter->begin = (BMIter__begin_cb)bmiter__vert_of_face_begin;
iter->step = (BMIter__step_cb)bmiter__vert_of_face_step;
iter->data.vert_of_face.pdata = (BMFace *)data;
break;
case BM_EDGES_OF_FACE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_FACE);
iter->begin = (BMIter__begin_cb)bmiter__edge_of_face_begin;
iter->step = (BMIter__step_cb)bmiter__edge_of_face_step;
iter->data.edge_of_face.pdata = (BMFace *)data;
break;
case BM_LOOPS_OF_FACE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_FACE);
iter->begin = (BMIter__begin_cb)bmiter__loop_of_face_begin;
iter->step = (BMIter__step_cb)bmiter__loop_of_face_step;
iter->data.loop_of_face.pdata = (BMFace *)data;
break;
case BM_LOOPS_OF_LOOP:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_LOOP);
iter->begin = (BMIter__begin_cb)bmiter__loop_of_loop_begin;
iter->step = (BMIter__step_cb)bmiter__loop_of_loop_step;
iter->data.loop_of_loop.ldata = (BMLoop *)data;
break;
case BM_LOOPS_OF_EDGE:
BLI_assert(data != NULL);
BLI_assert(data != nullptr);
BLI_assert(((BMElem *)data)->head.htype == BM_EDGE);
iter->begin = (BMIter__begin_cb)bmiter__loop_of_edge_begin;
iter->step = (BMIter__step_cb)bmiter__loop_of_edge_step;
@@ -159,7 +158,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
return BM_iter_step(iter);
}
else {
return NULL;
return nullptr;
}
}

View File

@@ -31,7 +31,7 @@
#include "bmesh_log.hh"
#include "range_tree.h"
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
struct BMLogEntry {
BMLogEntry *next, *prev;

View File

@@ -10,13 +10,13 @@
* \ingroup bmesh
*/
typedef struct BMEditSelection {
struct BMEditSelection {
struct BMEditSelection *next, *prev;
BMElem *ele;
char htype;
} BMEditSelection;
};
typedef enum eBMSelectionFlushFLags {
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),
@@ -24,7 +24,7 @@ typedef enum eBMSelectionFlushFLags {
BM_SELECT_LEN_FLUSH_RECALC_ALL = (BM_SELECT_LEN_FLUSH_RECALC_VERT |
BM_SELECT_LEN_FLUSH_RECALC_EDGE |
BM_SELECT_LEN_FLUSH_RECALC_FACE),
} eBMSelectionFlushFLags;
};
/* Geometry hiding code. */

View File

@@ -15,7 +15,6 @@
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh"

View File

@@ -202,7 +202,7 @@ extern const BMAllocTemplate bm_mesh_chunksize_default;
#define BMALLOC_TEMPLATE_FROM_ME(...) \
VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_ME_, __VA_ARGS__)
void BM_mesh_vert_normals_get(BMesh *bm, blender::MutableSpan<blender::float3> positions);
void BM_mesh_vert_normals_get(BMesh *bm, blender::MutableSpan<blender::float3> normals);
/* Vertex coords access. */
void BM_mesh_vert_coords_get(BMesh *bm, blender::MutableSpan<blender::float3> positions);

View File

@@ -87,7 +87,6 @@
#include "BLI_span.hh"
#include "BLI_string_ref.hh"
#include "BLI_task.hh"
#include "BLI_timeit.hh"
#include "BLI_vector.hh"
#include "BKE_attribute.hh"
@@ -102,7 +101,6 @@
#include "DEG_depsgraph_query.hh"
#include "bmesh.hh"
#include "intern/bmesh_private.hh" /* For element checking. */
#include "CLG_log.h"

View File

@@ -17,8 +17,6 @@
# include "MEM_guardedalloc.h"
# include "BLI_utildefines.h"
# include "BKE_customdata.hh"
# include "bmesh.hh"

View File

@@ -1197,7 +1197,7 @@ struct BMLoopsCalcNormalsWithCoords_TLS {
static void bm_mesh_loops_calc_normals_for_vert_init_fn(const void *__restrict userdata,
void *__restrict chunk)
{
auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
const auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
auto *tls_data = static_cast<BMLoopsCalcNormalsWithCoords_TLS *>(chunk);
if (data->r_lnors_spacearr) {
tls_data->edge_vectors = MEM_new<blender::Vector<blender::float3, 16>>(__func__);
@@ -1213,7 +1213,7 @@ static void bm_mesh_loops_calc_normals_for_vert_reduce_fn(const void *__restrict
void *__restrict /*chunk_join*/,
void *__restrict chunk)
{
auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
const auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
auto *tls_data = static_cast<BMLoopsCalcNormalsWithCoords_TLS *>(chunk);
if (data->r_lnors_spacearr) {
@@ -1224,7 +1224,7 @@ static void bm_mesh_loops_calc_normals_for_vert_reduce_fn(const void *__restrict
static void bm_mesh_loops_calc_normals_for_vert_free_fn(const void *__restrict userdata,
void *__restrict chunk)
{
auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
const auto *data = static_cast<const BMLoopsCalcNormalsWithCoordsData *>(userdata);
auto *tls_data = static_cast<BMLoopsCalcNormalsWithCoords_TLS *>(chunk);
if (data->r_lnors_spacearr) {

View File

@@ -11,8 +11,6 @@
* \see mesh_tessellate.cc for the #Mesh equivalent of this file.
*/
#include "MEM_guardedalloc.h"
#include "BLI_heap.h"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"

View File

@@ -206,7 +206,7 @@ bool BM_mesh_validate(BMesh *bm)
face_map.add_or_modify(
std::move(face_verts),
[&](int *value) { *value = i; },
[&](int *value) { ERRMSG("face %d: duplicate of %d", i, *value); });
[&](const int *value) { ERRMSG("face %d: duplicate of %d", i, *value); });
if (j != f->len) {
ERRMSG("face %d: has length of %d but should be %d", i, f->len, j);

View File

@@ -9,8 +9,6 @@
* the topology of existing mesh data. (split, join, flip etc).
*/
#include "MEM_guardedalloc.h"
#include "BLI_math_vector.h"
#include "BLI_vector.hh"

View File

@@ -11,7 +11,7 @@
#include "BLI_ghash.h"
#include "BLI_utildefines.h"
#include <stdarg.h>
#include <cstdarg>
#include "bmesh_class.hh"
@@ -181,7 +181,7 @@ BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, short ofla
/* slot type arrays are terminated by the last member
* having a slot type of 0 */
typedef enum eBMOpSlotType {
enum eBMOpSlotType {
/* BMO_OP_SLOT_SENTINEL = 0, */
BMO_OP_SLOT_BOOL = 1,
BMO_OP_SLOT_INT = 2,
@@ -199,55 +199,55 @@ typedef enum eBMOpSlotType {
* it's very important this remain a power of two */
BMO_OP_SLOT_ELEMENT_BUF = 9, /* list of verts/edges/faces */
BMO_OP_SLOT_MAPPING = 10 /* simple hash map, requires subtype BMO_OP_SLOT_SUBTYPE_MAP_xxx */
} eBMOpSlotType;
};
#define BMO_OP_SLOT_TOTAL_TYPES 11
/* don't overlap values to avoid confusion */
typedef enum eBMOpSlotSubType_Elem {
enum eBMOpSlotSubType_Elem {
/* use as flags */
BMO_OP_SLOT_SUBTYPE_ELEM_VERT = BM_VERT,
BMO_OP_SLOT_SUBTYPE_ELEM_EDGE = BM_EDGE,
BMO_OP_SLOT_SUBTYPE_ELEM_FACE = BM_FACE,
BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE = (BM_FACE << 1),
} eBMOpSlotSubType_Elem;
};
ENUM_OPERATORS(eBMOpSlotSubType_Elem, BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE)
typedef enum eBMOpSlotSubType_Map {
enum eBMOpSlotSubType_Map {
BMO_OP_SLOT_SUBTYPE_MAP_EMPTY = 64, /* use as a set(), unused value */
BMO_OP_SLOT_SUBTYPE_MAP_ELEM = 65,
BMO_OP_SLOT_SUBTYPE_MAP_FLT = 66,
BMO_OP_SLOT_SUBTYPE_MAP_INT = 67,
BMO_OP_SLOT_SUBTYPE_MAP_BOOL = 68,
BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL = 69, /* python can't convert these */
} eBMOpSlotSubType_Map;
typedef enum eBMOpSlotSubType_Ptr {
};
enum eBMOpSlotSubType_Ptr {
BMO_OP_SLOT_SUBTYPE_PTR_BMESH = 100,
BMO_OP_SLOT_SUBTYPE_PTR_SCENE = 101,
BMO_OP_SLOT_SUBTYPE_PTR_OBJECT = 102,
BMO_OP_SLOT_SUBTYPE_PTR_MESH = 103,
BMO_OP_SLOT_SUBTYPE_PTR_STRUCT = 104,
} eBMOpSlotSubType_Ptr;
typedef enum eBMOpSlotSubType_Int {
};
enum eBMOpSlotSubType_Int {
BMO_OP_SLOT_SUBTYPE_INT_ENUM = 200,
BMO_OP_SLOT_SUBTYPE_INT_FLAG = 201,
} eBMOpSlotSubType_Int;
};
typedef union eBMOpSlotSubType_Union {
union eBMOpSlotSubType_Union {
eBMOpSlotSubType_Elem elem;
eBMOpSlotSubType_Ptr ptr;
eBMOpSlotSubType_Map map;
eBMOpSlotSubType_Int intg;
} eBMOpSlotSubType_Union;
};
typedef struct BMO_FlagSet {
struct BMO_FlagSet {
int value;
const char *identifier;
} BMO_FlagSet;
};
/* please ignore all these structures, don't touch them in tool code, except
* for when your defining an operator with BMOpDefine. */
typedef struct BMOpSlot {
struct BMOpSlot {
const char *slot_name; /* pointer to BMOpDefine.slot_args */
eBMOpSlotType slot_type;
eBMOpSlotSubType_Union slot_subtype;
@@ -268,7 +268,7 @@ typedef struct BMOpSlot {
BMO_FlagSet *flags;
} enum_data;
} data;
} BMOpSlot;
};
/* mainly for use outside bmesh internal code */
#define BMO_SLOT_AS_BOOL(slot) ((slot)->data.i)
@@ -287,7 +287,7 @@ typedef struct BMOpSlot {
#define BMO_OP_MAX_SLOTS 21
/* BMOpDefine->type_flag */
typedef enum {
enum BMOpTypeFlag {
BMO_OPTYPE_FLAG_NOP = 0,
/** Switch from multires tangent space to absolute coordinates. */
BMO_OPTYPE_FLAG_UNTAN_MULTIRES = (1 << 0),
@@ -295,10 +295,10 @@ typedef enum {
BMO_OPTYPE_FLAG_SELECT_FLUSH = (1 << 2),
BMO_OPTYPE_FLAG_SELECT_VALIDATE = (1 << 3),
BMO_OPTYPE_FLAG_INVALIDATE_CLNOR_ALL = (1 << 4),
} BMOpTypeFlag;
};
ENUM_OPERATORS(BMOpTypeFlag, BMO_OPTYPE_FLAG_INVALIDATE_CLNOR_ALL)
typedef struct BMOperator {
struct BMOperator {
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS];
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, struct BMOperator *op);
@@ -306,7 +306,7 @@ typedef struct BMOperator {
int type;
BMOpTypeFlag type_flag;
int flag; /* runtime options */
} BMOperator;
};
enum {
BMO_FLAG_RESPECT_HIDE = 1,
@@ -316,20 +316,20 @@ enum {
#define MAX_SLOTNAME 32
typedef struct BMOSlotType {
struct BMOSlotType {
char name[MAX_SLOTNAME];
eBMOpSlotType type;
eBMOpSlotSubType_Union subtype;
BMO_FlagSet *enum_flags;
} BMOSlotType;
};
typedef struct BMOpDefine {
struct BMOpDefine {
const char *opname;
BMOSlotType slot_types_in[BMO_OP_MAX_SLOTS];
BMOSlotType slot_types_out[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, BMOperator *op);
BMOpTypeFlag type_flag;
} BMOpDefine;
};
/* -------------------------------------------------------------------- */
/** \name BMesh Operator API
@@ -521,7 +521,7 @@ enum {
DEL_ONLYTAGGED,
};
typedef enum {
enum BMO_SymmDirection {
BMO_SYMMETRIZE_NEGATIVE_X,
BMO_SYMMETRIZE_NEGATIVE_Y,
BMO_SYMMETRIZE_NEGATIVE_Z,
@@ -529,15 +529,15 @@ typedef enum {
BMO_SYMMETRIZE_POSITIVE_X,
BMO_SYMMETRIZE_POSITIVE_Y,
BMO_SYMMETRIZE_POSITIVE_Z,
} BMO_SymmDirection;
};
typedef enum {
enum BMO_Delimit {
BMO_DELIM_NORMAL = 1 << 0,
BMO_DELIM_MATERIAL = 1 << 1,
BMO_DELIM_SEAM = 1 << 2,
BMO_DELIM_SHARP = 1 << 3,
BMO_DELIM_UV = 1 << 4,
} BMO_Delimit;
};
ENUM_OPERATORS(BMO_Delimit, BMO_DELIM_UV)
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, int op_flag);
@@ -784,14 +784,14 @@ void BMO_slot_buffer_from_all(BMesh *bm,
/* contents of this structure are private,
* don't directly access. */
typedef struct BMOIter {
struct BMOIter {
BMOpSlot *slot;
int cur; // for arrays
GHashIterator giter;
void **val;
/** Bit-wise '&' with #BMHeader.htype */
char restrictmask;
} BMOIter;
};
void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);

View File

@@ -79,7 +79,7 @@ BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op,
union {
void *ptr;
int val;
} t = {NULL};
} t = {nullptr};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INT);
BMO_slot_map_insert(op, slot, element, ((void)(t.val = val), t.ptr));
}
@@ -93,7 +93,7 @@ BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op,
union {
void *ptr;
bool val;
} t = {NULL};
} t = {nullptr};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
BMO_slot_map_insert(op, slot, element, ((void)(t.val = val), t.ptr));
}
@@ -107,7 +107,7 @@ BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op,
union {
void *ptr;
float val;
} t = {NULL};
} t = {nullptr};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
BMO_slot_map_insert(op, slot, element, ((void)(t.val = val), t.ptr));
}
@@ -142,7 +142,7 @@ ATTR_NONNULL(1, 2)
BLI_INLINE void BMO_slot_map_empty_insert(BMOperator *op, BMOpSlot *slot, const void *element)
{
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_EMPTY);
BMO_slot_map_insert(op, slot, element, NULL);
BMO_slot_map_insert(op, slot, element, nullptr);
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
@@ -169,9 +169,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
if (data) {
return *(float *)data;
}
else {
return 0.0f;
}
return 0.0f;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
@@ -184,9 +182,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
if (data) {
return *(int *)data;
}
else {
return 0;
}
return 0;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
@@ -199,9 +195,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
if (data) {
return *(bool *)data;
}
else {
return false;
}
return false;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
@@ -213,7 +207,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
return *val;
}
return NULL;
return nullptr;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
@@ -225,5 +219,5 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE
return *val;
}
return NULL;
return nullptr;
}

View File

@@ -18,8 +18,6 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "bmesh.hh"
#include "intern/bmesh_private.hh"

View File

@@ -217,4 +217,4 @@ void BM_mesh_calc_uvs_cone(BMesh *bm,
*/
void BM_mesh_calc_uvs_cube(BMesh *bm, short oflag);
#include "intern/bmesh_operator_api_inline.hh"
#include "intern/bmesh_operator_api_inline.hh" /* IWYU pragma: export */

View File

@@ -9,11 +9,8 @@
* with polygons (normal/area calculation, tessellation, etc)
*/
#include "DNA_listBase.h"
#include "DNA_modifier_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_math_base.hh"
@@ -670,7 +667,7 @@ void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
} while ((l_iter = l_iter->next) != l_first);
if (totw != 0.0f) {
mul_v3_fl(r_cent, 1.0f / float(totw));
mul_v3_fl(r_cent, 1.0f / totw);
}
}

View File

@@ -88,4 +88,4 @@ enum {
void poly_rotate_plane(const float normal[3], float (*verts)[3], uint nverts);
/* include the rest of our private declarations */
#include "bmesh_structure.hh"
#include "bmesh_structure.hh" /* IWYU pragma: export */

View File

@@ -991,14 +991,14 @@ int BM_face_share_edge_count(BMFace *f_a, BMFace *f_b)
return count;
}
bool BM_face_share_edge_check(BMFace *f1, BMFace *f2)
bool BM_face_share_edge_check(BMFace *f_a, BMFace *f_b)
{
BMLoop *l_iter;
BMLoop *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f1);
l_iter = l_first = BM_FACE_FIRST_LOOP(f_a);
do {
if (BM_edge_in_face(l_iter->e, f2)) {
if (BM_edge_in_face(l_iter->e, f_b)) {
return true;
}
} while ((l_iter = l_iter->next) != l_first);

View File

@@ -777,4 +777,4 @@ int BM_mesh_calc_edge_groups_as_arrays(BMesh *bm,
/* Not really any good place to put this. */
float bmesh_subd_falloff_calc(int falloff, float val) ATTR_WARN_UNUSED_RESULT;
#include "bmesh_query_inline.hh"
#include "bmesh_query_inline.hh" /* IWYU pragma: export */

View File

@@ -53,10 +53,10 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMVert *BM_edge_other_vert
if (e->v1 == v) {
return e->v2;
}
else if (e->v2 == v) {
if (e->v2 == v) {
return e->v1;
}
return NULL;
return nullptr;
}
/**
@@ -65,7 +65,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMVert *BM_edge_other_vert
*/
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_edge_is_wire(const BMEdge *e)
{
return (e->l == NULL);
return (e->l == nullptr);
}
/**
@@ -140,7 +140,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_loop_is_manifold(cons
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_vert_is_wire_endpoint(const BMVert *v)
{
const BMEdge *e = v->e;
if (e && e->l == NULL) {
if (e && e->l == nullptr) {
return (BM_DISK_EDGE_NEXT(e, v) == e);
}
return false;

View File

@@ -6,14 +6,12 @@
* \ingroup bmesh
*/
#include "MEM_guardedalloc.h"
#include "BLI_array.hh"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BKE_attribute.hh"
#include "BKE_attribute.h"
#include "BKE_customdata.hh"
#include "bmesh.hh"
@@ -97,7 +95,7 @@ void BM_face_uv_calc_center_median_weighted(const BMFace *f,
} while ((l_iter = l_iter->next) != l_first);
if (totw != 0.0f) {
mul_v2_fl(r_cent, 1.0f / float(totw));
mul_v2_fl(r_cent, 1.0f / totw);
}
/* Reverse aspect. */
r_cent[0] /= aspect[0];

View File

@@ -140,4 +140,4 @@ BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) ATTR_WARN_UNU
ATTR_NONNULL();
bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
#include "intern/bmesh_structure_inline.hh"
#include "intern/bmesh_structure_inline.hh" /* IWYU pragma: export */

View File

@@ -39,7 +39,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
if (v == e->v2) {
return e->v2_disk_link.next;
}
return NULL;
return nullptr;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@@ -51,7 +51,7 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
if (v == e->v2) {
return e->v2_disk_link.prev;
}
return NULL;
return nullptr;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMEdge *bmesh_disk_edge_next(const BMEdge *e,

View File

@@ -14,18 +14,18 @@
* NOTE: do NOT modify topology while walking a mesh!
*/
typedef enum {
enum BMWOrder {
BMW_DEPTH_FIRST,
BMW_BREADTH_FIRST,
} BMWOrder;
};
typedef enum {
enum BMWFlag {
BMW_FLAG_NOP = 0,
BMW_FLAG_TEST_HIDDEN = (1 << 0),
} BMWFlag;
};
/*Walkers*/
typedef struct BMWalker {
struct BMWalker {
char begin_htype; /* only for validating input */
void (*begin)(struct BMWalker *walker, void *start);
void *(*step)(struct BMWalker *walker);
@@ -52,7 +52,7 @@ typedef struct BMWalker {
struct GSet *visit_set;
struct GSet *visit_set_alt;
int depth;
} BMWalker;
};
/* define to make BMW_init more clear */
#define BMW_MASK_NOP 0

View File

@@ -965,7 +965,7 @@ static void bmw_EdgeLoopWalker_begin(BMWalker *walker, void *data)
/* Rewind. */
while ((owalk_pt = static_cast<BMwEdgeLoopWalker *>(BMW_current_state(walker)))) {
owalk = *((BMwEdgeLoopWalker *)owalk_pt);
owalk = *(owalk_pt);
BMW_walk(walker);
}
@@ -1222,7 +1222,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
/* Rewind. */
while ((owalk_pt = static_cast<BMwFaceLoopWalker *>(BMW_current_state(walker)))) {
owalk = *((BMwFaceLoopWalker *)owalk_pt);
owalk = *(owalk_pt);
BMW_walk(walker);
}
@@ -1323,7 +1323,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data)
/* Rewind. */
while ((owalk_pt = static_cast<BMwEdgeringWalker *>(BMW_current_state(walker)))) {
owalk = *((BMwEdgeringWalker *)owalk_pt);
owalk = *(owalk_pt);
BMW_walk(walker);
}

View File

@@ -18,77 +18,77 @@ extern BMWalker *bm_walker_types[];
extern const int bm_totwalkers;
/* Pointer hiding */
typedef struct BMwGenericWalker {
struct BMwGenericWalker {
Link link;
int depth;
} BMwGenericWalker;
};
typedef struct BMwShellWalker {
struct BMwShellWalker {
BMwGenericWalker header;
BMEdge *curedge;
} BMwShellWalker;
};
typedef struct BMwLoopShellWalker {
struct BMwLoopShellWalker {
BMwGenericWalker header;
BMLoop *curloop;
} BMwLoopShellWalker;
};
typedef struct BMwLoopShellWireWalker {
struct BMwLoopShellWireWalker {
BMwGenericWalker header;
BMElem *curelem;
} BMwLoopShellWireWalker;
};
typedef struct BMwIslandboundWalker {
struct BMwIslandboundWalker {
BMwGenericWalker header;
BMLoop *base;
BMVert *lastv;
BMLoop *curloop;
} BMwIslandboundWalker;
};
typedef struct BMwIslandWalker {
struct BMwIslandWalker {
BMwGenericWalker header;
BMFace *cur;
} BMwIslandWalker;
};
typedef struct BMwEdgeLoopWalker {
struct BMwEdgeLoopWalker {
BMwGenericWalker header;
BMEdge *cur, *start;
BMVert *lastv, *startv;
BMFace *f_hub;
bool is_boundary; /* boundary looping changes behavior */
bool is_single; /* single means the edge verts are only connected to 1 face */
} BMwEdgeLoopWalker;
};
typedef struct BMwFaceLoopWalker {
struct BMwFaceLoopWalker {
BMwGenericWalker header;
BMLoop *l;
bool no_calc;
} BMwFaceLoopWalker;
};
typedef struct BMwEdgeringWalker {
struct BMwEdgeringWalker {
BMwGenericWalker header;
BMLoop *l;
BMEdge *wireedge;
} BMwEdgeringWalker;
};
typedef struct BMwEdgeboundaryWalker {
struct BMwEdgeboundaryWalker {
BMwGenericWalker header;
BMEdge *e;
} BMwEdgeboundaryWalker;
};
typedef struct BMwNonManifoldEdgeLoopWalker {
struct BMwNonManifoldEdgeLoopWalker {
BMwGenericWalker header;
BMEdge *start, *cur;
BMVert *startv, *lastv;
int face_count; /* face count around the edge. */
} BMwNonManifoldEdgeLoopWalker;
};
typedef struct BMwUVEdgeWalker {
struct BMwUVEdgeWalker {
BMwGenericWalker header;
BMLoop *l;
} BMwUVEdgeWalker;
};
typedef struct BMwConnectedVertexWalker {
struct BMwConnectedVertexWalker {
BMwGenericWalker header;
BMVert *curvert;
} BMwConnectedVertexWalker;
};

View File

@@ -8,8 +8,6 @@
* Bevel wrapper around #BM_mesh_bevel
*/
#include "BLI_utildefines.h"
#include "DNA_curveprofile_types.h"
#include "bmesh.hh"
#include "bmesh_tools.hh"

View File

@@ -12,7 +12,6 @@
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BLI_utildefines_stack.h"
#include "bmesh.hh"

View File

@@ -146,8 +146,8 @@ static void bridge_loop_pair(BMesh *bm,
float dot_a, dot_b;
const bool use_edgeout = true;
el_store_a_len = BM_edgeloop_length_get((BMEdgeLoopStore *)el_store_a);
el_store_b_len = BM_edgeloop_length_get((BMEdgeLoopStore *)el_store_b);
el_store_a_len = BM_edgeloop_length_get(el_store_a);
el_store_b_len = BM_edgeloop_length_get(el_store_b);
if (el_store_a_len < el_store_b_len) {
std::swap(el_store_a_len, el_store_b_len);

View File

@@ -26,7 +26,6 @@
#include "BLI_memarena.h"
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"

View File

@@ -11,7 +11,6 @@
#include "BLI_alloca.h"
#include "BLI_linklist_stack.h"
#include "BLI_math_geom.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"

View File

@@ -8,8 +8,6 @@
* Edge-Net for filling in open edge-loops.
*/
#include "MEM_guardedalloc.h"
#include "BLI_math_vector.h"
#include "BLI_vector.hh"

View File

@@ -9,7 +9,6 @@
*/
#include "BLI_linklist_stack.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"

View File

@@ -20,7 +20,7 @@
#include "intern/bmesh_operators_private.hh" /* own include */
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
#define EDGE_MARK 4
#define FACE_OUT 16

View File

@@ -8,8 +8,6 @@
* Fill boundary edge loop(s) with faces.
*/
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "bmesh_tools.hh"

View File

@@ -11,6 +11,8 @@
* - convert triangles to any sided faces, not just quads.
*/
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_heap.h"
@@ -703,8 +705,7 @@ static float compute_alignment(const JoinEdgesState &s,
}
/* Pick the best option and average the four components. */
const float best_error = std::min(std::min(error[0], error[1]), std::min(error[2], error[3])) /
4.0f;
const float best_error = std::min({error[0], error[1], error[2], error[3]}) / 4.0f;
ASSERT_VALID_ERROR_METRIC(best_error);
@@ -714,9 +715,7 @@ static float compute_alignment(const JoinEdgesState &s,
float alignment = 1.0f - (best_error / (M_PI / 4.0f));
/* if alignment is *truly* awful, then do nothing. Don't make a join worse. */
if (alignment < 0.0f) {
alignment = 0.0f;
}
alignment = std::max(alignment, 0.0f);
ASSERT_VALID_ERROR_METRIC(alignment);
@@ -835,9 +834,7 @@ static void reprioritize_join(JoinEdgesState &s,
* the priority queue. Limiting improvement at 99% ensures those quads tend to retain their bad
* sort, meaning they end up surrounded by quads that define a good grid,
* then they merge last, which tends to produce better results. */
if (multiplier > maximum_improvement) {
multiplier = maximum_improvement;
}
multiplier = std::min(multiplier, maximum_improvement);
ASSERT_VALID_ERROR_METRIC(multiplier);
@@ -965,7 +962,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
DelimitData delimit_data = bm_edge_delmimit_data_from_op(bm, op);
/* Initial setup of state. */
JoinEdgesState s = {0};
JoinEdgesState s = {nullptr};
s.topo_influnce = BMO_slot_float_get(op->slots_in, "topology_influence");
s.use_topo_influence = (s.topo_influnce != 0.0f);
s.edge_queue = BLI_heap_new();

View File

@@ -8,6 +8,8 @@
* Primitive shapes.
*/
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_math_base_safe.h"
@@ -1137,9 +1139,7 @@ void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag, const int cd_loop_uv_
}
BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) {
float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset);
if (luv[0] < minx) {
minx = luv[0];
}
minx = std::min(luv[0], minx);
}
}

View File

@@ -43,7 +43,7 @@ struct BLaplacianSystem {
/* Data. */
float min_area;
};
typedef BLaplacianSystem LaplacianSystem;
using LaplacianSystem = BLaplacianSystem;
static bool vert_is_boundary(BMVert *v);
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numLoops, int a_numVerts);

View File

@@ -8,8 +8,6 @@
* Just a wrapper around #BM_mesh_edgesplit
*/
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "bmesh_tools.hh"

View File

@@ -65,10 +65,10 @@ static void bmo_subd_init_shape_info(BMesh *bm, SubDParams *params)
params->shape_info.totlayer = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY);
}
typedef void (*subd_pattern_fill_fp)(BMesh *bm,
BMFace *face,
BMVert **verts,
const SubDParams *params);
using subd_pattern_fill_fp = void (*)(BMesh *bm,
BMFace *face,
BMVert **verts,
const SubDParams *params);
/*
* NOTE: this is a pattern-based edge subdivider.

View File

@@ -9,7 +9,6 @@
*/
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "intern/bmesh_operators_private.hh"

View File

@@ -18,7 +18,7 @@
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BKE_attribute.hh"
#include "BKE_attribute.h"
#include "BKE_customdata.hh"
#include "bmesh.hh"

View File

@@ -10,9 +10,6 @@
#include "DNA_material_types.h"
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "tools/bmesh_wireframe.hh"

View File

@@ -5,7 +5,6 @@
#include "testing/testing.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"
TEST(bmesh_core, BMVertCreate)

View File

@@ -8,6 +8,8 @@
* Main functions for beveling a BMesh (used by the tool and modifier)
*/
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "DNA_curveprofile_types.h"
@@ -5153,9 +5155,7 @@ static VMesh *square_out_adj_vmesh(BevelParams *bp, BevVert *bv)
* This is used in interpolation along center-line in odd case.
* To avoid too big a drop from bv, cap finalfrac a 0.8 arbitrarily */
finalfrac = 0.5f / sinf(ang);
if (finalfrac > 0.8f) {
finalfrac = 0.8f;
}
finalfrac = std::min(finalfrac, 0.8f);
}
else {
finalfrac = 0.8f;
@@ -7097,13 +7097,9 @@ static double find_superellipse_chord_endpoint(double x0, double dtarget, float
/* For gradient between -1 and 1, xnew can only be in [x0 + sqrt(2)/2*dtarget, x0 + dtarget]. */
double xmin = x0 + M_SQRT2 / 2.0 * dtarget;
if (xmin > 1.0) {
xmin = 1.0;
}
xmin = std::min(xmin, 1.0);
double xmax = x0 + dtarget;
if (xmax > 1.0) {
xmax = 1.0;
}
xmax = std::min(xmax, 1.0);
double ymin = superellipse_co(xmin, r, rbig);
double ymax = superellipse_co(xmax, r, rbig);
@@ -7194,12 +7190,8 @@ static void find_even_superellipse_chords_general(int seg, float r, double *xval
for (int i = 0; i < imax; i++) {
double d = sqrt(pow((xvals[i + 1] - xvals[i]), 2) + pow((yvals[i + 1] - yvals[i]), 2));
sum += d;
if (d > dmax) {
dmax = d;
}
if (d < dmin) {
dmin = d;
}
dmax = std::max(d, dmax);
dmin = std::min(d, dmin);
}
/* For last distance, weight with 1/2 if seg_odd. */
double davg;
@@ -7591,9 +7583,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
}
A_side_slide += BM_edge_calc_length(la->e) * sinf(exterior_angle);
}
if (A_side_slide < limit) {
limit = A_side_slide;
}
limit = std::min(A_side_slide, limit);
}
}
@@ -7616,9 +7606,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
}
C_side_slide += BM_edge_calc_length(lc->e) * sinf(exterior_angle);
}
if (C_side_slide < limit) {
limit = C_side_slide;
}
limit = std::min(C_side_slide, limit);
}
}
return limit;
@@ -7668,15 +7656,11 @@ static void bevel_limit_offset(BevelParams *bp, BMesh *bm)
EdgeHalf *eh = &bv->edges[i];
if (bp->affect_type == BEVEL_AFFECT_VERTICES) {
float collision_offset = vertex_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
limited_offset = std::min(collision_offset, limited_offset);
}
else {
float collision_offset = geometry_collide_offset(bp, eh);
if (collision_offset < limited_offset) {
limited_offset = collision_offset;
}
limited_offset = std::min(collision_offset, limited_offset);
}
}
}

View File

@@ -15,12 +15,9 @@
* see: #bm_face_bisect_verts
*/
#include <climits>
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
@@ -30,7 +27,7 @@
#include "bmesh.hh"
#include "bmesh_bisect_plane.hh" /* Own include. */
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
/* -------------------------------------------------------------------- */
/** \name Math Functions

View File

@@ -368,7 +368,7 @@ struct KD_Symmetry_Data {
static bool bm_edge_symmetry_check_cb(void *user_data,
int index,
const float[3] /*co*/,
const float /*co*/[3],
float /*dist_sq*/)
{
KD_Symmetry_Data *sym_data = static_cast<KD_Symmetry_Data *>(user_data);

View File

@@ -20,7 +20,7 @@
#include "bmesh.hh"
#include "bmesh_edgenet.hh" /* own include */
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
/* Struct for storing a path of verts walked over */
struct VertNetInfo {

View File

@@ -22,13 +22,13 @@
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_memarena.h"
#include "BLI_sort_utils.h"
#include "BLI_utildefines.h"
#include "BLI_linklist_stack.h"
#include "BLI_utildefines_stack.h"
#include "BLI_buffer.h"
@@ -41,7 +41,7 @@
#include "tools/bmesh_edgesplit.hh"
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
/*
* Some of these depend on each other:

View File

@@ -6,6 +6,8 @@
* \ingroup bmesh
*/
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLI_math_geom.h"
@@ -75,12 +77,8 @@ static bool bm_vert_pair_share_best_splittable_face_cb(BMFace *f,
return false;
}
float dot = dot_v3v3(v_test->co, no);
if (dot < min) {
min = dot;
}
if (dot > max) {
max = dot;
}
min = std::min(dot, min);
max = std::max(dot, max);
}
const float test_edgenet_range_on_face_normal = max - min;
@@ -157,12 +155,8 @@ static BMFace *bm_vert_pair_best_face_get(
BMIter f_iter;
BM_ITER_ELEM (v_test, &f_iter, data.r_best_face, BM_VERTS_OF_FACE) {
float dot = dot_v3v3(v_test->co, no);
if (dot < min) {
min = dot;
}
if (dot > max) {
max = dot;
}
min = std::min(dot, min);
max = std::max(dot, max);
}
float face_range_on_normal = max - min + 2 * epsilon;
if (face_range_on_normal < data.best_edgenet_range_on_face_normal) {

View File

@@ -52,7 +52,7 @@
# include "BLI_time_utildefines.h"
#endif
#include "BLI_strict_flags.h" /* Keep last. */
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
/* -------------------------------------------------------------------- */
/** \name Internal UIDWalk API
@@ -60,7 +60,7 @@
#define PRIME_VERT_INIT 100003
typedef uintptr_t UID_Int;
using UID_Int = uintptr_t;
struct UIDWalk {
@@ -902,7 +902,7 @@ static void bm_face_array_visit(BMFace **faces,
* \{ */
/* signed user id */
typedef intptr_t SUID_Int;
using SUID_Int = intptr_t;
BLI_INLINE intptr_t abs_intptr(intptr_t a)
{
@@ -1227,7 +1227,7 @@ static BMEdge *bm_face_region_pivot_edge_find(BMFace **faces_region,
/** \name Fast Match
* \{ */
typedef uintptr_t UIDFashMatch;
using UIDFashMatch = uintptr_t;
static UIDFashMatch bm_vert_fasthash_single(BMVert *v)
{

View File

@@ -9,16 +9,14 @@
* so they don't share any vertices/edges with other faces.
*/
#include <climits>
#include "bmesh_separate.hh" /* own include */
#include "MEM_guardedalloc.h"
#include "BLI_buffer.h"
#include "BLI_utildefines.h"
#include "bmesh.hh"
#include "bmesh_separate.hh" /* own include */
#include "intern/bmesh_private.hh"
#include "intern/bmesh_structure.hh"
void BM_mesh_separate_faces(BMesh *bm, BMFaceFilterFunc filter_fn, void *user_data)
{

View File

@@ -16,7 +16,6 @@
#include "BLI_heap.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
/* only for defines */
#include "BLI_polyfill_2d.h"

View File

@@ -11,6 +11,7 @@
#pragma once
#include "bmesh_class.hh"
#include "intern/bmesh_operator_api.hh"
void BM_mesh_triangulate(BMesh *bm,
int quad_method,

View File

@@ -14,7 +14,6 @@
#include "bmesh.hh"
#include "BLI_math_base.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"