diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-30 15:35:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-30 15:35:58 +0400 |
commit | 89b83f00608dfb2a7750476035f0635885473d21 (patch) | |
tree | 4f11557bb830061c37826aacb6fa54f8213cd609 /source/blender/python/mathutils/mathutils_Vector.c | |
parent | 785373b03abd7bfd258a50a0f274c81229fbf98a (diff) |
patch to add __deepcopy__ to mathutils types, this is no different to __copy__, except some py utilities expect __deepcopy__ to exist, so better have them.
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Vector.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index fbf30bcb387..17fa9cdd802 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -47,6 +47,7 @@ #define SWIZZLE_AXIS 0x3 static PyObject *Vector_copy(VectorObject *self); +static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args); static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits); static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat); @@ -1211,6 +1212,12 @@ static PyObject *Vector_copy(VectorObject *self) return Vector_CreatePyObject(self->vec, self->size, Py_NEW, Py_TYPE(self)); } +static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args) +{ + if (!mathutils_deepcopy_args_check(args)) + return NULL; + return Vector_copy(self); +} static PyObject *Vector_repr(VectorObject *self) { @@ -2767,6 +2774,7 @@ static struct PyMethodDef Vector_methods[] = { {"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc}, {"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, NULL}, + {"__deepcopy__", (PyCFunction) Vector_deepcopy, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; |