diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-14 06:01:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-14 06:01:24 +0300 |
commit | 5c5a80f6443e97eb38717b108e7797589dda34d7 (patch) | |
tree | d99416d0b1e0a1ef68267faeb0ec55408dc289a8 /source/blender/python/api2_2x/World.c | |
parent | d3ae4b9944c17e14a489255901a32dc8a77246e5 (diff) |
made all python types that can do .__copy__(), also do .copy()
added copy function to lamp, texture and ipo types
Diffstat (limited to 'source/blender/python/api2_2x/World.c')
-rw-r--r-- | source/blender/python/api2_2x/World.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 32cc16c73ba..3c212c5f192 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -230,6 +230,8 @@ static PyMethodDef BPy_World_methods[] = { "( World IPO type ) - Inserts a key into the IPO"}, {"__copy__", ( PyCFunction ) World_copy, METH_NOARGS, "() - Makes a copy of this world."}, + {"copy", ( PyCFunction ) World_copy, METH_NOARGS, + "() - Makes a copy of this world."}, {NULL, NULL, 0, NULL} }; @@ -901,28 +903,9 @@ static PyObject *World_setCurrent( BPy_World * self ) /* world.__copy__ */ static PyObject *World_copy( BPy_World * self ) { - BPy_World *pyworld; - World *blworld; - - blworld = copy_world( self->world ); - - if( blworld ) { - /* return user count to zero because add_world() inc'd it */ - blworld->id.us = 0; - /* create python wrapper obj */ - pyworld = - ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type ); - } else - return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, - "couldn't create World Data in Blender" ) ); - - if( pyworld == NULL ) - return ( EXPP_ReturnPyObjError( PyExc_MemoryError, - "couldn't create World Data object" ) ); - - pyworld->world = blworld; - - return ( PyObject * ) pyworld; + World *world = copy_world(self->world ); + world->id.us = 0; + return World_CreatePyObject(world); } |