From 7b0098bd04bfd6ad0033b148002b53c776fb0fca Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 27 Aug 2007 20:05:05 +0000 Subject: [PATCH] getting the mesh for all curves/surfs/text raised an error every time because it was checking the wrong object was converted to a mesh. might be own fault. --- source/blender/python/api2_2x/Mesh.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index afc78267fa8..7afd2f07e37 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -6146,13 +6146,16 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args ) /* get updated display list, and convert to a mesh */ makeDispListCurveTypes( tmpobj, 0 ); nurbs_to_mesh( tmpobj ); - tmpmesh = tmpobj->data; - free_libblock_us( &G.main->object, tmpobj ); - if (ob->type != OB_MESH) + /* nurbs_to_mesh changes the type tp a mesh, check it worked */ + if (tmpobj->type != OB_MESH) { + free_libblock_us( &G.main->object, tmpobj ); return EXPP_ReturnPyObjError( PyExc_RuntimeError, "cant convert curve to mesh. Does the curve have any segments?" ); - break; + } + tmpmesh = tmpobj->data; + free_libblock_us( &G.main->object, tmpobj ); + break; case OB_MBALL: /* metaballs don't have modifiers, so just convert to mesh */ ob = find_basis_mball( ob );