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-03-08 17:37:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-03-08 17:37:34 +0300
commit5eaf9f90c1acc1b337a3fee38887f5db2a46ac81 (patch)
tree6c2608c7d77487761dfeefc0caf15be68dd64b0b /source/blender/python/api2_2x/MTex.c
parent51c16edabc18a13e91bee1a35cbe39eb1e911ea3 (diff)
BPython API
added a function - GenericLib_assignData for assigning blender data, to assign an ipo to a camera or world to a scene for instance. Using this function removed ~300 lines of code. also fixes user count error in some places that didnt check. also made it possible to clear the colorband by setting it to []
Diffstat (limited to 'source/blender/python/api2_2x/MTex.c')
-rw-r--r--source/blender/python/api2_2x/MTex.c66
1 files changed, 3 insertions, 63 deletions
diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c
index 71e60c9ec3f..c345cf30fc0 100644
--- a/source/blender/python/api2_2x/MTex.c
+++ b/source/blender/python/api2_2x/MTex.c
@@ -283,27 +283,7 @@ int MTex_CheckPyObject( PyObject * pyobj )
static PyObject *MTex_setTexMethod( BPy_MTex * self, PyObject * args )
{
- Tex *tex;
-
- if( args == Py_None )
- {
- tex = NULL;
- } else if( Texture_CheckPyObject( args ) ) {
- tex = Texture_FromPyObject( args );
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Texture argument" );
- }
-
- if( self->mtex->tex )
- self->mtex->tex->id.us--;
-
- self->mtex->tex = tex;
-
- if( self->mtex->tex )
- self->mtex->tex->id.us++;
-
- Py_RETURN_NONE;
+ return EXPP_setterWrapper( (void *)self, args, (setter)MTex_setTex );
}
static void MTex_dealloc( BPy_MTex * self )
@@ -336,27 +316,7 @@ static PyObject *MTex_getTex( BPy_MTex *self, void *closure )
static int MTex_setTex( BPy_MTex *self, PyObject *value, void *closure)
{
- Tex *tex;
-
- if( value == Py_None )
- {
- tex = NULL;
- } else if( Texture_CheckPyObject( value ) ) {
- tex = Texture_FromPyObject( value );
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected Texture argument" );
- }
-
- if( self->mtex->tex )
- self->mtex->tex->id.us--;
-
- self->mtex->tex = tex;
-
- if( self->mtex->tex )
- self->mtex->tex->id.us++;
-
- return 0;
+ return GenericLib_assignData(value, (void **) &self->mtex->tex, 0, 1, ID_TE, 0);
}
static PyObject *MTex_getTexCo( BPy_MTex *self, void *closure )
@@ -397,27 +357,7 @@ static PyObject *MTex_getObject( BPy_MTex *self, void *closure )
static int MTex_setObject( BPy_MTex *self, PyObject *value, void *closure)
{
- Object *obj;
-
- if( value == Py_None )
- {
- obj = NULL;
- } else if( Object_CheckPyObject( value ) ) {
- obj = Object_FromPyObject( value );
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected Object argument" );
- }
-
- if( self->mtex->object )
- self->mtex->object->id.us--;
-
- self->mtex->object = obj;
-
- if( self->mtex->object )
- self->mtex->object->id.us++;
-
- return 0;
+ return GenericLib_assignData(value, (void **) &self->mtex->object, 0, 1, ID_OB, 0);
}
static PyObject *MTex_getUVLayer( BPy_MTex *self, void *closure )