diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 09:01:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 09:01:31 +0300 |
commit | c42f3b4e59177984b975d493155ebda31af3f894 (patch) | |
tree | c394bbb008ec49c96f30d24a16a13733c3e8ff7c /source | |
parent | 5f5fb5061bb92f31e1c17c0495b871d2600cd6cc (diff) |
support for mathutils GC wasn't complete since PyObject_GC_Track is supposed to be called once the fields are filled in.
Diffstat (limited to 'source')
5 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c index 6e699429feb..aa5d6e1b817 100644 --- a/source/blender/python/generic/mathutils_Color.c +++ b/source/blender/python/generic/mathutils_Color.c @@ -109,7 +109,7 @@ static PyObject *Color_copy(ColorObject *self) static PyObject *Color_repr(ColorObject * self) { PyObject *ret, *tuple; - + if(BaseMath_ReadCallback(self) == -1) return NULL; @@ -556,6 +556,7 @@ PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; self->cb_subtype= (unsigned char)cb_subtype; + PyObject_GC_Track(self); } return (PyObject *)self; diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c index 03d94f77269..13a93260267 100644 --- a/source/blender/python/generic/mathutils_Euler.c +++ b/source/blender/python/generic/mathutils_Euler.c @@ -695,6 +695,7 @@ PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_ self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; self->cb_subtype= (unsigned char)cb_subtype; + PyObject_GC_Track(self); } return (PyObject *)self; diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index aeefd420a0b..8ff38205819 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -1895,6 +1895,7 @@ PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; self->cb_subtype= (unsigned char)cb_subtype; + PyObject_GC_Track(self); } return (PyObject *) self; } diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c index 7e9191004cc..c5fb7e61e6d 100644 --- a/source/blender/python/generic/mathutils_Quaternion.c +++ b/source/blender/python/generic/mathutils_Quaternion.c @@ -1124,6 +1124,7 @@ PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; self->cb_subtype= (unsigned char)cb_subtype; + PyObject_GC_Track(self); } return (PyObject *)self; diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c index f9eabd28bfb..946f034f81f 100644 --- a/source/blender/python/generic/mathutils_Vector.c +++ b/source/blender/python/generic/mathutils_Vector.c @@ -2001,7 +2001,7 @@ axis_dict = {} axis_pos = {'x':0, 'y':1, 'z':2, 'w':3} axises = 'xyzw' while len(axises) >= 2: - + for axis_0 in axises: axis_0_pos = axis_pos[axis_0] for axis_1 in axises: @@ -2015,7 +2015,7 @@ while len(axises) >= 2: for axis_3 in axises: axis_3_pos = axis_pos[axis_3] axis_dict[axis_0+axis_1+axis_2+axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos) - + axises = axises[:-1] @@ -2053,7 +2053,7 @@ static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObj vec_cpy[3] = 1.0f; } } - + if(BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1) return -1; @@ -2085,7 +2085,7 @@ static PyObject *Vector_negate(VectorObject *self) { if(BaseMath_ReadCallback(self) == -1) return NULL; - + negate_vn(self->vec, self->size); (void)BaseMath_WriteCallback(self); // already checked for error @@ -2128,7 +2128,7 @@ static struct PyMethodDef Vector_methods[] = { /* Note Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing - but this means for eg that + but this means for eg that vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order */ @@ -2169,7 +2169,7 @@ PyTypeObject vector_Type = { NULL, /* PyBufferProcs *tp_as_buffer; */ /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, vector_doc, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ @@ -2275,6 +2275,7 @@ PyObject *newVectorObject_cb(PyObject *cb_user, int size, int cb_type, int cb_su self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; self->cb_subtype= (unsigned char)cb_subtype; + PyObject_GC_Track(self); } return (PyObject *)self; |