[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11123] trunk/blender/source/blender/ python/api2_2x: remove unneeded checks from the python API

Campbell Barton cbarton at metavr.com
Fri Jun 29 10:59:26 CEST 2007


Revision: 11123
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11123
Author:   campbellbarton
Date:     2007-06-29 10:59:26 +0200 (Fri, 29 Jun 2007)

Log Message:
-----------
remove unneeded checks from the python API

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Camera.c
    trunk/blender/source/blender/python/api2_2x/CurNurb.c
    trunk/blender/source/blender/python/api2_2x/Curve.c
    trunk/blender/source/blender/python/api2_2x/Effect.c
    trunk/blender/source/blender/python/api2_2x/Font.c
    trunk/blender/source/blender/python/api2_2x/Image.c
    trunk/blender/source/blender/python/api2_2x/Ipo.c
    trunk/blender/source/blender/python/api2_2x/Ipocurve.c
    trunk/blender/source/blender/python/api2_2x/Lamp.c
    trunk/blender/source/blender/python/api2_2x/Material.c
    trunk/blender/source/blender/python/api2_2x/Mesh.c
    trunk/blender/source/blender/python/api2_2x/Metaball.c
    trunk/blender/source/blender/python/api2_2x/NMesh.c
    trunk/blender/source/blender/python/api2_2x/Object.c
    trunk/blender/source/blender/python/api2_2x/Sound.c
    trunk/blender/source/blender/python/api2_2x/Text.c
    trunk/blender/source/blender/python/api2_2x/Texture.c
    trunk/blender/source/blender/python/api2_2x/World.c
    trunk/blender/source/blender/python/api2_2x/bpy_config.c
    trunk/blender/source/blender/python/api2_2x/logic.c
    trunk/blender/source/blender/python/api2_2x/rgbTuple.c
    trunk/blender/source/blender/python/api2_2x/windowTheme.c

Modified: trunk/blender/source/blender/python/api2_2x/Camera.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Camera.c	2007-06-29 07:20:52 UTC (rev 11122)
+++ trunk/blender/source/blender/python/api2_2x/Camera.c	2007-06-29 08:59:26 UTC (rev 11123)
@@ -363,79 +363,37 @@
 
 static PyObject *Camera_oldgetType( BPy_Camera * self )
 {
-	PyObject *attr = PyInt_FromLong( self->camera->type );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.type attribute" );
+	return PyInt_FromLong( self->camera->type );
 }
 
 static PyObject *Camera_oldgetMode( BPy_Camera * self )
 {
-	PyObject *attr = PyInt_FromLong( self->camera->flag );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.Mode attribute" );
+	return PyInt_FromLong( self->camera->flag );
 }
 
 static PyObject *Camera_oldgetLens( BPy_Camera * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->camera->lens );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.lens attribute" );
+	return PyFloat_FromDouble( self->camera->lens );
 }
 
 static PyObject *Camera_oldgetScale( BPy_Camera * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->camera->ortho_scale );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.scale attribute" );
+	return PyFloat_FromDouble( self->camera->ortho_scale );
 }
 
 static PyObject *Camera_oldgetClipStart( BPy_Camera * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->camera->clipsta );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.clipStart attribute" );
+	return PyFloat_FromDouble( self->camera->clipsta );
 }
 
 static PyObject *Camera_oldgetClipEnd( BPy_Camera * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->camera->clipend );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.clipEnd attribute" );
+	return PyFloat_FromDouble( self->camera->clipend );
 }
 
 static PyObject *Camera_oldgetDrawSize( BPy_Camera * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->camera->drawsize );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-				      "couldn't get Camera.drawSize attribute" );
+	return PyFloat_FromDouble( self->camera->drawsize );
 }
 
 

Modified: trunk/blender/source/blender/python/api2_2x/CurNurb.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/CurNurb.c	2007-06-29 07:20:52 UTC (rev 11122)
+++ trunk/blender/source/blender/python/api2_2x/CurNurb.c	2007-06-29 08:59:26 UTC (rev 11123)
@@ -420,13 +420,7 @@
 
 static PyObject *CurNurb_getPoints( BPy_CurNurb * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->nurb->pntsu );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"could not get number of points" );
