made all python types that can do .__copy__(), also do .copy()
added copy function to lamp, texture and ipo types
This commit is contained in:
@@ -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
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 );
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user