object converting curve/mball to a mesh would give invalid selection state (edges selected but nothing else).
add arg to BKE_mesh_calc_edges() so selecting newly created edges is optional.
This commit is contained in:
@@ -326,7 +326,7 @@ int BKE_mesh_validate_arrays(
|
||||
int BKE_mesh_validate(struct Mesh *me, int do_verbose);
|
||||
int BKE_mesh_validate_dm(struct DerivedMesh *dm);
|
||||
|
||||
void BKE_mesh_calc_edges(struct Mesh *mesh, int update);
|
||||
void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select);
|
||||
|
||||
void BKE_mesh_ensure_navmesh(struct Mesh *me);
|
||||
|
||||
|
||||
@@ -1198,7 +1198,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
|
||||
|
||||
BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
|
||||
|
||||
BKE_mesh_calc_edges(me, TRUE);
|
||||
BKE_mesh_calc_edges(me, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1523,7 +1523,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_u
|
||||
|
||||
BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
|
||||
|
||||
BKE_mesh_calc_edges(me, TRUE);
|
||||
BKE_mesh_calc_edges(me, true, false);
|
||||
}
|
||||
else {
|
||||
me = BKE_mesh_add(G.main, "Mesh");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -914,7 +914,7 @@ int BKE_mesh_validate_dm(DerivedMesh *dm)
|
||||
* \param mesh The mesh to add edges into
|
||||
* \param update When true create new edges co-exist
|
||||
*/
|
||||
void BKE_mesh_calc_edges(Mesh *mesh, int update)
|
||||
void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select)
|
||||
{
|
||||
CustomData edata;
|
||||
EdgeHashIterator *ehi;
|
||||
@@ -923,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
|
||||
@@ -963,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 */
|
||||
|
||||
@@ -1084,7 +1084,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
|
||||
|
||||
read_vertices(mesh, me);
|
||||
read_polys(mesh, me);
|
||||
BKE_mesh_calc_edges(me, 0);
|
||||
BKE_mesh_calc_edges(me, false, false);
|
||||
|
||||
// read_lines() must be called after the face edges have been generated.
|
||||
// Oterwise the loose edges will be silently deleted again.
|
||||
|
||||
@@ -885,7 +885,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
|
||||
}
|
||||
|
||||
if (calc_edges || ((mesh->totpoly || mesh->totface) && mesh->totedge == 0))
|
||||
BKE_mesh_calc_edges(mesh, calc_edges);
|
||||
BKE_mesh_calc_edges(mesh, calc_edges, true);
|
||||
|
||||
if (calc_tessface) {
|
||||
if (tessface_input == FALSE) {
|
||||
|
||||
Reference in New Issue
Block a user