added __copy__ to mesh and object types, fixed a monor bug in setTexMesh and made Mesh.c use G.totMesh properly.

This commit is contained in:
2006-08-13 01:51:47 +00:00
parent f27acb2e7c
commit 515fe83f97
2 changed files with 50 additions and 4 deletions

View File

@@ -323,6 +323,7 @@ static PyObject *Object_setSBStiffQuads( BPy_Object * self, PyObject * args );
static PyObject *Object_insertShapeKey(BPy_Object * self);
static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args );
static PyObject *Object_convertActionToStrip( BPy_Object * self );
static PyObject *Object_copy(BPy_Object * self); /* __copy__ */
/*****************************************************************************/
/* Python BPy_Object methods table: */
@@ -645,8 +646,10 @@ works only if self and the object specified are of the same type."},
METH_VARARGS,
"() - Delete all scriptlinks from this object.\n"
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this object."},
{"insertShapeKey", ( PyCFunction ) Object_insertShapeKey,
METH_NOARGS, "() - Insert a Shape Key in the current 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."},
{NULL, NULL, 0, NULL}
};
@@ -3397,6 +3400,22 @@ static PyObject *Object_insertShapeKey(BPy_Object * self)
return Py_None;
}
/* __copy__() */
static PyObject *Object_copy(BPy_Object * self)
{
/* copy_object never returns NULL */
struct Object *object= copy_object( self->object );
object->id.us= 0; /*is 1 by default, not sure why */
/* Create a Python object from it. */
return Object_CreatePyObject( object );
}
/*****************************************************************************/
/* Function: Object_CreatePyObject */
/* Description: This function will create a new BlenObject from an existing */