Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_validate.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 128b9ae242e..90704cb8b7e 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -190,13 +190,13 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
MLoop *mloops, unsigned int totloop,
MPoly *mpolys, unsigned int totpoly,
MDeformVert *dverts, /* assume totvert length */
- const short do_verbose, const short do_fixes)
+ const bool do_verbose, const bool do_fixes)
{
-# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0
+# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = true; } (void)0
# define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
-# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0
-# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0
+# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = true; } (void)0
+# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = true; } (void)0
MVert *mv = mverts;
MEdge *me;
@@ -205,15 +205,15 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
unsigned int i, j;
int *v;
- short do_edge_free = FALSE;
- short do_face_free = FALSE;
- short do_polyloop_free = FALSE; /* This regroups loops and polys! */
+ bool do_edge_free = false;
+ bool do_face_free = false;
+ bool do_polyloop_free = false; /* This regroups loops and polys! */
- short verts_fixed = FALSE;
- short vert_weights_fixed = FALSE;
- int msel_fixed = FALSE;
+ bool verts_fixed = false;
+ bool vert_weights_fixed = false;
+ bool msel_fixed = false;
- int do_edge_recalc = FALSE;
+ bool do_edge_recalc = false;
EdgeHash *edge_hash = BLI_edgehash_new();
@@ -774,7 +774,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
if (do_edge_recalc) {
- BKE_mesh_calc_edges(mesh, TRUE);
+ BKE_mesh_calc_edges(mesh, true, false);
}
}
@@ -825,7 +825,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed);
}
-static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes)
+static int mesh_validate_customdata(CustomData *data, const bool do_verbose, const bool do_fixes)
{
int i = 0, has_fixes = 0;
@@ -859,7 +859,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
CustomData *ldata, CustomData *pdata,
- short do_verbose, const short do_fixes)
+ const bool do_verbose, const short do_fixes)
{
int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0;
@@ -871,7 +871,7 @@ static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata
return vfixed || efixed || lfixed || pfixed;
}
-int BKE_mesh_validate(Mesh *me, int do_verbose)
+int BKE_mesh_validate(Mesh *me, const int do_verbose)
{
int layers_fixed = 0, arrays_fixed = 0;
@@ -887,13 +887,13 @@ int BKE_mesh_validate(Mesh *me, int do_verbose)
me->mloop, me->totloop,
me->mpoly, me->totpoly,
me->dvert,
- do_verbose, TRUE);
+ do_verbose, true);
if (layers_fixed || arrays_fixed) {
DAG_id_tag_update(&me->id, OB_RECALC_DATA);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
int BKE_mesh_validate_dm(DerivedMesh *dm)
@@ -908,7 +908,13 @@ int BKE_mesh_validate_dm(DerivedMesh *dm)
TRUE, FALSE);
}
-void BKE_mesh_calc_edges(Mesh *mesh, int update)
+/**
+ * Calculate edges from polygons
+ *
+ * \param mesh The mesh to add edges into
+ * \param update When true create new edges co-exist
+ */
+void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select)
{
CustomData edata;
EdgeHashIterator *ehi;
@@ -917,9 +923,11 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
EdgeHash *eh = BLI_edgehash_new();
int i, totedge, totpoly = mesh->totpoly;
int med_index;
+ /* select for newly created meshes which are selected [#25595] */
+ const short ed_flag = (ME_EDGEDRAW | ME_EDGERENDER) | (select ? SELECT : 0);
if (mesh->totedge == 0)
- update = FALSE;
+ update = false;
if (update) {
/* assume existing edges are valid
@@ -957,7 +965,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
}
else {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
- med->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT; /* select for newly created meshes which are selected [#25595] */
+ med->flag = ed_flag;
}
/* store the new edge index in the hash value */