bmesh todo, unlikly but possible - entering editmode with faces and no polys.

rather then printing a warning and failing - convert them to polys.
This commit is contained in:
2012-03-27 01:28:25 +00:00
parent ae654301b0
commit f83a93e454
6 changed files with 9 additions and 13 deletions

View File

@@ -145,7 +145,7 @@ void free_dverts(struct MDeformVert *dvert, int totvert);
void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */
void mesh_delete_material_index(struct Mesh *me, short index);
void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth);
void convert_mfaces_to_mpolys(struct Mesh *mesh);
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts,struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
/* used for unit testing; compares two meshes, checking only

View File

@@ -2003,7 +2003,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
}
}
void convert_mfaces_to_mpolys(Mesh *mesh)
void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
{
MFace *mf;
MLoop *ml;

View File

@@ -3708,7 +3708,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
/*check if we need to convert mfaces to mpolys*/
if (me->totface && !me->totpoly) {
convert_mfaces_to_mpolys(me);
BKE_mesh_convert_mfaces_to_mpolys(me);
}
/*

View File

@@ -965,6 +965,6 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
convert_mfaces_to_mpolys(me);
BKE_mesh_convert_mfaces_to_mpolys(me);
return true;
}

View File

@@ -265,16 +265,12 @@ void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
Mesh *me = ob->data;
BMesh *bm;
if (!me->mpoly && me->totface) {
fprintf(stderr, "%s: bmesh conversion issue! may lose lots of geometry! (bmesh internal error)\n", __func__);
/* BMESH_TODO need to write smarter code here */
bm = BKE_mesh_to_bmesh(me, ob);
}
else {
bm = BKE_mesh_to_bmesh(me, ob);
if (UNLIKELY(!me->mpoly && me->totface)) {
BKE_mesh_convert_mfaces_to_mpolys(me);
}
bm = BKE_mesh_to_bmesh(me, ob);
if (me->edit_btmesh) {
/* this happens when switching shape keys */
BMEdit_Free(me->edit_btmesh);

View File

@@ -811,7 +811,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
int tessface_input = FALSE;
if (mesh->totface > 0 && mesh->totpoly == 0) {
convert_mfaces_to_mpolys(mesh);
BKE_mesh_convert_mfaces_to_mpolys(mesh);
/* would only be converting back again, don't bother */
tessface_input = TRUE;