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>2006-08-16 18:06:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-08-16 18:06:24 +0400
commit9ef3e8092bf5185fa67ab45be5a769b04490c787 (patch)
treef28b2c48911eb82c9eb6893d5ffd26b5d8d7f9fa /source/blender/python/api2_2x/World.c
parentb92837c7c36d1f8d890c66e3693ea1c24efd8c9c (diff)
Added python __copy__ to Camera, Lattice, Metaball and World.
Diffstat (limited to 'source/blender/python/api2_2x/World.c')
-rw-r--r--source/blender/python/api2_2x/World.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c
index 2e3e6d2d136..6d097ba62e2 100644
--- a/source/blender/python/api2_2x/World.c
+++ b/source/blender/python/api2_2x/World.c
@@ -95,6 +95,7 @@ static PyObject *World_getScriptLinks( BPy_World * self, PyObject * args );
static PyObject *World_addScriptLink( BPy_World * self, PyObject * args );
static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args );
static PyObject *World_setCurrent( BPy_World * self );
+static PyObject *World_copy( BPy_World * self );
/*****************************************************************************/
@@ -222,6 +223,8 @@ static PyMethodDef BPy_World_methods[] = {
"please use setCurrent instead, this alias will be removed."},
{"insertIpoKey", ( PyCFunction ) World_insertIpoKey, METH_VARARGS,
"( World IPO type ) - Inserts a key into the IPO"},
+ {"__copy__", ( PyCFunction ) World_copy, METH_NOARGS,
+ "() - Makes a copy of this world."},
{NULL, NULL, 0, NULL}
};
@@ -897,6 +900,33 @@ static PyObject *World_setCurrent( BPy_World * self )
return Py_None;
}
+/* 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;
+}
+
/*@{*/