diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-27 05:28:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-27 05:28:25 +0400 |
commit | f83a93e454e4a92d9619bc5bd16d73525e41ce46 (patch) | |
tree | 595264dbcf15b38e3f85c2238facea799fe28277 | |
parent | ae654301b041cae9cce8107614c1d17bae3ff12a (diff) |
bmesh todo, unlikly but possible - entering editmode with faces and no polys.
rather then printing a warning and failing - convert them to polys.
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 2 |
6 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 4bccbf9e61e..2d0719a78fa 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -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 diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index ed3cf697a9e..3c4a469a1a6 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -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; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index eb7711de9b1..6b70745d9b2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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); } /* diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index e50005634ba..dc0892f6bed 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -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; } diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 1c889a6169e..5d2bb359d3c 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -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); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 0f2ad28b400..fe3fe698626 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -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; |