diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-08 17:37:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-08 17:37:34 +0300 |
commit | 5eaf9f90c1acc1b337a3fee38887f5db2a46ac81 (patch) | |
tree | 6c2608c7d77487761dfeefc0caf15be68dd64b0b /source/blender/python/api2_2x/World.c | |
parent | 51c16edabc18a13e91bee1a35cbe39eb1e911ea3 (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/World.c')
-rw-r--r-- | source/blender/python/api2_2x/World.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index cb7dee16194..95436027f8c 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -522,35 +522,7 @@ static PyObject *World_getIpo( BPy_World * self ) static int World_setIpo( BPy_World * self, PyObject * value ) { - Ipo *ipo = NULL; - Ipo *oldipo; - - if( !BPy_Ipo_Check(value) ) - return EXPP_ReturnIntError( PyExc_TypeError, - "expected Ipo as argument" ); - - ipo = Ipo_FromPyObject( value ); - - if( !ipo ) - return EXPP_ReturnIntError( PyExc_RuntimeError, - "null ipo!" ); - - if( ipo->blocktype != ID_WO ) - return EXPP_ReturnIntError( PyExc_TypeError, - "this ipo is not a World type ipo" ); - - oldipo = self->world->ipo; - if( oldipo ) { - ID *id = &oldipo->id; - if( id->us > 0 ) - id->us--; - } - - id_us_plus(&ipo->id); - - self->world->ipo = ipo; - - return 0; + return GenericLib_assignData(value, (void **) &self->world->ipo, 0, 1, ID_IP, ID_WO); } static PyObject *World_oldsetIpo( BPy_World * self, PyObject * args ) |