diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-08-16 18:06:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-08-16 18:06:24 +0400 |
commit | 9ef3e8092bf5185fa67ab45be5a769b04490c787 (patch) | |
tree | f28b2c48911eb82c9eb6893d5ffd26b5d8d7f9fa /source/blender/python/api2_2x/Lattice.c | |
parent | b92837c7c36d1f8d890c66e3693ea1c24efd8c9c (diff) |
Added python __copy__ to Camera, Lattice, Metaball and World.
Diffstat (limited to 'source/blender/python/api2_2x/Lattice.c')
-rw-r--r-- | source/blender/python/api2_2x/Lattice.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c index 117699adeb7..a85a69c4be2 100644 --- a/source/blender/python/api2_2x/Lattice.c +++ b/source/blender/python/api2_2x/Lattice.c @@ -99,6 +99,7 @@ static PyObject *Lattice_setPoint( BPy_Lattice * self, PyObject * args ); static PyObject *Lattice_getPoint( BPy_Lattice * self, PyObject * args ); static PyObject *Lattice_applyDeform( BPy_Lattice * self, PyObject *args ); static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args ); +static PyObject *Lattice_copy( BPy_Lattice * self ); /*****************************************************************************/ /* Lattice Strings */ @@ -146,6 +147,9 @@ mode). If forced, the deformation will be applied over any previous one(s)."; static char Lattice_insertKey_doc[] = "(str) - Set a new key for the lattice at specified frame"; +static char Lattice_copy_doc[] = + "() - Return a copy of the lattice."; + /*****************************************************************************/ /* Python BPy_Lattice methods table: */ /*****************************************************************************/ @@ -177,6 +181,8 @@ static PyMethodDef BPy_Lattice_methods[] = { Lattice_applyDeform_doc}, {"insertKey", ( PyCFunction ) Lattice_insertKey, METH_VARARGS, Lattice_insertKey_doc}, + {"__copy__", ( PyCFunction ) Lattice_copy, METH_NOARGS, + Lattice_copy_doc}, {NULL, NULL, 0, NULL} }; @@ -769,6 +775,26 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args ) return Py_None; } +static PyObject *Lattice_copy( BPy_Lattice * self ) +{ + Lattice *bl_Lattice; // blender Lattice object + PyObject *py_Lattice; // python wrapper + + bl_Lattice = copy_lattice( self->Lattice ); + bl_Lattice->id.us = 0; + + if( bl_Lattice ) + py_Lattice = Lattice_CreatePyObject( bl_Lattice ); + else + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't create Lattice Object in Blender" ); + if( !py_Lattice ) + return EXPP_ReturnPyObjError( PyExc_MemoryError, + "couldn't create Lattice Object wrapper" ); + + return py_Lattice; +} + //*************************************************************************** // Function: Lattice_dealloc // Description: This is a callback function for the BPy_Lattice type. It is |