diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-01-28 07:58:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-01-28 07:58:22 +0300 |
commit | 907d19b93d6d1b0b5bb8449a5ef56d5fff7f64db (patch) | |
tree | 6a651da0197afac3d5a461a82cfa44487b1b4b06 /source/blender/python/api2_2x/Mesh.c | |
parent | 321cafa714e582dbff9518f288487cd4cd66a086 (diff) |
made Mesh.Get('foo') raise an error when foo dosnt exist rather then returning None (to work like other modules)
also update Metaball.Get() to be less messy - still functions the same.
Diffstat (limited to 'source/blender/python/api2_2x/Mesh.c')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 466fe151bf6..9fcec7f06ac 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -7801,9 +7801,13 @@ static PyObject *M_Mesh_Get( PyObject * self_unused, PyObject * args ) if( name ) { mesh = ( Mesh * ) GetIdFromList( &( G.main->mesh ), name ); - if( !mesh ) - return EXPP_incr_ret( Py_None ); - + if( !mesh ) { + char error_msg[64]; + PyOS_snprintf( error_msg, sizeof( error_msg ), + "Mesh \"%s\" not found", name ); + return ( EXPP_ReturnPyObjError + ( PyExc_NameError, error_msg ) ); + } return Mesh_CreatePyObject( mesh, NULL ); } else { /* () - return a list with all meshes in the scene */ PyObject *meshlist; |