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/Texture.c
parent684869fd74a3a908a5df5802f440bfa823f6c802 (diff)
remove unneeded checks from the python API
Diffstat (limited to 'source/blender/python/api2_2x/Texture.c')
-rw-r--r--source/blender/python/api2_2x/Texture.c347
1 files changed, 55 insertions, 292 deletions
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###### */