+	return PyInt_FromLong( ( long ) self->nurb->pntsu );
 }
 
 /*

Modified: trunk/blender/source/blender/python/api2_2x/Curve.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Curve.c	2007-06-29 07:20:52 UTC (rev 11122)
+++ trunk/blender/source/blender/python/api2_2x/Curve.c	2007-06-29 08:59:26 UTC (rev 11123)
@@ -138,13 +138,7 @@
 
 PyObject *Curve_getName( BPy_Curve * self )
 {
-	PyObject *attr = PyString_FromString( self->curve->id.name + 2 );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-					"couldn't get Curve.name attribute" );
+	return PyString_FromString( self->curve->id.name + 2 );
 }
 
 static int Curve_newsetName( BPy_Curve * self, PyObject * args )
@@ -164,13 +158,7 @@
 
 static PyObject *Curve_getPathLen( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->pathlen );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.pathlen attribute" );
+	return PyInt_FromLong( ( long ) self->curve->pathlen );
 }
 
 
@@ -191,25 +179,13 @@
 
 static PyObject *Curve_getTotcol( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->totcol );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.totcol attribute" );
+	return PyInt_FromLong( ( long ) self->curve->totcol );
 }
 
 
 PyObject *Curve_getMode( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->flag );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.flag attribute" );
+	return PyInt_FromLong( ( long ) self->curve->flag );
 }
 
 
@@ -230,13 +206,7 @@
 
 PyObject *Curve_getBevresol( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->bevresol );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.bevresol attribute" );
+	return PyInt_FromLong( ( long ) self->curve->bevresol );
 }
 
 static int Curve_newsetBevresol( BPy_Curve * self, PyObject * args )
@@ -263,13 +233,7 @@
 
 PyObject *Curve_getResolu( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->resolu );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.resolu attribute" );
+	return PyInt_FromLong( ( long ) self->curve->resolu );
 }
 
 
@@ -301,13 +265,7 @@
 
 PyObject *Curve_getResolv( BPy_Curve * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->curve->resolv );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.resolv attribute" );
+	return PyInt_FromLong( ( long ) self->curve->resolv );
 }
 
 static int Curve_newsetResolv( BPy_Curve * self, PyObject * args )
@@ -333,13 +291,7 @@
 
 PyObject *Curve_getWidth( BPy_Curve * self )
 {
-	PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->width );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.width attribute" );
+	return PyFloat_FromDouble( ( double ) self->curve->width );
 }
 
 
@@ -367,13 +319,7 @@
 
 PyObject *Curve_getExt1( BPy_Curve * self )
 {
-	PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->ext1 );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.ext1 attribute" );
+	return PyFloat_FromDouble( ( double ) self->curve->ext1 );
 }
 
 
@@ -400,13 +346,7 @@
 
 PyObject *Curve_getExt2( BPy_Curve * self )
 {
-	PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->ext2 );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.ext2 attribute" );
+	return PyFloat_FromDouble( ( double ) self->curve->ext2 );
 }
 
 
@@ -535,14 +475,8 @@
 
 static PyObject *Curve_getLoc( BPy_Curve * self )
 {
-	PyObject *attr = Py_BuildValue( "[f,f,f]", self->curve->loc[0],
+	return Py_BuildValue( "[f,f,f]", self->curve->loc[0],
 				self->curve->loc[1], self->curve->loc[2] );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.loc attribute" );
 }
 
 static int Curve_newsetLoc( BPy_Curve * self, PyObject * args )
@@ -573,14 +507,8 @@
 
 static PyObject *Curve_getRot( BPy_Curve * self )
 {
-	PyObject *attr = Py_BuildValue( "[f,f,f]", self->curve->rot[0],
+	return Py_BuildValue( "[f,f,f]", self->curve->rot[0],
 				self->curve->rot[1], self->curve->rot[2] );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.rot attribute" );
 }
 
 static int Curve_newsetRot( BPy_Curve * self, PyObject * args )
@@ -611,14 +539,8 @@
 
 static PyObject *Curve_getSize( BPy_Curve * self )
 {
-	PyObject *attr = Py_BuildValue( "[f,f,f]", self->curve->size[0],
+	return Py_BuildValue( "[f,f,f]", self->curve->size[0],
 				self->curve->size[1], self->curve->size[2] );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Curve.size attribute" );
 }
 
 static int Curve_newsetSize( BPy_Curve * self, PyObject * args )

Modified: trunk/blender/source/blender/python/api2_2x/Effect.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Effect.c	2007-06-29 07:20:52 UTC (rev 11122)
+++ trunk/blender/source/blender/python/api2_2x/Effect.c	2007-06-29 08:59:26 UTC (rev 11123)
@@ -774,11 +774,7 @@
 
 static PyObject *Effect_getType( BPy_Effect * self )
 {
-	PyObject *attr = PyInt_FromLong( ( long ) self->effect->type );
-	if( attr )
-		return attr;
-	return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
-					"couldn't get mode attribute" ) );
+	return PyInt_FromLong( ( long ) self->effect->type );
 }
 
 /* does nothing since there is only one type of effect */
@@ -800,28 +796,12 @@
 
 static PyObject *Effect_getStype( BPy_Effect * self )
 {
-	PyObject *attr;
-	long stype = (long)( self->effect->stype );
-
-	attr = PyInt_FromLong( stype );
-	if( attr )		return attr;
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Effect.stype attribute" );
+	return PyInt_FromLong( (long)( self->effect->stype ) );
 }
 
 static PyObject *Effect_getFlag( BPy_Effect * self )
 {
-	PyObject *attr;
-	/* toggle "Verts" setting because clear is "on" */
-	long flag = (long)( self->effect->flag ^ PAF_OFACE );
-
-	attr = PyInt_FromLong( flag );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Effect.flag attribute" );
+	return PyInt_FromLong( (long)( self->effect->flag ^ PAF_OFACE ) );
 }
 
 static int Effect_setFlag( BPy_Effect * self, PyObject * args )
@@ -852,13 +832,7 @@
 
 static PyObject *Effect_getSta( BPy_Effect * self )
 {
-	PyObject *attr = PyFloat_FromDouble( self->effect->sta );
-
-	if( attr )
-		return attr;
-
-	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
-			"couldn't get Effect.sta attribute" );
+	return PyFloat_FromDouble( self->effect->sta );
 }
 
 static int Effect_setSta( BPy_Effect * self, PyObject * args )
@@ -869,15 +843,7 @@
 
 static PyObject *Effect_getEnd( BPy_Effect * self )
 {
-	PyObject *attr;
-	PartEff *ptr = ( PartEff * ) self->effect;
-
-	attr = PyFloat_FromDouble( ptr->end );
-	if( attr )
-		return attr;
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list