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/Lamp.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/Lamp.c')
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index eb7b353d089..4e2638921fc 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -228,6 +228,7 @@ static PyObject *Lamp_oldsetHaloInt( BPy_Lamp * self, PyObject * args ); static PyObject *Lamp_oldsetQuad1( BPy_Lamp * self, PyObject * args ); static PyObject *Lamp_oldsetQuad2( BPy_Lamp * self, PyObject * args ); static PyObject *Lamp_oldsetCol( BPy_Lamp * self, PyObject * args ); +static PyObject *Lamp_copy( BPy_Lamp * self ); static int Lamp_setIpo( BPy_Lamp * self, PyObject * args ); static int Lamp_setType( BPy_Lamp * self, PyObject * args ); static int Lamp_setMode( BPy_Lamp * self, PyObject * args ); @@ -367,7 +368,10 @@ static PyMethodDef BPy_Lamp_methods[] = { "( lamp-ipo ) - link an IPO to this lamp"}, {"insertIpoKey", ( PyCFunction ) Lamp_insertIpoKey, METH_VARARGS, "( Lamp IPO type ) - Inserts a key into IPO"}, - + {"__copy__", ( PyCFunction ) Lamp_copy, METH_NOARGS, + "() - Makes a copy of this lamp."}, + {"copy", ( PyCFunction ) Lamp_copy, METH_NOARGS, + "() - Makes a copy of this lamp."}, {NULL, NULL, 0, NULL} }; @@ -856,6 +860,15 @@ Lamp *Lamp_FromPyObject( PyObject * pyobj ) /*****************************************************************************/ /* Python BPy_Lamp methods: */ /*****************************************************************************/ + +/* Lamp.__copy__ */ +static PyObject *Lamp_copy( BPy_Lamp * self ) +{ + Lamp *lamp = copy_lamp(self->lamp ); + lamp->id.us = 0; + return Lamp_CreatePyObject(lamp); +} + static PyObject *Lamp_getType( BPy_Lamp * self ) { PyObject *attr = PyInt_FromLong( self->lamp->type ); |