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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-03-14 06:01:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-03-14 06:01:24 +0300
commit5c5a80f6443e97eb38717b108e7797589dda34d7 (patch)
treed99416d0b1e0a1ef68267faeb0ec55408dc289a8 /source
parentd3ae4b9944c17e14a489255901a32dc8a77246e5 (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')
-rw-r--r--source/blender/python/api2_2x/Armature.c2
-rw-r--r--source/blender/python/api2_2x/Camera.c2
-rw-r--r--source/blender/python/api2_2x/Curve.c2
-rwxr-xr-xsource/blender/python/api2_2x/Group.c2
-rw-r--r--source/blender/python/api2_2x/Ipo.c16
-rw-r--r--source/blender/python/api2_2x/Lamp.c15
-rw-r--r--source/blender/python/api2_2x/Lattice.c2
-rw-r--r--source/blender/python/api2_2x/Material.c2
-rw-r--r--source/blender/python/api2_2x/Mesh.c2
-rw-r--r--source/blender/python/api2_2x/Metaball.c2
-rw-r--r--source/blender/python/api2_2x/Object.c6
-rw-r--r--source/blender/python/api2_2x/Texture.c13
-rw-r--r--source/blender/python/api2_2x/World.c27
-rw-r--r--source/blender/python/api2_2x/sceneSequence.c2
14 files changed, 69 insertions, 26 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index 49c7c6639d4..42f968e3e89 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -946,6 +946,8 @@ static PyMethodDef BPy_Armature_methods[] = {
"() - Rebuilds the armature based on changes to bones since the last call to makeEditable"},
{"__copy__", (PyCFunction) Armature_copy, METH_NOARGS,
"() - Return a copy of the armature."},
+ {"copy", (PyCFunction) Armature_copy, METH_NOARGS,
+ "() - Return a copy of the armature."},
{NULL, NULL, 0, NULL}
};
//------------------------tp_getset
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index 64951cc38b4..96212956a63 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -195,6 +195,8 @@ static PyMethodDef BPy_Camera_methods[] = {
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this camera."},
{"__copy__", ( PyCFunction ) Camera_copy, METH_NOARGS,
"() - Return a copy of the camera."},
+ {"copy", ( PyCFunction ) Camera_copy, METH_NOARGS,
+ "() - Return a copy of the camera."},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
index 872dbe5b75f..c74afd29604 100644
--- a/source/blender/python/api2_2x/Curve.c
+++ b/source/blender/python/api2_2x/Curve.c
@@ -1519,6 +1519,8 @@ Sets a control point "},
"() - assign a Taper Object to this Curve"},
{"__copy__", ( PyCFunction ) Curve_copy, METH_NOARGS,
"() - make a copy of this curve data"},
+ {"copy", ( PyCFunction ) Curve_copy, METH_NOARGS,
+ "() - make a copy of this curve data"},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index adee39030b3..f52afacdebf 100755
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -86,6 +86,8 @@ static PyMethodDef BPy_Group_methods[] = {
/* name, method, flags, doc */
{"__copy__", ( PyCFunction ) BPy_Group_copy, METH_VARARGS,
"() - Return a copy of the group containing the same objects."},
+ {"copy", ( PyCFunction ) BPy_Group_copy, METH_VARARGS,
+ "() - Return a copy of the group containing the same objects."},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 8bbcc1dce6b..4c65f31cfe3 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -36,6 +36,7 @@
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
+#include "BKE_object.h"
#include "BKE_ipo.h"
#include "BLI_blenlib.h"
#include "BIF_space.h"
@@ -115,6 +116,7 @@ static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args );
static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args );
static PyObject *Ipo_getChannel( BPy_Ipo * self );
+static PyObject *Ipo_copy( BPy_Ipo * self );
static int Ipo_setChannel( BPy_Ipo * self, PyObject * args );
static int Ipo_length( BPy_Ipo * inst );
@@ -164,6 +166,12 @@ static PyMethodDef BPy_Ipo_methods[] = {
"(int,int) - deprecated: see ipocurve.bezierPoints[]"},
{"setCurveBeztriple", ( PyCFunction ) Ipo_setCurveBeztriple, METH_VARARGS,
"(int,int,list) - set a BezTriple"},
+
+ {"__copy__", ( PyCFunction ) Ipo_copy, METH_NOARGS,
+ "() - copy the ipo"},
+ {"copy", ( PyCFunction ) Ipo_copy, METH_NOARGS,
+ "() - copy the ipo"},
+
{NULL, NULL, 0, NULL}
};
@@ -1761,6 +1769,14 @@ static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args )
return Py_None;
}
+/* Ipo.__copy__ */
+static PyObject *Ipo_copy( BPy_Ipo * self )
+{
+ Ipo *ipo = copy_ipo(self->ipo );
+ ipo->id.us = 0;
+ return Ipo_CreatePyObject(ipo);
+}
+
static PyObject *Ipo_EvaluateCurveOn( BPy_Ipo * self, PyObject * args )
{
int num = 0, i;
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 );
diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c
index bd6e73dc303..f179839cd68 100644
--- a/source/blender/python/api2_2x/Lattice.c
+++ b/source/blender/python/api2_2x/Lattice.c
@@ -668,6 +668,8 @@ static PyMethodDef BPy_Lattice_methods[] = {
Lattice_insertKey_doc},
{"__copy__", ( PyCFunction ) Lattice_copy, METH_NOARGS,
Lattice_copy_doc},
+ {"copy", ( PyCFunction ) Lattice_copy, METH_NOARGS,
+ Lattice_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 6a2ee287e9a..092992c42f3 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -816,6 +816,8 @@ static PyMethodDef BPy_Material_methods[] = {
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this material."},
{"__copy__", ( PyCFunction ) Material_copy, METH_NOARGS,
"() - Return a copy of the material."},
+ {"copy", ( PyCFunction ) Material_copy, METH_NOARGS,
+ "() - Return a copy of the material."},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index ff0fff439d1..25b0c3d366e 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -7050,6 +7050,8 @@ static struct PyMethodDef BPy_Mesh_methods[] = {
/* python standard class functions */
{"__copy__", (PyCFunction)Mesh_copy, METH_NOARGS,
"Return a copy of the mesh"},
+ {"copy", (PyCFunction)Mesh_copy, METH_NOARGS,
+ "Return a copy of the mesh"},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c
index f7629707ea3..04a1be46485 100644
--- a/source/blender/python/api2_2x/Metaball.c
+++ b/source/blender/python/api2_2x/Metaball.c
@@ -141,6 +141,8 @@ static PyMethodDef BPy_Metaball_methods[] = {
/* name, method, flags, doc */
{"__copy__", ( PyCFunction ) Metaball_copy,
METH_NOARGS, "() - Return a copy of this metaball"},
+ {"copy", ( PyCFunction ) Metaball_copy,
+ METH_NOARGS, "() - Return a copy of this metaball"},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 600de0b7ba0..50f92474018 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -756,10 +756,12 @@ works only if self and the object specified are of the same type."},
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this object."},
{"insertShapeKey", ( PyCFunction ) Object_insertShapeKey, METH_NOARGS,
"() - Insert a Shape Key in the current object"},
- {"__copy__", ( PyCFunction ) Object_copy, METH_NOARGS,
- "() - Return a copy of this object."},
{"getProperties", ( PyCFunction ) Object_GetProperties, METH_NOARGS,
"() return a reference to the ID properties associated with this object."},
+ {"__copy__", ( PyCFunction ) Object_copy, METH_NOARGS,
+ "() - Return a copy of this object."},
+ {"copy", ( PyCFunction ) Object_copy, METH_NOARGS,
+ "() - Return a copy of this object."},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c
index 843c0dbb24d..909efcc680b 100644
--- a/source/blender/python/api2_2x/Texture.c
+++ b/source/blender/python/api2_2x/Texture.c
@@ -499,7 +499,7 @@ static int Texture_setNoiseBasis2( BPy_Texture *self, PyObject *args,
static PyObject *Texture_getColorband( BPy_Texture * self);
int Texture_setColorband( BPy_Texture * self, PyObject * value);
static PyObject *Texture_evaluate( BPy_Texture *self, PyObject *args );
-
+static PyObject *Texture_copy( BPy_Texture *self );
/*****************************************************************************/
/* Python BPy_Texture methods table: */
@@ -544,6 +544,10 @@ static PyMethodDef BPy_Texture_methods[] = {
"(s) - Set Dist Metric"},
{"evaluate", ( PyCFunction ) Texture_evaluate, METH_VARARGS,
"(vector) - evaluate the texture at this position"},
+ {"__copy__", ( PyCFunction ) Texture_copy, METH_NOARGS,
+ "() - return a copy of the the texture"},
+ {"copy", ( PyCFunction ) Texture_copy, METH_NOARGS,
+ "() - return a copy of the the texture"},
{NULL, NULL, 0, NULL}
};
@@ -2731,3 +2735,10 @@ static PyObject *Texture_evaluate( BPy_Texture * self, PyObject * args )
return newVectorObject(vec, 4, Py_NEW);
}
+
+static PyObject *Texture_copy( BPy_Texture * self )
+{
+ Tex *tex = copy_texture(self->texture );
+ tex->id.us = 0;
+ return Texture_CreatePyObject(tex);
+}
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);
}
diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c
index ef01d58677b..1ef88c4353a 100644
--- a/source/blender/python/api2_2x/sceneSequence.c
+++ b/source/blender/python/api2_2x/sceneSequence.c
@@ -95,6 +95,8 @@ static PyMethodDef BPy_Sequence_methods[] = {
"(data) - Remove a strip."},
{"__copy__", ( PyCFunction ) Sequence_copy, METH_NOARGS,
"() - Return a copy of the sequence containing the same objects."},
+ {"copy", ( PyCFunction ) Sequence_copy, METH_NOARGS,
+ "() - Return a copy of the sequence containing the same objects."},
{NULL, NULL, 0, NULL}
};