Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-06-29 12:59:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-06-29 12:59:26 +0400
commite192e7e02452c70511f688582d8d95d0a6267ee5 (patch)
tree75698ba122c3820668888ab38958e5c7e5cbb591 /source/blender/python/api2_2x
parent684869fd74a3a908a5df5802f440bfa823f6c802 (diff)
remove unneeded checks from the python API
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r--source/blender/python/api2_2x/Camera.c56
-rw-r--r--source/blender/python/api2_2x/CurNurb.c8
-rw-r--r--source/blender/python/api2_2x/Curve.c104
-rw-r--r--source/blender/python/api2_2x/Effect.c260
-rw-r--r--source/blender/python/api2_2x/Font.c10
-rw-r--r--source/blender/python/api2_2x/Image.c92
-rw-r--r--source/blender/python/api2_2x/Ipo.c8
-rw-r--r--source/blender/python/api2_2x/Ipocurve.c16
-rw-r--r--source/blender/python/api2_2x/Lamp.c191
-rw-r--r--source/blender/python/api2_2x/Material.c414
-rw-r--r--source/blender/python/api2_2x/Mesh.c33
-rw-r--r--source/blender/python/api2_2x/Metaball.c13
-rw-r--r--source/blender/python/api2_2x/NMesh.c25
-rw-r--r--source/blender/python/api2_2x/Object.c43
-rw-r--r--source/blender/python/api2_2x/Sound.c51
-rw-r--r--source/blender/python/api2_2x/Text.c26
-rw-r--r--source/blender/python/api2_2x/Texture.c347
-rw-r--r--source/blender/python/api2_2x/World.c24
-rw-r--r--source/blender/python/api2_2x/bpy_config.c19
-rw-r--r--source/blender/python/api2_2x/logic.c52
-rw-r--r--source/blender/python/api2_2x/rgbTuple.c6
-rw-r--r--source/blender/python/api2_2x/windowTheme.c9
22 files changed, 273 insertions, 1534 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index a7ebd786158..feb2c79ddae 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -363,79 +363,37 @@ Camera *Camera_FromPyObject( PyObject * pyobj )
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 );
}
diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c
index f919167372c..642e7b7b5e6 100644
--- a/source/blender/python/api2_2x/CurNurb.c
+++ b/source/blender/python/api2_2x/CurNurb.c
@@ -420,13 +420,7 @@ static PyObject *CurNurb_getKnotsV( BPy_CurNurb * self )
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 );
}
/*
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
index 109a4572387..eeaeebbbae8 100644
--- a/source/blender/python/api2_2x/Curve.c
+++ b/source/blender/python/api2_2x/Curve.c
@@ -138,13 +138,7 @@ struct chartrans *text_to_curve( Object * ob, int mode );
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 int Curve_newsetName( BPy_Curve * self, PyObject * args )
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 int Curve_newsetPathLen( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetMode( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetBevresol( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetResolu( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetResolv( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetWidth( BPy_Curve * self, PyObject * args )
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 @@ static int Curve_newsetExt1( BPy_Curve * self, PyObject * args )
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_getControlPoint( BPy_Curve * self, PyObject * args )
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 @@ TypeError:
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 @@ TypeError:
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 )
diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c
index 8c23a4d1544..f8a4f3dcc63 100644
--- a/source/blender/python/api2_2x/Effect.c
+++ b/source/blender/python/api2_2x/Effect.c
@@ -774,11 +774,7 @@ PyObject *Effect_Init( void )
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 int Effect_setStype( BPy_Effect * self, PyObject * args )
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 int Effect_setFlag( BPy_Effect * self, PyObject * args )
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 int Effect_setSta( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getEnd( BPy_Effect * self )
{
- PyObject *attr;
- PartEff *ptr = ( PartEff * ) self->effect;
-
- attr = PyFloat_FromDouble( ptr->end );
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.end attribute" );
+ return PyFloat_FromDouble( ((PartEff *) self->effect)->end );
}
static int Effect_setEnd( BPy_Effect * self, PyObject * args )
@@ -895,13 +861,7 @@ static int Effect_setEnd( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getLifetime( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->lifetime );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.lifetime attribute" );
+ return PyFloat_FromDouble( self->effect->lifetime );
}
static int Effect_setLifetime( BPy_Effect * self, PyObject * args )
@@ -912,13 +872,7 @@ static int Effect_setLifetime( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getNormfac( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->normfac );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.normfac attribute" );
+ return PyFloat_FromDouble( self->effect->normfac );
}
static int Effect_setNormfac( BPy_Effect * self, PyObject * args )
@@ -929,13 +883,7 @@ static int Effect_setNormfac( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getObfac( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->obfac );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.obfac attribute" );
+ return PyFloat_FromDouble( self->effect->obfac );
}
static int Effect_setObfac( BPy_Effect * self, PyObject * args )
@@ -946,13 +894,7 @@ static int Effect_setObfac( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getRandfac( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->randfac );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.randfac attribute" );
+ return PyFloat_FromDouble( self->effect->randfac );
}
static int Effect_setRandfac( BPy_Effect * self, PyObject * args )
@@ -963,13 +905,7 @@ static int Effect_setRandfac( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getTexfac( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->texfac );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.texfac attribute" );
+ return PyFloat_FromDouble( self->effect->texfac );
}
static int Effect_setTexfac( BPy_Effect * self, PyObject * args )
@@ -980,13 +916,7 @@ static int Effect_setTexfac( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getRandlife( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->randlife );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.randlife attribute" );
+ return PyFloat_FromDouble( self->effect->randlife );
}
static int Effect_setRandlife( BPy_Effect * self, PyObject * args )
@@ -997,13 +927,7 @@ static int Effect_setRandlife( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getNabla( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->nabla );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.nabla attribute" );
+ return PyFloat_FromDouble( self->effect->nabla );
}
static int Effect_setNabla( BPy_Effect * self, PyObject * args )
@@ -1014,13 +938,7 @@ static int Effect_setNabla( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getVectsize( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( self->effect->vectsize );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.vectsize attribute" );
+ return PyFloat_FromDouble( self->effect->vectsize );
}
static int Effect_setVectsize( BPy_Effect * self, PyObject * args )
@@ -1031,13 +949,7 @@ static int Effect_setVectsize( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getTotpart( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( self->effect->totpart );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.totpart attribute" );
+ return PyInt_FromLong( self->effect->totpart );
}
static int Effect_setTotpart( BPy_Effect * self, PyObject * args )
@@ -1048,13 +960,7 @@ static int Effect_setTotpart( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getTotkey( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( self->effect->totkey );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.totkey attribute" );
+ return PyInt_FromLong( self->effect->totkey );
}
static int Effect_setTotkey( BPy_Effect * self, PyObject * args )
@@ -1065,13 +971,7 @@ static int Effect_setTotkey( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getSeed( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( self->effect->seed );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.seed attribute" );
+ return PyInt_FromLong( self->effect->seed );
}
static int Effect_setSeed( BPy_Effect * self, PyObject * args )
@@ -1082,14 +982,8 @@ static int Effect_setSeed( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getForce( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(f,f,f)", self->effect->force[0],
+ return Py_BuildValue( "(f,f,f)", self->effect->force[0],
self->effect->force[1], self->effect->force[2] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.force attribute" );
}
static int Effect_setForce( BPy_Effect * self, PyObject * args )
@@ -1111,15 +1005,9 @@ static int Effect_setForce( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getMult( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(f,f,f,f)", self->effect->mult[0],
+ return Py_BuildValue( "(f,f,f,f)", self->effect->mult[0],
self->effect->mult[1], self->effect->mult[2],
self->effect->mult[3] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.mult attribute" );
}
static int Effect_setMult( BPy_Effect * self, PyObject * args )
@@ -1141,15 +1029,9 @@ static int Effect_setMult( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getLife( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(f,f,f,f)", self->effect->life[0],
+ return Py_BuildValue( "(f,f,f,f)", self->effect->life[0],
self->effect->life[1], self->effect->life[2],
self->effect->life[3] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.life attribute" );
}
static int Effect_setLife( BPy_Effect * self, PyObject * args )
@@ -1171,15 +1053,9 @@ static int Effect_setLife( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getChild( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(h,h,h,h)", self->effect->child[0],
+ return Py_BuildValue( "(h,h,h,h)", self->effect->child[0],
self->effect->child[1], self->effect->child[2],
self->effect->child[3] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.child attribute" );
}
@@ -1202,15 +1078,9 @@ static int Effect_setChild( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getChildMat( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(h,h,h,h)", self->effect->mat[0],
+ return Py_BuildValue( "(h,h,h,h)", self->effect->mat[0],
self->effect->mat[1], self->effect->mat[2],
self->effect->mat[3] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.childMat attribute" );
}
static int Effect_setChildMat( BPy_Effect * self, PyObject * args )
@@ -1232,14 +1102,8 @@ static int Effect_setChildMat( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getDefvec( BPy_Effect * self )
{
- PyObject *attr = Py_BuildValue( "(f,f,f)", self->effect->defvec[0],
+ return Py_BuildValue( "(f,f,f)", self->effect->defvec[0],
self->effect->defvec[1], self->effect->defvec[2] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.defvec attribute" );
}
static int Effect_setDefvec( BPy_Effect * self, PyObject * args )
@@ -1262,13 +1126,7 @@ static int Effect_setDefvec( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getJitter( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->userjit );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.jitter attribute" );
+ return PyInt_FromLong( ( long )self->effect->userjit );
}
static int Effect_setJitter( BPy_Effect * self, PyObject * args )
@@ -1279,13 +1137,7 @@ static int Effect_setJitter( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getDispMat( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->omat );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.dispMat attribute" );
+ return PyInt_FromLong( ( long )self->effect->omat );
}
static int Effect_setDispMat( BPy_Effect * self, PyObject * args )
@@ -1296,13 +1148,7 @@ static int Effect_setDispMat( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getEmissionTex( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->timetex );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.emissionTex attribute" );
+ return PyInt_FromLong( ( long )self->effect->timetex );
}
static int Effect_setEmissionTex( BPy_Effect * self, PyObject * args )
@@ -1313,13 +1159,7 @@ static int Effect_setEmissionTex( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getForceTex( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->speedtex );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.forceTex attribute" );
+ return PyInt_FromLong( ( long )self->effect->speedtex );
}
static int Effect_setForceTex( BPy_Effect * self, PyObject * args )
@@ -1330,13 +1170,7 @@ static int Effect_setForceTex( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getSpeedType( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->texmap );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.speedType attribute" );
+ return PyInt_FromLong( ( long )self->effect->texmap );
}
static int Effect_setSpeedType( BPy_Effect * self, PyObject * args )
@@ -1348,13 +1182,7 @@ static int Effect_setSpeedType( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getDamping( BPy_Effect * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double )self->effect->damp );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.damping attribute" );
+ return PyFloat_FromDouble( ( double )self->effect->damp );
}
static int Effect_setDamping( BPy_Effect * self, PyObject * args )
@@ -1365,13 +1193,7 @@ static int Effect_setDamping( BPy_Effect * self, PyObject * args )
static PyObject *Effect_getVertGroup( BPy_Effect * self )
{
- PyObject *attr = PyString_FromString( self->effect->vgroupname );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.vGroup attribute" );
+ return PyString_FromString( self->effect->vgroupname );
}
@@ -1399,13 +1221,7 @@ static int Effect_setVertGroup( BPy_Effect * self, PyObject * value )
static PyObject *Effect_getSpeedVertGroup( BPy_Effect * self )
{
- PyObject *attr = PyString_FromString( self->effect->vgroupname_v );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.speedVGroup attribute" );
+ return PyString_FromString( self->effect->vgroupname_v );
}
static int Effect_setSpeedVertGroup( BPy_Effect * self, PyObject * value )
@@ -1438,13 +1254,7 @@ static int Effect_setSpeedVertGroup( BPy_Effect * self, PyObject * value )
/*****************************************************************************/
static PyObject *Effect_getDisp( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->disp );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.disp attribute" );
+ return PyInt_FromLong( ( long )self->effect->disp );
}
static int Effect_setDisp( BPy_Effect * self, PyObject * args )
@@ -1461,13 +1271,7 @@ static int Effect_setDisp( BPy_Effect * self, PyObject * args )
/*****************************************************************************/
static PyObject *Effect_getStaticStep( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong( ( long )self->effect->staticstep );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Effect.staticStep attribute" );
+ return PyInt_FromLong( ( long )self->effect->staticstep );
}
static int Effect_setStaticStep( BPy_Effect * self , PyObject * args )
diff --git a/source/blender/python/api2_2x/Font.c b/source/blender/python/api2_2x/Font.c
index e27f5fa3dcd..61edac2841a 100644
--- a/source/blender/python/api2_2x/Font.c
+++ b/source/blender/python/api2_2x/Font.c
@@ -178,15 +178,7 @@ PyObject *M_Font_Load( PyObject * self, PyObject * value )
/*--------------- BPy_Font.filename-------------------------------------*/
static PyObject *Font_getFilename( BPy_Font * self )
{
- PyObject *attr = NULL;
-
- if( self->font )
- attr = PyString_FromString( self->font->name );
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Font.filename attribute" ) );
+ return PyString_FromString( self->font->name );
}
static int Font_setFilename( BPy_Font * self, PyObject * value )
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c
index ab2f573519a..dd2f667efe3 100644
--- a/source/blender/python/api2_2x/Image.c
+++ b/source/blender/python/api2_2x/Image.c
@@ -612,19 +612,12 @@ static PyObject *Image_setPixelI( BPy_Image * self, PyObject * args )
static PyObject *Image_getMaxXY( BPy_Image * self )
{
ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- PyObject *attr;
if( !ibuf || !ibuf->rect ) /* didn't work */
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't load image data in Blender" );
- attr = Py_BuildValue( "[i,i]", ibuf->x, ibuf->y );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not determine max x or y" );
+ return Py_BuildValue( "[i,i]", ibuf->x, ibuf->y );
}
@@ -633,19 +626,12 @@ static PyObject *Image_getMaxXY( BPy_Image * self )
static PyObject *Image_getMinXY( BPy_Image * self )
{
ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- PyObject *attr;
if( !ibuf || !ibuf->rect ) /* didn't work */
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't load image data in Blender" );
- attr = Py_BuildValue( "[i,i]", ibuf->xorig, ibuf->yorig );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not determine min x or y" );
+ return Py_BuildValue( "[i,i]", ibuf->xorig, ibuf->yorig );
}
/* unpack image */
@@ -805,13 +791,7 @@ Image *Image_FromPyObject( PyObject * pyobj )
static PyObject *Image_getFilename( BPy_Image * self )
{
- PyObject *attr = PyString_FromString( self->image->name );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.filename attribute" ) );
+ return PyString_FromString( self->image->name );
}
static PyObject *Image_getSize( BPy_Image * self )
@@ -837,86 +817,43 @@ static PyObject *Image_getSize( BPy_Image * self )
static PyObject *Image_getDepth( BPy_Image * self )
{
ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- PyObject *attr;
if( !ibuf ) /* didn't work */
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't load image data in Blender" );
- attr = PyInt_FromLong( (long)ibuf->depth );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.depth attribute" );
+ return PyInt_FromLong( (long)ibuf->depth );
}
static PyObject *Image_getXRep( BPy_Image * self )
{
- PyObject *attr = PyInt_FromLong( self->image->xrep );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.xrep attribute" );
+ return PyInt_FromLong( self->image->xrep );
}
static PyObject *Image_getYRep( BPy_Image * self )
{
- PyObject *attr = PyInt_FromLong( self->image->yrep );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.yrep attribute" );
+ return PyInt_FromLong( self->image->yrep );
}
static PyObject *Image_getStart( BPy_Image * self )
{
- PyObject *attr = PyInt_FromLong( self->image->twsta );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.start attribute" );
+ return PyInt_FromLong( self->image->twsta );
}
static PyObject *Image_getEnd( BPy_Image * self )
{
- PyObject *attr = PyInt_FromLong( self->image->twend );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.end attribute" );
+ return PyInt_FromLong( self->image->twend );
}
static PyObject *Image_getSpeed( BPy_Image * self )
{
- PyObject *attr = PyInt_FromLong( self->image->animspeed );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.speed attribute" );
+ return PyInt_FromLong( self->image->animspeed );
}
static PyObject *Image_getBindCode( BPy_Image * self )
{
- PyObject *attr = PyLong_FromUnsignedLong( self->image->bindcode );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.bindcode attribute" );
+ return PyLong_FromUnsignedLong( self->image->bindcode );
}
static PyObject *Image_reload( BPy_Image * self )
@@ -1179,7 +1116,6 @@ static int Image_setFlagTpage(BPy_Image *self, PyObject *value, void *flag)
*/
static PyObject *getIntAttr( BPy_Image *self, void *type )
{
- PyObject *attr = NULL;
int param;
struct Image *image = self->image;
@@ -1210,13 +1146,7 @@ static PyObject *getIntAttr( BPy_Image *self, void *type )
"undefined type in getIntAttr" );
}
- attr = PyInt_FromLong( param );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyInt_FromLong() failed!" );
+ return PyInt_FromLong( param );
}
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 45b6f8a2c79..a6077071ccb 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -806,13 +806,7 @@ static PyObject *M_Ipo_Recalc( PyObject * self_unused, PyObject * value )
/*****************************************************************************/
static PyObject *Ipo_getBlocktype( BPy_Ipo * self )
{
- PyObject *attr = PyInt_FromLong( self->ipo->blocktype );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Ipo.blocktype attribute" );
+ return PyInt_FromLong( self->ipo->blocktype );
}
static int Ipo_setBlocktype( BPy_Ipo * self, PyObject * args )
diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c
index bbc8e8ffc4e..2ce7e91e6c8 100644
--- a/source/blender/python/api2_2x/Ipocurve.c
+++ b/source/blender/python/api2_2x/Ipocurve.c
@@ -998,13 +998,7 @@ PyObject *IpoCurve_Init( void )
static PyObject *IpoCurve_newgetInterp( C_IpoCurve * self )
{
- PyObject *attr = PyInt_FromLong( self->ipocurve->ipo );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get IpoCurve.interp atrtribute" );
+ return PyInt_FromLong( self->ipocurve->ipo );
}
static int IpoCurve_newsetInterp( C_IpoCurve * self, PyObject * value )
@@ -1015,13 +1009,7 @@ static int IpoCurve_newsetInterp( C_IpoCurve * self, PyObject * value )
static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self )
{
- PyObject *attr = PyInt_FromLong( self->ipocurve->extrap );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get IpoCurve.extend atrtribute" );
+ return PyInt_FromLong( self->ipocurve->extrap );
}
static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * value )
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
index ee4a8257b6f..2b3617e97e2 100644
--- a/source/blender/python/api2_2x/Lamp.c
+++ b/source/blender/python/api2_2x/Lamp.c
@@ -864,221 +864,102 @@ static PyObject *Lamp_copy( BPy_Lamp * self )
static PyObject *Lamp_getType( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->type );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.type attribute" ) );
+ return PyInt_FromLong( self->lamp->type );
}
static PyObject *Lamp_getMode( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->mode );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.mode attribute" ) );
+ return PyInt_FromLong( self->lamp->mode );
}
static PyObject *Lamp_getSamples( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->samp );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.samples attribute" ) );
+ return PyInt_FromLong( self->lamp->samp );
}
static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->ray_samp );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.raySamplesX attribute" ) );
+ return PyInt_FromLong( self->lamp->ray_samp );
}
static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->ray_sampy );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.raySamplesY attribute" ) );
+ return PyInt_FromLong( self->lamp->ray_sampy );
}
static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->area_size );
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.areaSizeX attribute" ) );
+ return PyFloat_FromDouble( self->lamp->area_size );
}
static PyObject *Lamp_getAreaSizeY( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->area_sizey );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.areaSizeY attribute" ) );
+ return PyFloat_FromDouble( self->lamp->area_sizey );
}
static PyObject *Lamp_getBufferSize( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->bufsize );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.bufferSize attribute" ) );
+ return PyInt_FromLong( self->lamp->bufsize );
}
static PyObject *Lamp_getHaloStep( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong( self->lamp->shadhalostep );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.haloStep attribute" ) );
+ return PyInt_FromLong( self->lamp->shadhalostep );
}
static PyObject *Lamp_getEnergy( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->energy );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.energy attribute" ) );
+ return PyFloat_FromDouble( self->lamp->energy );
}
static PyObject *Lamp_getDist( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->dist );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.dist attribute" ) );
+ return PyFloat_FromDouble( self->lamp->dist );
}
static PyObject *Lamp_getSpotSize( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->spotsize );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.spotSize attribute" ) );
+ return PyFloat_FromDouble( self->lamp->spotsize );
}
static PyObject *Lamp_getSpotBlend( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->spotblend );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.spotBlend attribute" ) );
+ return PyFloat_FromDouble( self->lamp->spotblend );
}
static PyObject *Lamp_getClipStart( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->clipsta );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.clipStart attribute" ) );
+ return PyFloat_FromDouble( self->lamp->clipsta );
}
static PyObject *Lamp_getClipEnd( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->clipend );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.clipEnd attribute" ) );
+ return PyFloat_FromDouble( self->lamp->clipend );
}
static PyObject *Lamp_getBias( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->bias );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.bias attribute" ) );
+ return PyFloat_FromDouble( self->lamp->bias );
}
static PyObject *Lamp_getSoftness( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->soft );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.softness attribute" ) );
+ return PyFloat_FromDouble( self->lamp->soft );
}
static PyObject *Lamp_getHaloInt( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble( self->lamp->haint );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.haloInt attribute" ) );
+ return PyFloat_FromDouble( self->lamp->haint );
}
static PyObject *Lamp_getQuad1( BPy_Lamp * self )
{ /* should we complain if Lamp is not of type Quad? */
- PyObject *attr = PyFloat_FromDouble( self->lamp->att1 );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.quad1 attribute" ) );
+ return PyFloat_FromDouble( self->lamp->att1 );
}
static PyObject *Lamp_getQuad2( BPy_Lamp * self )
{ /* should we complain if Lamp is not of type Quad? */
- PyObject *attr = PyFloat_FromDouble( self->lamp->att2 );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.quad2 attribute" ) );
+ return PyFloat_FromDouble( self->lamp->att2 );
}
static PyObject *Lamp_getCol( BPy_Lamp * self )
@@ -1252,27 +1133,17 @@ static int Lamp_setQuad2( BPy_Lamp * self, PyObject * value )
static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure )
{
- PyObject *attr = NULL;
-
switch ( (int)closure ) {
case EXPP_LAMP_COMP_R:
- attr = PyFloat_FromDouble( self->lamp->r );
- break;
+ return PyFloat_FromDouble( self->lamp->r );
case EXPP_LAMP_COMP_G:
- attr = PyFloat_FromDouble( self->lamp->g );
- break;
+ return PyFloat_FromDouble( self->lamp->g );
case EXPP_LAMP_COMP_B:
- attr = PyFloat_FromDouble( self->lamp->b );
- break;
+ return PyFloat_FromDouble( self->lamp->b );
default:
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"unknown color component specified" );
}
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyFloat_FromDouble() failed" );
- return attr;
}
static int Lamp_setComponent( BPy_Lamp * self, PyObject * value,
@@ -1448,7 +1319,7 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args )
static PyObject *Lamp_getModesConst( void )
{
- PyObject * attr = Py_BuildValue
+ return Py_BuildValue
( "{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}",
"Shadows", EXPP_LAMP_MODE_SHADOWS, "Halo",
EXPP_LAMP_MODE_HALO, "Layer", EXPP_LAMP_MODE_LAYER,
@@ -1460,29 +1331,17 @@ static PyObject *Lamp_getModesConst( void )
EXPP_LAMP_MODE_NODIFFUSE, "NoSpecular",
EXPP_LAMP_MODE_NOSPECULAR, "RayShadow",
EXPP_LAMP_MODE_SHAD_RAY);
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.Modes attribute" );
-
- return attr;
}
static PyObject *Lamp_getTypesConst( void )
{
- PyObject *attr = Py_BuildValue( "{s:h,s:h,s:h,s:h,s:h,s:h}",
+ return Py_BuildValue( "{s:h,s:h,s:h,s:h,s:h,s:h}",
"Lamp", EXPP_LAMP_TYPE_LAMP,
"Sun", EXPP_LAMP_TYPE_SUN,
"Spot", EXPP_LAMP_TYPE_SPOT,
"Hemi", EXPP_LAMP_TYPE_HEMI,
"Area", EXPP_LAMP_TYPE_AREA,
"Photon", EXPP_LAMP_TYPE_YF_PHOTON );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Lamp.Types attribute" );
-
- return attr;
}
/* #####DEPRECATED###### */
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 6ed0541d9c1..f5d9dfeee06 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -1351,13 +1351,7 @@ static PyObject *Material_getIpo( BPy_Material * self )
static PyObject *Material_getMode( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->mode );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.Mode attribute" );
+ return PyInt_FromLong( ( long ) self->material->mode );
}
static PyObject *Material_getRGBCol( BPy_Material * self )
@@ -1388,494 +1382,217 @@ static PyObject *Material_getSssCol( BPy_Material * self )
static PyObject *Material_getSpecShader( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->spec_shader );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.specShader attribute" );
+ return PyInt_FromLong( ( long ) self->material->spec_shader );
}
static PyObject *Material_getDiffuseShader( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->diff_shader );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.diffuseShader attribute" );
+ return PyInt_FromLong( ( long ) self->material->diff_shader );
}
static PyObject *Material_getRoughness( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->roughness );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.roughness attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->roughness );
}
static PyObject *Material_getSpecSize( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->param[2] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.specSize attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->param[2] );
}
static PyObject *Material_getDiffuseSize( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->param[0] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.diffuseSize attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->param[0] );
}
static PyObject *Material_getSpecSmooth( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->param[3] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.specSmooth attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->param[3] );
}
static PyObject *Material_getDiffuseSmooth( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->param[1] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.diffuseSmooth( attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->param[1] );
}
static PyObject *Material_getDiffuseDarkness( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->darkness );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.diffuseDarkness attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->darkness );
}
static PyObject *Material_getRefracIndex( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->refrac );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.refracIndex attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->refrac );
}
static PyObject *Material_getRms( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->rms );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.rms attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->rms );
}
static PyObject *Material_getAmb( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->amb );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.amb attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->amb );
}
static PyObject *Material_getEmit( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->emit );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.emit attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->emit );
}
static PyObject *Material_getAlpha( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->alpha );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.alpha attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->alpha );
}
static PyObject *Material_getShadAlpha( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->shad_alpha );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.shad_alpha attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->shad_alpha );
}
static PyObject *Material_getRef( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->ref );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.ref attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->ref );
}
static PyObject *Material_getSpec( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->spec );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.spec attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->spec );
}
static PyObject *Material_getSpecTransp( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->spectra );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.specTransp attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->spectra );
}
static PyObject *Material_getAdd( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->add );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.add attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->add );
}
static PyObject *Material_getZOffset( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->zoffs );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.zOffset attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->zoffs );
}
static PyObject *Material_getLightGroup( BPy_Material * self )
{
- PyObject *attr =
- Group_CreatePyObject( self->material->group );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.lightGroup attribute" );
+ return Group_CreatePyObject( self->material->group );
}
static PyObject *Material_getHaloSize( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->hasize );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.haloSize attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->hasize );
}
static PyObject *Material_getFlareSize( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->flaresize );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.flareSize attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->flaresize );
}
static PyObject *Material_getFlareBoost( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->flareboost );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.flareBoost attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->flareboost );
}
static PyObject *Material_getSubSize( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->subsize );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.subSize attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->subsize );
}
static PyObject *Material_getHaloSeed( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->seed1 );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.haloSeed attribute" );
+ return PyInt_FromLong( ( long ) self->material->seed1 );
}
static PyObject *Material_getFlareSeed( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->seed2 );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.flareSeed attribute" );
+ return PyInt_FromLong( ( long ) self->material->seed2 );
}
static PyObject *Material_getHardness( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->har );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.hard attribute" );
+ return PyInt_FromLong( ( long ) self->material->har );
}
static PyObject *Material_getNFlares( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->flarec );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.nFlares attribute" );
+ return PyInt_FromLong( ( long ) self->material->flarec );
}
static PyObject *Material_getNStars( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->starc );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.nStars attribute" );
+ return PyInt_FromLong( ( long ) self->material->starc );
}
static PyObject *Material_getNLines( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->linec );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.nLines attribute" );
+ return PyInt_FromLong( ( long ) self->material->linec );
}
static PyObject *Material_getNRings( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->ringc );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.nRings attribute" );
+ return PyInt_FromLong( ( long ) self->material->ringc );
}
static PyObject *Material_getRayMirr( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->ray_mirror );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.rayMirr attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->ray_mirror );
}
static PyObject *Material_getMirrDepth( BPy_Material * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->material->ray_depth );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.rayMirrDepth attribute" );
+ return PyInt_FromLong( ( long ) self->material->ray_depth );
}
static PyObject *Material_getFresnelMirr( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->fresnel_mir );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.fresnelDepth attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->fresnel_mir );
}
static PyObject *Material_getFresnelMirrFac( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->fresnel_mir_i );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.fresnelDepthFac attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->fresnel_mir_i );
}
static PyObject *Material_getFilter( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->filter );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.filter attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->filter );
}
static PyObject *Material_getTranslucency( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->translucency );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.translucency attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->translucency );
}
static PyObject *Material_getIOR( BPy_Material * self )
{
- PyObject *attr = PyFloat_FromDouble( ( double ) self->material->ang );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.IOR attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->ang );
}
static PyObject *Material_getTransDepth( BPy_Material * self )
{
- PyObject *attr =
- PyInt_FromLong( ( long ) self->material->ray_depth_tra );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.transDepth attribute" );
+ return PyInt_FromLong( ( long ) self->material->ray_depth_tra );
}
static PyObject *Material_getFresnelTrans( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->fresnel_tra );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.fresnelTrans attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->fresnel_tra );
}
static PyObject *Material_getFresnelTransFac( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.fresnelTransFac attribute" );
+ return PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i );
}
static PyObject* Material_getRigidBodyFriction( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->friction );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.friction" );
+ return PyFloat_FromDouble( ( double ) self->material->friction );
}
static PyObject* Material_getRigidBodyRestitution( BPy_Material * self )
{
- PyObject *attr =
- PyFloat_FromDouble( ( double ) self->material->reflect );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Material.reflect" );
+ return PyFloat_FromDouble( ( double ) self->material->reflect );
}
/* SSS */
@@ -2926,54 +2643,35 @@ void EXPP_incr_mats_us( Material ** matlist, int len )
static PyObject *Material_getColorComponent( BPy_Material * self,
void * closure )
{
- PyObject *attr = NULL;
-
switch ( (int)closure ) {
case EXPP_MAT_COMP_R:
- attr = PyFloat_FromDouble( ( double ) self->material->r );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->r );
case EXPP_MAT_COMP_G:
- attr = PyFloat_FromDouble( ( double ) self->material->g );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->g );
case EXPP_MAT_COMP_B:
- attr = PyFloat_FromDouble( ( double ) self->material->b );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->b );
case EXPP_MAT_COMP_SPECR:
- attr = PyFloat_FromDouble( ( double ) self->material->specr );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->specr );
case EXPP_MAT_COMP_SPECG:
- attr = PyFloat_FromDouble( ( double ) self->material->specg );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->specg );
case EXPP_MAT_COMP_SPECB:
- attr = PyFloat_FromDouble( ( double ) self->material->specb );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->specb );
case EXPP_MAT_COMP_MIRR:
- attr = PyFloat_FromDouble( ( double ) self->material->mirr );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->mirr );
case EXPP_MAT_COMP_MIRG:
- attr = PyFloat_FromDouble( ( double ) self->material->mirg );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->mirg );
case EXPP_MAT_COMP_MIRB:
- attr = PyFloat_FromDouble( ( double ) self->material->mirb );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->mirb );
case EXPP_MAT_COMP_SSSR:
- attr = PyFloat_FromDouble( ( double ) self->material->sss_col[0] );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->sss_col[0] );
case EXPP_MAT_COMP_SSSG:
- attr = PyFloat_FromDouble( ( double ) self->material->sss_col[1] );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->sss_col[1] );
case EXPP_MAT_COMP_SSSB:
- attr = PyFloat_FromDouble( ( double ) self->material->sss_col[2] );
- break;
+ return PyFloat_FromDouble( ( double ) self->material->sss_col[2] );
default:
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"unknown color component specified" );
}
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyFloat_FromDouble() failed" );
- return attr;
}
static PyObject *Material_getColorband( BPy_Material * self, void * type)
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index db92536779d..164fdb4b372 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -4138,8 +4138,6 @@ static int MFace_setFlag( BPy_MFace *self, PyObject *value )
static PyObject *MFace_getMode( BPy_MFace *self )
{
- PyObject *attr;
-
if( !self->mesh->mtface )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"face has no texture values" );
@@ -4147,13 +4145,7 @@ static PyObject *MFace_getMode( BPy_MFace *self )
if( !MFace_get_pointer( self ) )
return NULL;
- attr = PyInt_FromLong( self->mesh->mtface[self->index].mode );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
+ return PyInt_FromLong( self->mesh->mtface[self->index].mode );
}
/*
@@ -7653,34 +7645,23 @@ static int Mesh_setSubDivLevels( BPy_Mesh *self, PyObject *value )
static PyObject *Mesh_getFlag( BPy_Mesh * self, void *type )
{
- PyObject *attr;
-
switch( (long)type ) {
case MESH_HASFACEUV:
- attr = self->mesh->mtface ? EXPP_incr_ret_True() :
+ return self->mesh->mtface ? EXPP_incr_ret_True() :
EXPP_incr_ret_False();
- break;
case MESH_HASMCOL:
- attr = self->mesh->mcol ? EXPP_incr_ret_True() :
+ return self->mesh->mcol ? EXPP_incr_ret_True() :
EXPP_incr_ret_False();
- break;
case MESH_HASVERTUV:
- attr = self->mesh->msticky ? EXPP_incr_ret_True() :
+ return self->mesh->msticky ? EXPP_incr_ret_True() :
EXPP_incr_ret_False();
- break;
case MESH_HASMULTIRES:
- attr = self->mesh->mr ? EXPP_incr_ret_True() :
+ return self->mesh->mr ? EXPP_incr_ret_True() :
EXPP_incr_ret_False();
- break;
default:
- attr = NULL;
- }
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't get attribute" );
+ }
}
static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type )
diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c
index b8d3bd3dba0..6e4071d00e8 100644
--- a/source/blender/python/api2_2x/Metaball.c
+++ b/source/blender/python/api2_2x/Metaball.c
@@ -744,22 +744,13 @@ static void Metaelem_dealloc( BPy_Metaelem * self )
* elem.type - int to set the shape of the element
*/
static PyObject *Metaelem_getType( BPy_Metaelem *self )
-{
- PyObject *attr = NULL;
-
+{
METAELEM_DEL_CHECK_PY(self);
- attr = PyInt_FromLong( self->metaelem->type );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "metaelem.type - PyInt_FromLong() failed!" );
+ return PyInt_FromLong( self->metaelem->type );
}
static int Metaelem_setType( BPy_Metaelem * self, PyObject * value )
{
-
int type;
if( !PyInt_CheckExact( value ) )
return EXPP_ReturnIntError( PyExc_TypeError,
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index 0a4e8b50406..51d6fc1a2b6 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -1554,13 +1554,7 @@ Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh )
static PyObject *NMesh_getMaxSmoothAngle( BPy_NMesh * self )
{
- PyObject *attr = PyInt_FromLong( self->smoothresh );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get NMesh.maxSmoothAngle attribute" );
+ return PyInt_FromLong( self->smoothresh );
}
static PyObject *NMesh_setMaxSmoothAngle( PyObject * self, PyObject * args )
@@ -1581,14 +1575,7 @@ static PyObject *NMesh_setMaxSmoothAngle( PyObject * self, PyObject * args )
static PyObject *NMesh_getSubDivLevels( BPy_NMesh * self )
{
- PyObject *attr =
- Py_BuildValue( "[h,h]", self->subdiv[0], self->subdiv[1] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get NMesh.subDivLevels attribute" );
+ return Py_BuildValue( "[h,h]", self->subdiv[0], self->subdiv[1] );
}
static PyObject *NMesh_setSubDivLevels( PyObject * self, PyObject * args )
@@ -1613,13 +1600,7 @@ static PyObject *NMesh_setSubDivLevels( PyObject * self, PyObject * args )
static PyObject *NMesh_getMode( BPy_NMesh * self )
{
- PyObject *attr = PyInt_FromLong( self->mode );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get NMesh.mode attribute" );
+ return PyInt_FromLong( self->mode );
}
static PyObject *NMesh_setMode( PyObject * self, PyObject * args )
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 8170aeb6a76..5fecf930af1 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -1285,7 +1285,7 @@ static PyObject *Object_getIpo( BPy_Object * self )
static PyObject *Object_getLocation( BPy_Object * self, PyObject * args )
{
char *space = "localspace"; /* default to local */
- PyObject *attr;
+
if( !PyArg_ParseTuple( args, "|s", &space ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string or nothing" );
@@ -1294,23 +1294,20 @@ static PyObject *Object_getLocation( BPy_Object * self, PyObject * args )
disable_where_script( 1 );
where_is_object( self->object );
- attr = Py_BuildValue( "fff",
+ return Py_BuildValue( "fff",
self->object->obmat[3][0],
self->object->obmat[3][1],
self->object->obmat[3][2] );
disable_where_script( 0 );
} else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
- attr = Py_BuildValue( "fff",
+ return Py_BuildValue( "fff",
self->object->loc[0],
self->object->loc[1],
self->object->loc[2] );
- } else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected either nothing, 'localspace' (default) or 'worldspace'" );
}
-
- return attr;
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "expected either nothing, 'localspace' (default) or 'worldspace'" );
}
static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args )
@@ -1366,7 +1363,6 @@ static int Object_setParentBoneName( BPy_Object * self, PyObject *value )
static PyObject *Object_getSize( BPy_Object * self, PyObject * args )
{
- PyObject *attr;
char *space = "localspace"; /* default to local */
if( !PyArg_ParseTuple( args, "|s", &space ) )
@@ -1378,22 +1374,19 @@ static PyObject *Object_getSize( BPy_Object * self, PyObject * args )
disable_where_script( 1 );
where_is_object( self->object );
Mat4ToSize(self->object->obmat, scale);
- attr = Py_BuildValue( "fff",
+ return Py_BuildValue( "fff",
self->object->size[0],
self->object->size[1],
self->object->size[2] );
disable_where_script( 0 );
} else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
- attr = Py_BuildValue( "fff",
+ return Py_BuildValue( "fff",
self->object->size[0],
self->object->size[1],
self->object->size[2] );
- } else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected either nothing, 'localspace' (default) or 'worldspace'" );
}
-
- return attr;
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "expected either nothing, 'localspace' (default) or 'worldspace'" );
}
static PyObject *Object_getTimeOffset( BPy_Object * self )
@@ -3535,7 +3528,6 @@ void Object_updateDag( void *data )
static PyObject *getIntAttr( BPy_Object *self, void *type )
{
- PyObject *attr = NULL;
int param;
struct Object *object = self->object;
@@ -3582,13 +3574,7 @@ static PyObject *getIntAttr( BPy_Object *self, void *type )
"undefined type in getIntAttr" );
}
- attr = PyInt_FromLong( param );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyInt_FromLong() failed!" );
+ return PyInt_FromLong( param );
}
/*
@@ -4079,7 +4065,6 @@ static int setFloatAttr( BPy_Object *self, PyObject *value, void *type )
static PyObject *getFloat3Attr( BPy_Object *self, void *type )
{
- PyObject *attr = NULL;
float *param;
struct Object *object = self->object;
@@ -4104,13 +4089,7 @@ static PyObject *getFloat3Attr( BPy_Object *self, void *type )
"undefined type in getFloat3Attr" );
}
- attr = Py_BuildValue( "(fff)", param[0], param[1], param[2] );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Py_BuildValue() failed!" );
+ return Py_BuildValue( "(fff)", param[0], param[1], param[2] );
}
/*
diff --git a/source/blender/python/api2_2x/Sound.c b/source/blender/python/api2_2x/Sound.c
index 66da43e6fad..6e20e4c3ee5 100644
--- a/source/blender/python/api2_2x/Sound.c
+++ b/source/blender/python/api2_2x/Sound.c
@@ -92,29 +92,24 @@ struct PyMethodDef M_Sound_methods[] = {
static int Sound_compare( BPy_Sound * a, BPy_Sound * b );
static PyObject *Sound_repr( BPy_Sound * self );
-#define SOUND_FLOAT_METHODS(funcname, varname) \
-static PyObject *Sound_get ## funcname(BPy_Sound *self) { \
- char e[256]; \
- PyObject *attr = PyFloat_FromDouble(self->sound->varname); \
- if (attr) return attr; \
- sprintf(e, "couldn't get Sound.%s attribute", #varname); \
- return EXPP_ReturnPyObjError (PyExc_RuntimeError, e); \
-} \
+#define SOUND_FLOAT_METHODS(funcname, varname) \
+static PyObject *Sound_get ## funcname(BPy_Sound *self) { \
+ return PyFloat_FromDouble(self->sound->varname); \
+} \
static PyObject *Sound_set ## funcname(BPy_Sound *self, PyObject *args) { \
- float f = 0; \
- if (!PyArg_ParseTuple(args, "f", &f)) \
- return (EXPP_ReturnPyObjError (PyExc_TypeError, \
- "expected float argument")); \
- self->sound->varname = EXPP_ClampFloat(f,\
- EXPP_SND_##varname##_MIN, EXPP_SND_##varname##_MAX);\
- Py_INCREF(Py_None); \
- return Py_None; \
+ float f = 0; \
+ if (!PyArg_ParseTuple(args, "f", &f)) \
+ return (EXPP_ReturnPyObjError (PyExc_TypeError, \
+ "expected float argument")); \
+ self->sound->varname = EXPP_ClampFloat(f, \
+ EXPP_SND_##varname##_MIN, EXPP_SND_##varname##_MAX); \
+ Py_RETURN_NONE; \
}
-#define SOUND_FLOAT_METHOD_FUNCS(varname) \
-{"get"#varname, (PyCFunction)Sound_get ## varname, METH_NOARGS, \
-"() - Return Sound object "#varname}, \
-{"set"#varname, (PyCFunction)Sound_set ## varname, METH_VARARGS, \
+#define SOUND_FLOAT_METHOD_FUNCS(varname) \
+{"get"#varname, (PyCFunction)Sound_get ## varname, METH_NOARGS, \
+"() - Return Sound object "#varname}, \
+{"set"#varname, (PyCFunction)Sound_set ## varname, METH_VARARGS, \
"(float) - Change Sound object "#varname},
@@ -354,24 +349,12 @@ bSound *Sound_FromPyObject( PyObject * pyobj )
/*****************************************************************************/
static PyObject *Sound_getName( BPy_Sound * self )
{
- PyObject *attr = PyString_FromString( self->sound->id.name + 2 );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Sound.name attribute" ) );
+ return PyString_FromString( self->sound->id.name + 2 );
}
static PyObject *Sound_getFilename( BPy_Sound * self )
{
- PyObject *attr = PyString_FromString( self->sound->name );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Sound.filename attribute" ) );
+ return PyString_FromString( self->sound->name );
}
static PyObject *Sound_getPacked( BPy_Sound * self )
diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c
index c98c542962a..d507d623c99 100644
--- a/source/blender/python/api2_2x/Text.c
+++ b/source/blender/python/api2_2x/Text.c
@@ -338,26 +338,16 @@ PyObject *Text_CreatePyObject( Text * txt )
/*****************************************************************************/
static PyObject *Text_getFilename( BPy_Text * self )
{
- PyObject *attr;
- char *name = self->text->name;
-
- if( name )
- attr = PyString_FromString( self->text->name );
- else
- attr = Py_None;
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Text.filename attribute" );
+ if( self->text->name )
+ return PyString_FromString( self->text->name );
+
+ Py_RETURN_NONE;
}
static PyObject *Text_getNLines( BPy_Text * self )
{ /* text->nlines isn't updated in Blender (?) */
int nlines = 0;
TextLine *line;
- PyObject *attr;
line = self->text->lines.first;
@@ -368,13 +358,7 @@ static PyObject *Text_getNLines( BPy_Text * self )
self->text->nlines = nlines; /* and update Blender, too (should we?) */
- attr = PyInt_FromLong( nlines );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Text.nlines attribute" );
+ return PyInt_FromLong( nlines );
}
static PyObject *Text_clear( BPy_Text * self)
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c
index 7522d02b355..ef17207d6ef 100644
--- a/source/blender/python/api2_2x/Texture.c
+++ b/source/blender/python/api2_2x/Texture.c
@@ -1340,18 +1340,14 @@ Tex *Texture_FromPyObject( PyObject * pyobj )
static PyObject *Texture_getExtend( BPy_Texture * self )
{
- PyObject *attr = NULL;
const char *extend = NULL;
if( EXPP_map_getStrVal
( tex_extend_map, self->texture->extend, &extend ) )
- attr = PyString_FromString( extend );
+ return PyString_FromString( extend );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid internal extend mode" );
-
- return attr;
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "invalid internal extend mode" );
}
static PyObject *Texture_getImage( BPy_Texture * self )
@@ -1367,7 +1363,6 @@ static PyObject *Texture_getImage( BPy_Texture * self )
static PyObject *Texture_oldgetSType( BPy_Texture * self )
{
- PyObject *attr = NULL;
const char *stype = NULL;
int n_stype;
@@ -1384,28 +1379,22 @@ static PyObject *Texture_oldgetSType( BPy_Texture * self )
if( EXPP_map_getStrVal( tex_stype_map[self->texture->type],
n_stype, &stype ) )
- attr = PyString_FromString( stype );
+ return PyString_FromString( stype );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"invalid texture stype internally" );
-
- return attr;
}
static PyObject *Texture_oldgetType( BPy_Texture * self )
{
- PyObject *attr = NULL;
const char *type = NULL;
if( EXPP_map_getStrVal( tex_type_map, self->texture->type, &type ) )
- attr = PyString_FromString( type );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ return PyString_FromString( type );
+
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"invalid texture type internally" );
-
- return attr;
}
static int Texture_setAnimFrames( BPy_Texture * self, PyObject * value )
@@ -1992,13 +1981,7 @@ static int Texture_setIpo( BPy_Texture * self, PyObject * value )
static PyObject *Texture_getAnimFrames( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->iuser.frames );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->iuser.frames );
}
static PyObject *Texture_getIUserCyclic( BPy_Texture *self )
@@ -2013,20 +1996,12 @@ static PyObject *Texture_getIUserCyclic( BPy_Texture *self )
/* disabled. this option was too stupid! (ton) */
static PyObject *Texture_getAnimLength( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->len );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->len );
}
static PyObject *Texture_getAnimMontage( BPy_Texture *self )
-{
- PyObject *attr;
-
- attr = Py_BuildValue( "((i,i),(i,i),(i,i),(i,i))",
+{
+ return Py_BuildValue( "((i,i),(i,i),(i,i),(i,i))",
self->texture->fradur[0][0],
self->texture->fradur[0][1],
self->texture->fradur[1][0],
@@ -2035,182 +2010,88 @@ static PyObject *Texture_getAnimMontage( BPy_Texture *self )
self->texture->fradur[2][1],
self->texture->fradur[3][0],
self->texture->fradur[3][1] );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
}
#endif
static PyObject *Texture_getAnimOffset( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->iuser.offset );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->iuser.offset );
}
static PyObject *Texture_getAnimStart( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->iuser.sfra );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->iuser.sfra );
}
static PyObject *Texture_getBrightness( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble ( self->texture->bright );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble ( self->texture->bright );
}
static PyObject *Texture_getContrast( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->contrast );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->contrast );
}
static PyObject *Texture_getCrop( BPy_Texture *self )
{
- PyObject *attr;
-
- attr = Py_BuildValue( "(f,f,f,f)",
+ return Py_BuildValue( "(f,f,f,f)",
self->texture->cropxmin,
self->texture->cropymin,
self->texture->cropxmax,
self->texture->cropymax );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
}
static PyObject *Texture_getDistAmnt( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->dist_amount );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->dist_amount );
}
static PyObject *Texture_getDistMetric( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->vn_distm );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->vn_distm );
}
static PyObject *Texture_getExp( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->vn_mexp );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->vn_mexp );
}
static PyObject *Texture_getIntExtend( BPy_Texture * self )
{
- PyObject *attr = PyInt_FromLong( self->texture->extend );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->extend );
}
static PyObject *Texture_getFieldsPerImage( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->iuser.fie_ima );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->iuser.fie_ima );
}
static PyObject *Texture_getFilterSize( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->filtersize );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->filtersize );
}
static PyObject *Texture_getFlags( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->flag );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->flag );
}
static PyObject *Texture_getHFracDim( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( (long)self->texture->mg_H );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( (long)self->texture->mg_H );
}
static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type )
{
- PyObject *attr;
-
- /*
- * type == 0 means attribute "imageFlags"
+ /* type == 0 means attribute "imageFlags"
* other types means attribute "mipmap", "calcAlpha", etc
*/
if( (int)type )
- attr = EXPP_getBitfield( &self->texture->imaflag, (int)type, 'h' );
+ return EXPP_getBitfield( &self->texture->imaflag, (int)type, 'h' );
else
- attr = PyInt_FromLong( self->texture->imaflag );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->imaflag );
}
static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *flag )
@@ -2223,231 +2104,113 @@ static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *flag )
static PyObject *Texture_getIScale( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->ns_outscale );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->ns_outscale );
}
static PyObject *Texture_getLacunarity( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->mg_lacunarity );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->mg_lacunarity );
}
static PyObject *Texture_getNoiseBasis( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->noisebasis );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->noisebasis );
}
static PyObject *Texture_getNoiseBasis2( BPy_Texture *self, void *type )
{
- PyObject *attr;
-
- /*
- * type == EXPP_TEX_NOISEBASIS2 means attribute "noiseBasis2"
+ /* type == EXPP_TEX_NOISEBASIS2 means attribute "noiseBasis2"
* other types means attribute "sine", "saw", or "tri" attribute
*/
if( (int)type == EXPP_TEX_NOISEBASIS2 )
- attr = PyInt_FromLong( self->texture->noisebasis2 );
+ return PyInt_FromLong( self->texture->noisebasis2 );
else
- attr = PyInt_FromLong( ( self->texture->noisebasis2 == (int)type ) ? 1 : 0 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( ( self->texture->noisebasis2 == (int)type ) ? 1 : 0 );
}
static PyObject *Texture_getNoiseDepth( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->noisedepth );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->noisedepth );
}
static PyObject *Texture_getNoiseSize( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->noisesize );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->noisesize );
}
static PyObject *Texture_getNoiseType( BPy_Texture *self )
{
- PyObject *attr;
-
if ( self->texture->noisetype == TEX_NOISESOFT )
- attr = PyString_FromString( "soft" );
+ return PyString_FromString( "soft" );
else
- attr = PyString_FromString( "hard" );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyString_FromString( "hard" );
}
static PyObject *Texture_getOcts( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->mg_octaves );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->mg_octaves );
}
static PyObject *Texture_getRepeat( BPy_Texture *self )
{
- PyObject *attr;
-
- attr = Py_BuildValue( "(i,i)", self->texture->xrepeat,
+ return Py_BuildValue( "(i,i)", self->texture->xrepeat,
self->texture->yrepeat );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
}
static PyObject *Texture_getRGBCol( BPy_Texture *self )
{
- PyObject *attr;
-
- attr = Py_BuildValue( "(f,f,f)", self->texture->rfac,
+ return Py_BuildValue( "(f,f,f)", self->texture->rfac,
self->texture->gfac, self->texture->bfac );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
}
static PyObject *Texture_getSType( BPy_Texture *self )
{
- PyObject *attr;
-
if( self->texture->type == TEX_VORONOI )
- attr = PyInt_FromLong( self->texture->vn_coltype );
+ return PyInt_FromLong( self->texture->vn_coltype );
#if 0
- else if( self->texture->type == TEX_MUSGRAVE )
- attr = PyInt_FromLong( self->texture->noisebasis );
+ if( self->texture->type == TEX_MUSGRAVE )
+ return PyInt_FromLong( self->texture->noisebasis );
#endif
- else if( self->texture->type == TEX_ENVMAP )
- attr = PyInt_FromLong( self->texture->env->stype );
- else
- attr = PyInt_FromLong( self->texture->stype );
+ if( self->texture->type == TEX_ENVMAP )
+ return PyInt_FromLong( self->texture->env->stype );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->stype );
}
static PyObject *Texture_getTurbulence( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->turbul );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->turbul );
}
static PyObject *Texture_getType( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->type );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->type );
}
static PyObject *Texture_getUsers( BPy_Texture *self )
{
- PyObject *attr = PyInt_FromLong( self->texture->id.us );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyInt_FromLong( self->texture->id.us );
}
static PyObject *Texture_getWeight1( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->vn_w1 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->vn_w1 );
}
static PyObject *Texture_getWeight2( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->vn_w2 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->vn_w2 );
}
static PyObject *Texture_getWeight3( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->vn_w3 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->vn_w3 );
}
static PyObject *Texture_getWeight4( BPy_Texture *self )
{
- PyObject *attr = PyFloat_FromDouble( self->texture->vn_w4 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
-
- return attr;
+ return PyFloat_FromDouble( self->texture->vn_w4 );
}
/* #####DEPRECATED###### */
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c
index aa956e15ebb..fff1a1e6bab 100644
--- a/source/blender/python/api2_2x/World.c
+++ b/source/blender/python/api2_2x/World.c
@@ -561,13 +561,7 @@ static PyObject *World_clearIpo( BPy_World * self )
static PyObject *World_getSkytype( BPy_World * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->world->skytype );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get World.skytype attribute" ) );
+ return PyInt_FromLong( ( long ) self->world->skytype );
}
@@ -600,13 +594,7 @@ static PyObject *World_oldsetSkytype( BPy_World * self, PyObject * args )
static PyObject *World_getMode( BPy_World * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->world->mode );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get World.mode attribute" ) );
+ return PyInt_FromLong( ( long ) self->world->mode );
}
@@ -640,13 +628,7 @@ static PyObject *World_oldsetMode( BPy_World * self, PyObject * args )
static PyObject *World_getMistype( BPy_World * self )
{
- PyObject *attr = PyInt_FromLong( ( long ) self->world->mistype );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get World.mistype attribute" ) );
+ return PyInt_FromLong( ( long ) self->world->mistype );
}
diff --git a/source/blender/python/api2_2x/bpy_config.c b/source/blender/python/api2_2x/bpy_config.c
index 5942ee56256..a061f31d8a0 100644
--- a/source/blender/python/api2_2x/bpy_config.c
+++ b/source/blender/python/api2_2x/bpy_config.c
@@ -89,10 +89,8 @@ static struct PyMethodDef BPy_Config_methods[] = {
*/
static PyObject *getStrAttr( BPy_Config *self, void *type )
{
- PyObject *attr = NULL;
char *param = NULL;
-
switch( (int)type ) {
case EXPP_CONF_ATTR_PATH_YF_EXPORT:
param = U.yfexportdir;
@@ -127,13 +125,7 @@ static PyObject *getStrAttr( BPy_Config *self, void *type )
"undefined type in getStrAttr" );
}
- attr = PyString_FromString( param );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyString_FromString() failed!" );
+ return PyString_FromString( param );
}
/*
@@ -195,7 +187,6 @@ static int setStrAttr( BPy_Config *self, PyObject *value, void *type )
static PyObject *getIntAttr( BPy_Config *self, void *type )
{
- PyObject *attr = NULL;
int param;
switch( (int)type ) {
@@ -220,13 +211,7 @@ static PyObject *getIntAttr( BPy_Config *self, void *type )
"undefined type in getIntAttr" );
}
- attr = PyInt_FromLong( param );
-
- if( attr )
- return attr;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyInt_FromLong() failed!" );
+ return PyInt_FromLong( param );
}
/*
diff --git a/source/blender/python/api2_2x/logic.c b/source/blender/python/api2_2x/logic.c
index 8630dcaf4f2..a09b7fa48e7 100644
--- a/source/blender/python/api2_2x/logic.c
+++ b/source/blender/python/api2_2x/logic.c
@@ -175,28 +175,18 @@ static void Property_dealloc( BPy_Property * self )
//---------------getattr--------------------------------------------
static PyObject *Property_getAttr( BPy_Property * self, char *name )
{
- PyObject *attr = Py_None;
-
checkValidData_ptr( self );
if( strcmp( name, "name" ) == 0 )
- attr = Property_getName( self );
+ return Property_getName( self );
else if( strcmp( name, "data" ) == 0 )
- attr = Property_getData( self );
+ return Property_getData( self );
else if( strcmp( name, "type" ) == 0 )
- attr = Property_getType( self );
+ return Property_getType( self );
else if( strcmp( name, "__members__" ) == 0 ) {
- attr = Py_BuildValue( "[s,s,s]", "name", "data", "type" );
+ return Py_BuildValue( "[s,s,s]", "name", "data", "type" );
}
- if( !attr )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError, "couldn't create PyObject" ) );
-
- if( attr != Py_None )
- return attr;
-
- return Py_FindMethod( BPy_Property_methods, ( PyObject * ) self,
- name );
+ return Py_FindMethod( BPy_Property_methods, ( PyObject * ) self, name );
}
//--------------- setattr-------------------------------------------
@@ -380,18 +370,10 @@ PyObject *newPropertyObject( char *name, PyObject * data, int type )
//--------------- BPy_Property.getName()----------------------------
static PyObject *Property_getName( BPy_Property * self )
{
- PyObject *attr = NULL;
-
if( !self->property )
- attr = PyString_FromString( self->name );
+ return PyString_FromString( self->name );
else
- attr = PyString_FromString( self->property->name );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Property.name attribute" ) );
+ return PyString_FromString( self->property->name );
}
//--------------- BPy_Property.setName()----------------------------
@@ -410,7 +392,7 @@ static PyObject *Property_setName( BPy_Property * self, PyObject * value )
updatePyProperty( self );
}
- return EXPP_incr_ret( Py_None );
+ Py_RETURN_NONE;
}
//--------------- BPy_Property.getData()----------------------------
@@ -441,7 +423,7 @@ static PyObject *Property_getData( BPy_Property * self )
return attr;
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Property.name attribute" ) );
+ "couldn't get Property.data attribute" ) );
}
//--------------- BPy_Property.setData()----------------------------
@@ -520,13 +502,12 @@ static PyObject *Property_setData( BPy_Property * self, PyObject * args )
} else {
self->data = data;
}
- return EXPP_incr_ret( Py_None );
+ Py_RETURN_NONE;
}
//--------------- BPy_Property.getType()----------------------------
static PyObject *Property_getType( BPy_Property * self )
{
- PyObject *attr = Py_None;
int type;
if( self->property )
@@ -535,15 +516,14 @@ static PyObject *Property_getType( BPy_Property * self )
type = self->type;
if( type == PROP_BOOL )
- attr = PyString_FromString( "BOOL" );
+ return PyString_FromString( "BOOL" );
else if( type == PROP_INT )
- attr = PyString_FromString( "INT" );
+ return PyString_FromString( "INT" );
else if( type == PROP_FLOAT )
- attr = PyString_FromString( "FLOAT" );
+ return PyString_FromString( "FLOAT" );
else if( type == PROP_STRING )
- attr = PyString_FromString( "STRING" );
+ return PyString_FromString( "STRING" );
else if( type == PROP_TIME )
- attr = PyString_FromString( "TIME" );
-
- return attr;
+ return PyString_FromString( "TIME" );
+ Py_RETURN_NONE;
}
diff --git a/source/blender/python/api2_2x/rgbTuple.c b/source/blender/python/api2_2x/rgbTuple.c
index cdd05a60917..daa6950536f 100644
--- a/source/blender/python/api2_2x/rgbTuple.c
+++ b/source/blender/python/api2_2x/rgbTuple.c
@@ -138,12 +138,8 @@ PyObject *rgbTuple_New( float *rgb[3] )
/*****************************************************************************/
PyObject *rgbTuple_getCol( BPy_rgbTuple * self )
{
- PyObject *attr = Py_BuildValue( "[fff]", *(self->rgb[0]),
+ return Py_BuildValue( "[fff]", *(self->rgb[0]),
*(self->rgb[1]), *(self->rgb[2]));
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Py_BuildValue() failed" );
- return attr;
}
int rgbTuple_setCol( BPy_rgbTuple * self, PyObject * args )
diff --git a/source/blender/python/api2_2x/windowTheme.c b/source/blender/python/api2_2x/windowTheme.c
index c8adec8e7a3..182a147e86d 100644
--- a/source/blender/python/api2_2x/windowTheme.c
+++ b/source/blender/python/api2_2x/windowTheme.c
@@ -807,15 +807,10 @@ static void Theme_dealloc( BPy_Theme * self )
static PyObject *Theme_getAttr( BPy_Theme * self, char *name )
{
- PyObject *attr = Py_None;
-
if( !strcmp( name, "name" ) )
- attr = PyString_FromString( self->theme->name );
+ return PyString_FromString( self->theme->name );
else if( !strcmp( name, "__members__" ) )
- attr = Py_BuildValue( "[s]", "name" );
-
- if( attr != Py_None )
- return attr;
+ return Py_BuildValue( "[s]", "name" );
return Py_FindMethod( BPy_Theme_methods, ( PyObject * ) self, name );
}