From 64d0d62ddd2f9d320b0d221bfe4f13a973b8ed7b Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Wed, 5 Jul 2006 18:28:51 +0000 Subject: ===Python API=== Bugfix #4605: mball_to_mesh() doesn't create edges for new mesh, so me.getFromObject() wouldn't display the new mesh until edit mode was entered. Added a call to displistmesh_add_edges() to calculate them and then insert into the new mesh. --- source/blender/python/api2_2x/Mesh.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source') diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 956de7e2504..a4ef5736bc0 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -5605,6 +5605,21 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args ) ob = find_basis_mball( ob ); tmpmesh = add_mesh(); mball_to_mesh( &ob->disp, tmpmesh ); + + /* + * mball_to_mesh doesn't create edges, which confuses Blender in + * object mode. So this hack is necessary to quickly calculate the + * edges from the face list. + */ + + dlm = MEM_callocN( sizeof(DispListMesh), "tmp displist"); + dlm->totface = tmpmesh->totface; + dlm->mface = tmpmesh->mface; + displistmesh_add_edges( dlm ); + tmpmesh->totedge = dlm->totedge; + tmpmesh->medge = dlm->medge; + MEM_freeN( dlm ); + break; case OB_MESH: /* copies object and modifiers (but not the data) */ -- cgit v1.2.3