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_Quaternion.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_Quaternion.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index da27c7a57bb..2a1cef5a241 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -42,6 +42,7 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self); static void quat__axis_angle_sanitize(float axis[3], float *angle); static PyObject *Quaternion_copy(QuaternionObject *self); +static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args); //-----------------------------METHODS------------------------------ @@ -478,6 +479,12 @@ static PyObject *Quaternion_copy(QuaternionObject *self) return Quaternion_CreatePyObject(self->quat, Py_NEW, Py_TYPE(self)); } +static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args) +{ + if (!mathutils_deepcopy_args_check(args)) + return NULL; + return Quaternion_copy(self); +} //----------------------------print object (internal)-------------- //print the object to screen @@ -1157,8 +1164,9 @@ static struct PyMethodDef Quaternion_methods[] = { {"slerp", (PyCFunction) Quaternion_slerp, METH_VARARGS, Quaternion_slerp_doc}, {"rotate", (PyCFunction) Quaternion_rotate, METH_O, Quaternion_rotate_doc}, - {"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc}, {"copy", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc}, + {"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc}, + {"__deepcopy__", (PyCFunction) Quaternion_deepcopy, METH_VARARGS, Quaternion_copy_doc}, {NULL, NULL, 0, NULL} }; |