diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-11-07 18:09:54 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-11-07 18:09:54 +0300 |
commit | b6b888f7fb706487d9e5ae6b0738201da5493b9f (patch) | |
tree | 852f79b4532a1b93e75c2541ca0d181b00de08a2 /source/blender/python/mathutils | |
parent | a2377b60548f2fe5d46b14ecdf4cf83971432b5c (diff) | |
parent | 95631c94c4bd08f8a7e9c713f624e934eb7eb7ae (diff) |
Merge branch 'master' into gpencil-new-data-proposalgpencil-new-data-proposal
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.c | 202 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.c | 132 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 284 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 204 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 233 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_bvhtree.c | 95 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_kdtree.c | 96 |
7 files changed, 643 insertions, 603 deletions
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 5218ea68f7b..e4f1ea87563 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -825,59 +825,61 @@ static PyObject *Color_neg(ColorObject *self) * \{ */ static PySequenceMethods Color_SeqMethods = { - (lenfunc)Color_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Color_item, /*sq_item*/ - NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Color_ass_item, /*sq_ass_item*/ - NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Color_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Color_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Color_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Color_AsMapping = { - (lenfunc)Color_len, - (binaryfunc)Color_subscript, - (objobjargproc)Color_ass_subscript, + /*mp_len*/ (lenfunc)Color_len, + /*mp_subscript*/ (binaryfunc)Color_subscript, + /*mp_ass_subscript*/ (objobjargproc)Color_ass_subscript, }; static PyNumberMethods Color_NumMethods = { - (binaryfunc)Color_add, /*nb_add*/ - (binaryfunc)Color_sub, /*nb_subtract*/ - (binaryfunc)Color_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Color_neg, /*nb_negative*/ - (unaryfunc)Color_copy, /*tp_positive*/ - (unaryfunc)NULL, /*tp_absolute*/ - (inquiry)NULL, /*tp_bool*/ - (unaryfunc)NULL, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)NULL, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - Color_iadd, /*nb_inplace_add*/ - Color_isub, /*nb_inplace_subtract*/ - Color_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - Color_div, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - Color_idiv, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ + /*nb_add*/ (binaryfunc)Color_add, + /*nb_subtract*/ (binaryfunc)Color_sub, + /*nb_multiply*/ (binaryfunc)Color_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Color_neg, + /*tp_positive*/ (unaryfunc)Color_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ Color_iadd, + /*nb_inplace_subtract*/ Color_isub, + /*nb_inplace_multiply*/ Color_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ Color_div, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ Color_idiv, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ NULL, + /*nb_inplace_matrix_multiply*/ NULL, }; /** \} */ @@ -1100,6 +1102,10 @@ static struct PyMethodDef Color_methods[] = { /** \name Color Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Color_str NULL +#endif + PyDoc_STRVAR( color_doc, ".. class:: Color(rgb)\n" @@ -1113,57 +1119,61 @@ PyDoc_STRVAR( " :arg rgb: (r, g, b) color values\n" " :type rgb: 3d vector\n"); PyTypeObject color_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Color", /* tp_name */ - sizeof(ColorObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Color_repr, /* tp_repr */ - &Color_NumMethods, /* tp_as_number */ - &Color_SeqMethods, /* tp_as_sequence */ - &Color_AsMapping, /* tp_as_mapping */ - (hashfunc)Color_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Color_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - color_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Color_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Color_methods, /* tp_methods */ - NULL, /* tp_members */ - Color_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Color_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Color", + /*tp_basicsize*/ sizeof(ColorObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Color_repr, + /*tp_as_number*/ &Color_NumMethods, + /*tp_as_sequence*/ &Color_SeqMethods, + /*tp_as_mapping*/ &Color_AsMapping, + /*tp_hash*/ (hashfunc)Color_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Color_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ color_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Color_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Color_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Color_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Color_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# define Color_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index ddc0f115742..d72ec5bbc77 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -636,22 +636,22 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu * \{ */ static PySequenceMethods Euler_SeqMethods = { - (lenfunc)Euler_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Euler_item, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Euler_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Euler_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Euler_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Euler_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Euler_AsMapping = { - (lenfunc)Euler_len, - (binaryfunc)Euler_subscript, - (objobjargproc)Euler_ass_subscript, + /*mp_len*/ (lenfunc)Euler_len, + /*mp_subscript*/ (binaryfunc)Euler_subscript, + /*mp_ass_subscript*/ (objobjargproc)Euler_ass_subscript, }; /** \} */ @@ -766,6 +766,10 @@ static struct PyMethodDef Euler_methods[] = { /** \name Euler Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Euler_str NULL +#endif + PyDoc_STRVAR( euler_doc, ".. class:: Euler(angles, order='XYZ')\n" @@ -779,57 +783,61 @@ PyDoc_STRVAR( " :arg order: Optional order of the angles, a permutation of ``XYZ``.\n" " :type order: str\n"); PyTypeObject euler_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Euler", /* tp_name */ - sizeof(EulerObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Euler_repr, /* tp_repr */ - NULL, /* tp_as_number */ - &Euler_SeqMethods, /* tp_as_sequence */ - &Euler_AsMapping, /* tp_as_mapping */ - (hashfunc)Euler_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Euler_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - euler_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Euler_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Euler_methods, /* tp_methods */ - NULL, /* tp_members */ - Euler_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Euler_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Euler", + /*tp_basicsize*/ sizeof(EulerObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Euler_repr, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ &Euler_SeqMethods, + /*tp_as_mapping*/ &Euler_AsMapping, + /*tp_hash*/ (hashfunc)Euler_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Euler_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ euler_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Euler_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Euler_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Euler_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Euler_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Euler_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index a44f42bc337..858b01b2a84 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -2964,61 +2964,61 @@ static PyObject *Matrix_imatmul(PyObject *m1, PyObject *m2) * \{ */ static PySequenceMethods Matrix_SeqMethods = { - (lenfunc)Matrix_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Matrix_item_row, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Matrix_ass_item_row, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Matrix_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Matrix_item_row, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Matrix_ass_item_row, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Matrix_AsMapping = { - (lenfunc)Matrix_len, - (binaryfunc)Matrix_subscript, - (objobjargproc)Matrix_ass_subscript, + /*mp_len*/ (lenfunc)Matrix_len, + /*mp_subscript*/ (binaryfunc)Matrix_subscript, + /*mp_ass_subscript*/ (objobjargproc)Matrix_ass_subscript, }; static PyNumberMethods Matrix_NumMethods = { - (binaryfunc)Matrix_add, /*nb_add*/ - (binaryfunc)Matrix_sub, /*nb_subtract*/ - (binaryfunc)Matrix_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*tp_positive*/ - (unaryfunc)0, /*tp_absolute*/ - (inquiry)0, /*tp_bool*/ - (unaryfunc)Matrix_inverted_noargs, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)0, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - NULL, /*nb_inplace_add*/ - NULL, /*nb_inplace_subtract*/ - (binaryfunc)Matrix_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - NULL, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - NULL, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Matrix_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Matrix_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Matrix_add, + /*nb_subtract*/ (binaryfunc)Matrix_sub, + /*nb_multiply*/ (binaryfunc)Matrix_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ NULL, + /*tp_positive*/ NULL, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ (unaryfunc)Matrix_inverted_noargs, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ NULL, + /*nb_inplace_subtract*/ NULL, + /*nb_inplace_multiply*/ (binaryfunc)Matrix_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ NULL, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ NULL, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Matrix_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Matrix_imatmul, }; /** \} */ @@ -3314,6 +3314,10 @@ static struct PyMethodDef Matrix_methods[] = { /** \name Matrix Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Matrix_str NULL +#endif + PyDoc_STRVAR( matrix_doc, ".. class:: Matrix([rows])\n" @@ -3324,57 +3328,61 @@ PyDoc_STRVAR( " :arg rows: Sequence of rows. When omitted, a 4x4 identity matrix is constructed.\n" " :type rows: 2d number sequence\n"); PyTypeObject matrix_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Matrix", /*tp_name*/ - sizeof(MatrixObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BaseMathObject_dealloc, /*tp_dealloc*/ - (printfunc)NULL, /*tp_print*/ - NULL, /*tp_getattr*/ - NULL, /*tp_setattr*/ - NULL, /*tp_compare*/ - (reprfunc)Matrix_repr, /*tp_repr*/ - &Matrix_NumMethods, /*tp_as_number*/ - &Matrix_SeqMethods, /*tp_as_sequence*/ - &Matrix_AsMapping, /*tp_as_mapping*/ - (hashfunc)Matrix_hash, /*tp_hash*/ - NULL, /*tp_call*/ -#ifndef MATH_STANDALONE - (reprfunc)Matrix_str, /*tp_str*/ -#else - NULL, /*tp_str*/ -#endif - NULL, /*tp_getattro*/ - NULL, /*tp_setattro*/ - NULL, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - matrix_doc, /*tp_doc*/ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /*tp_clear*/ - (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - NULL, /*tp_iter*/ - NULL, /*tp_iternext*/ - Matrix_methods, /*tp_methods*/ - NULL, /*tp_members*/ - Matrix_getseters, /*tp_getset*/ - NULL, /*tp_base*/ - NULL, /*tp_dict*/ - NULL, /*tp_descr_get*/ - NULL, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - NULL, /*tp_init*/ - NULL, /*tp_alloc*/ - Matrix_new, /*tp_new*/ - NULL, /*tp_free*/ - (inquiry)BaseMathObject_is_gc, /*tp_is_gc*/ - NULL, /*tp_bases*/ - NULL, /*tp_mro*/ - NULL, /*tp_cache*/ - NULL, /*tp_subclasses*/ - NULL, /*tp_weaklist*/ - NULL, /*tp_del*/ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Matrix", + /*tp_basicsize*/ sizeof(MatrixObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Matrix_repr, + /*tp_as_number*/ &Matrix_NumMethods, + /*tp_as_sequence*/ &Matrix_SeqMethods, + /*tp_as_mapping*/ &Matrix_AsMapping, + /*tp_hash*/ (hashfunc)Matrix_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Matrix_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ matrix_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Matrix_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Matrix_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Matrix_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Matrix_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Matrix_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ @@ -3752,9 +3760,9 @@ static PyObject *MatrixAccess_iter(MatrixAccessObject *self) } static PyMappingMethods MatrixAccess_AsMapping = { - (lenfunc)MatrixAccess_len, - (binaryfunc)MatrixAccess_subscript, - (objobjargproc)MatrixAccess_ass_subscript, + /*mp_len*/ (lenfunc)MatrixAccess_len, + /*mp_subscript*/ (binaryfunc)MatrixAccess_subscript, + /*mp_ass_subscript*/ (objobjargproc)MatrixAccess_ass_subscript, }; /** \} */ @@ -3764,31 +3772,55 @@ static PyMappingMethods MatrixAccess_AsMapping = { * \{ */ PyTypeObject matrix_access_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "MatrixAccess", /*tp_name*/ - sizeof(MatrixAccessObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)MatrixAccess_dealloc, /*tp_dealloc*/ - (printfunc)NULL, /*tp_print*/ - NULL, /*tp_getattr*/ - NULL, /*tp_setattr*/ - NULL, /*tp_compare*/ - NULL, /*tp_repr*/ - NULL, /*tp_as_number*/ - NULL /* &MatrixAccess_SeqMethods */ /* TODO */, /*tp_as_sequence*/ - &MatrixAccess_AsMapping, /*tp_as_mapping*/ - NULL, /*tp_hash*/ - NULL, /*tp_call*/ - NULL, /*tp_str*/ - NULL, /*tp_getattro*/ - NULL, /*tp_setattro*/ - NULL, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - NULL, /*tp_doc*/ - (traverseproc)MatrixAccess_traverse, /*tp_traverse*/ - (inquiry)MatrixAccess_clear, /*tp_clear*/ - NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - (getiterfunc)MatrixAccess_iter, /* getiterfunc tp_iter; */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "MatrixAccess", + /*tp_basicsize*/ sizeof(MatrixAccessObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)MatrixAccess_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL /* &MatrixAccess_SeqMethods */ /* TODO */, + /*tp_as_mapping*/ &MatrixAccess_AsMapping, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ NULL, + /*tp_traverse*/ (traverseproc)MatrixAccess_traverse, + /*tp_clear*/ (inquiry)MatrixAccess_clear, + /*tp_richcompare*/ NULL /* MatrixAccess_richcmpr */ /* TODO*/, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ (getiterfunc)MatrixAccess_iter, + /*tp_iternext*/ NULL, + /*tp_methods*/ NULL, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ NULL, + /*tp_free*/ NULL, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /** \} */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 976c1da1916..4c64746b764 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -1342,61 +1342,61 @@ static PyObject *Quaternion_neg(QuaternionObject *self) * \{ */ static PySequenceMethods Quaternion_SeqMethods = { - (lenfunc)Quaternion_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Quaternion_item, /*sq_item*/ - (ssizessizeargfunc)NULL, /*sq_slice(deprecated)*/ - (ssizeobjargproc)Quaternion_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)NULL, /*sq_ass_slice(deprecated)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat*/ - (ssizeargfunc)NULL, /*sq_inplace_repeat*/ + /*sq_length*/ (lenfunc)Quaternion_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Quaternion_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Quaternion_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods Quaternion_AsMapping = { - (lenfunc)Quaternion_len, - (binaryfunc)Quaternion_subscript, - (objobjargproc)Quaternion_ass_subscript, + /*mp_len*/ (lenfunc)Quaternion_len, + /*mp_subscript*/ (binaryfunc)Quaternion_subscript, + /*mp_ass_subscript*/ (objobjargproc)Quaternion_ass_subscript, }; static PyNumberMethods Quaternion_NumMethods = { - (binaryfunc)Quaternion_add, /*nb_add*/ - (binaryfunc)Quaternion_sub, /*nb_subtract*/ - (binaryfunc)Quaternion_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Quaternion_neg, /*nb_negative*/ - (unaryfunc)Quaternion_copy, /*tp_positive*/ - (unaryfunc)0, /*tp_absolute*/ - (inquiry)0, /*tp_bool*/ - (unaryfunc)0, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)0, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - NULL, /*nb_inplace_add*/ - NULL, /*nb_inplace_subtract*/ - (binaryfunc)Quaternion_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - NULL, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - NULL, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Quaternion_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Quaternion_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Quaternion_add, + /*nb_subtract*/ (binaryfunc)Quaternion_sub, + /*nb_multiply*/ (binaryfunc)Quaternion_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Quaternion_neg, + /*tp_positive*/ (unaryfunc)Quaternion_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ NULL, + /*nb_inplace_subtract*/ NULL, + /*nb_inplace_multiply*/ (binaryfunc)Quaternion_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ NULL, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ NULL, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Quaternion_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Quaternion_imatmul, }; /** \} */ @@ -1657,6 +1657,10 @@ static struct PyMethodDef Quaternion_methods[] = { /** \name Quaternion Type: Python Object Definition * \{ */ +#ifdef MATH_STANDALONE +# define Quaternion_str NULL +#endif + PyDoc_STRVAR(quaternion_doc, ".. class:: Quaternion([seq, [angle]])\n" "\n" @@ -1682,57 +1686,61 @@ PyDoc_STRVAR(quaternion_doc, "\n" " .. seealso:: :meth:`to_axis_angle`\n"); PyTypeObject quaternion_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Quaternion", /* tp_name */ - sizeof(QuaternionObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BaseMathObject_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - (reprfunc)Quaternion_repr, /* tp_repr */ - &Quaternion_NumMethods, /* tp_as_number */ - &Quaternion_SeqMethods, /* tp_as_sequence */ - &Quaternion_AsMapping, /* tp_as_mapping */ - (hashfunc)Quaternion_hash, /* tp_hash */ - NULL, /* tp_call */ -#ifndef MATH_STANDALONE - (reprfunc)Quaternion_str, /* tp_str */ -#else - NULL, /* tp_str */ -#endif - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - quaternion_doc, /* tp_doc */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - (richcmpfunc)Quaternion_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - Quaternion_methods, /* tp_methods */ - NULL, /* tp_members */ - Quaternion_getseters, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - NULL, /* tp_alloc */ - Quaternion_new, /* tp_new */ - NULL, /* tp_free */ - (inquiry)BaseMathObject_is_gc, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "Quaternion", + /*tp_basicsize*/ sizeof(QuaternionObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Quaternion_repr, + /*tp_as_number*/ &Quaternion_NumMethods, + /*tp_as_sequence*/ &Quaternion_SeqMethods, + /*tp_as_mapping*/ &Quaternion_AsMapping, + /*tp_hash*/ (hashfunc)Quaternion_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Quaternion_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ quaternion_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Quaternion_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Quaternion_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Quaternion_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Quaternion_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; +#ifdef MATH_STANDALONE +# undef Quaternion_str +#endif + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 290be771c90..0f534e76e73 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -2387,61 +2387,61 @@ static PyObject *Vector_neg(VectorObject *self) * \{ */ static PySequenceMethods Vector_SeqMethods = { - (lenfunc)Vector_len, /*sq_length*/ - (binaryfunc)NULL, /*sq_concat*/ - (ssizeargfunc)NULL, /*sq_repeat*/ - (ssizeargfunc)Vector_item, /*sq_item*/ - NULL, /*sq_slice(DEPRECATED)*/ - (ssizeobjargproc)Vector_ass_item, /*sq_ass_item*/ - NULL, /*sq_ass_slice(DEPRECATED)*/ - (objobjproc)NULL, /*sq_contains*/ - (binaryfunc)NULL, /*sq_inplace_concat */ - (ssizeargfunc)NULL, /*sq_inplace_repeat */ + /*sq_length*/ (lenfunc)Vector_len, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)Vector_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. */ + /*sq_ass_item*/ (ssizeobjargproc)Vector_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat */ NULL, + /*sq_inplace_repeat */ NULL, }; static PyMappingMethods Vector_AsMapping = { - (lenfunc)Vector_len, - (binaryfunc)Vector_subscript, - (objobjargproc)Vector_ass_subscript, + /*mp_len*/ (lenfunc)Vector_len, + /*mp_subscript*/ (binaryfunc)Vector_subscript, + /*mp_ass_subscript*/ (objobjargproc)Vector_ass_subscript, }; static PyNumberMethods Vector_NumMethods = { - (binaryfunc)Vector_add, /*nb_add*/ - (binaryfunc)Vector_sub, /*nb_subtract*/ - (binaryfunc)Vector_mul, /*nb_multiply*/ - NULL, /*nb_remainder*/ - NULL, /*nb_divmod*/ - NULL, /*nb_power*/ - (unaryfunc)Vector_neg, /*nb_negative*/ - (unaryfunc)Vector_copy, /*tp_positive*/ - (unaryfunc)NULL, /*tp_absolute*/ - (inquiry)NULL, /*tp_bool*/ - (unaryfunc)NULL, /*nb_invert*/ - NULL, /*nb_lshift*/ - (binaryfunc)NULL, /*nb_rshift*/ - NULL, /*nb_and*/ - NULL, /*nb_xor*/ - NULL, /*nb_or*/ - NULL, /*nb_int*/ - NULL, /*nb_reserved*/ - NULL, /*nb_float*/ - Vector_iadd, /*nb_inplace_add*/ - Vector_isub, /*nb_inplace_subtract*/ - Vector_imul, /*nb_inplace_multiply*/ - NULL, /*nb_inplace_remainder*/ - NULL, /*nb_inplace_power*/ - NULL, /*nb_inplace_lshift*/ - NULL, /*nb_inplace_rshift*/ - NULL, /*nb_inplace_and*/ - NULL, /*nb_inplace_xor*/ - NULL, /*nb_inplace_or*/ - NULL, /*nb_floor_divide*/ - Vector_div, /*nb_true_divide*/ - NULL, /*nb_inplace_floor_divide*/ - Vector_idiv, /*nb_inplace_true_divide*/ - NULL, /*nb_index*/ - (binaryfunc)Vector_matmul, /*nb_matrix_multiply*/ - (binaryfunc)Vector_imatmul, /*nb_inplace_matrix_multiply*/ + /*nb_add*/ (binaryfunc)Vector_add, + /*nb_subtract*/ (binaryfunc)Vector_sub, + /*nb_multiply*/ (binaryfunc)Vector_mul, + /*nb_remainder*/ NULL, + /*nb_divmod*/ NULL, + /*nb_power*/ NULL, + /*nb_negative*/ (unaryfunc)Vector_neg, + /*tp_positive*/ (unaryfunc)Vector_copy, + /*tp_absolute*/ NULL, + /*tp_bool*/ NULL, + /*nb_invert*/ NULL, + /*nb_lshift*/ NULL, + /*nb_rshift*/ NULL, + /*nb_and*/ NULL, + /*nb_xor*/ NULL, + /*nb_or*/ NULL, + /*nb_int*/ NULL, + /*nb_reserved*/ NULL, + /*nb_float*/ NULL, + /*nb_inplace_add*/ Vector_iadd, + /*nb_inplace_subtract*/ Vector_isub, + /*nb_inplace_multiply*/ Vector_imul, + /*nb_inplace_remainder*/ NULL, + /*nb_inplace_power*/ NULL, + /*nb_inplace_lshift*/ NULL, + /*nb_inplace_rshift*/ NULL, + /*nb_inplace_and*/ NULL, + /*nb_inplace_xor*/ NULL, + /*nb_inplace_or*/ NULL, + /*nb_floor_divide*/ NULL, + /*nb_true_divide*/ Vector_div, + /*nb_inplace_floor_divide*/ NULL, + /*nb_inplace_true_divide*/ Vector_idiv, + /*nb_index*/ NULL, + /*nb_matrix_multiply*/ (binaryfunc)Vector_matmul, + /*nb_inplace_matrix_multiply*/ (binaryfunc)Vector_imatmul, }; /** \} */ @@ -3183,6 +3183,10 @@ static struct PyMethodDef Vector_methods[] = { * both get sent to Vector_mul and it needs to sort out the order * \{ */ +#ifdef MATH_STANDALONE +# define Vector_str NULL +#endif + PyDoc_STRVAR(vector_doc, ".. class:: Vector(seq)\n" "\n" @@ -3192,88 +3196,59 @@ PyDoc_STRVAR(vector_doc, " :type seq: sequence of numbers\n"); PyTypeObject vector_Type = { PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "<module>.<name>" */ - "Vector", /* char *tp_name; */ - sizeof(VectorObject), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - (destructor)BaseMathObject_dealloc, /* destructor tp_dealloc; */ - 0, /* tp_vectorcall_offset */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - (reprfunc)Vector_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - &Vector_NumMethods, /* PyNumberMethods *tp_as_number; */ - &Vector_SeqMethods, /* PySequenceMethods *tp_as_sequence; */ - &Vector_AsMapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ + /*tp_name*/ "Vector", + /*tp_basicsize*/ sizeof(VectorObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)BaseMathObject_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ (reprfunc)Vector_repr, + /*tp_as_number*/ &Vector_NumMethods, + /*tp_as_sequence*/ &Vector_SeqMethods, + /*tp_as_mapping*/ &Vector_AsMapping, + /*tp_hash*/ (hashfunc)Vector_hash, + /*tp_call*/ NULL, + /*tp_str*/ (reprfunc)Vector_str, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ vector_doc, + /*tp_traverse*/ (traverseproc)BaseMathObject_traverse, + /*tp_clear*/ (inquiry)BaseMathObject_clear, + /*tp_richcompare*/ (richcmpfunc)Vector_richcmpr, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ Vector_methods, + /*tp_members*/ NULL, + /*tp_getset*/ Vector_getseters, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ NULL, + /*tp_new*/ Vector_new, + /*tp_free*/ NULL, + /*tp_is_gc*/ (inquiry)BaseMathObject_is_gc, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, +}; - (hashfunc)Vector_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ -#ifndef MATH_STANDALONE - (reprfunc)Vector_str, /* reprfunc tp_str; */ -#else - NULL, /* reprfunc tp_str; */ +#ifdef MATH_STANDALONE +# undef Vector_str NULL #endif - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - vector_doc, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - - /* call function for all accessible objects */ - (traverseproc)BaseMathObject_traverse, /* tp_traverse */ - - /* delete references to contained objects */ - (inquiry)BaseMathObject_clear, /* tp_clear */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - (richcmpfunc)Vector_richcmpr, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - NULL, /* getiterfunc tp_iter; */ - NULL, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - Vector_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - Vector_getseters, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - Vector_new, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - (inquiry)BaseMathObject_is_gc, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL, -}; /** \} */ diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 4bdb1adcdde..11f8d57397e 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -1235,52 +1235,55 @@ static PyMethodDef py_bvhtree_methods[] = { }; PyTypeObject PyBVHTree_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BVHTree", /* tp_name */ - sizeof(PyBVHTree), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)py_bvhtree__tp_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - NULL, /* tp_repr */ - NULL, /* tp_as_number */ - NULL, /* tp_as_sequence */ - NULL, /* tp_as_mapping */ - NULL, /* tp_hash */ - NULL, /* tp_call */ - NULL, /* tp_str */ - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - NULL, /* Documentation string */ - NULL, /* tp_traverse */ - NULL, /* tp_clear */ - NULL, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - py_bvhtree_methods, /* tp_methods */ - NULL, /* tp_members */ - NULL, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - NULL, /* tp_init */ - (allocfunc)PyType_GenericAlloc, /* tp_alloc */ - (newfunc)PyType_GenericNew, /* tp_new */ - (freefunc)0, /* tp_free */ - NULL, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - (destructor)NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "BVHTree", + /*tp_basicsize*/ sizeof(PyBVHTree), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)py_bvhtree__tp_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ NULL, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ py_bvhtree_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ NULL, + /*tp_alloc*/ (allocfunc)PyType_GenericAlloc, + /*tp_new*/ (newfunc)PyType_GenericNew, + /*tp_free*/ (freefunc)0, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ (destructor)NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index f5a27c6f90f..02d9482b575 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -372,53 +372,57 @@ PyDoc_STRVAR(py_KDtree_doc, "\n" " :class:`KDTree.balance` must have been called before using any of the ``find`` " "methods.\n"); + PyTypeObject PyKDTree_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "KDTree", /* tp_name */ - sizeof(PyKDTree), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)PyKDTree__tp_dealloc, /* tp_dealloc */ - (printfunc)NULL, /* tp_print */ - NULL, /* tp_getattr */ - NULL, /* tp_setattr */ - NULL, /* tp_compare */ - NULL, /* tp_repr */ - NULL, /* tp_as_number */ - NULL, /* tp_as_sequence */ - NULL, /* tp_as_mapping */ - NULL, /* tp_hash */ - NULL, /* tp_call */ - NULL, /* tp_str */ - NULL, /* tp_getattro */ - NULL, /* tp_setattro */ - NULL, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - py_KDtree_doc, /* Documentation string */ - NULL, /* tp_traverse */ - NULL, /* tp_clear */ - NULL, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - NULL, /* tp_iter */ - NULL, /* tp_iternext */ - (struct PyMethodDef *)PyKDTree_methods, /* tp_methods */ - NULL, /* tp_members */ - NULL, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - NULL, /* tp_descr_get */ - NULL, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)PyKDTree__tp_init, /* tp_init */ - (allocfunc)PyType_GenericAlloc, /* tp_alloc */ - (newfunc)PyType_GenericNew, /* tp_new */ - (freefunc)0, /* tp_free */ - NULL, /* tp_is_gc */ - NULL, /* tp_bases */ - NULL, /* tp_mro */ - NULL, /* tp_cache */ - NULL, /* tp_subclasses */ - NULL, /* tp_weaklist */ - (destructor)NULL, /* tp_del */ + PyVarObject_HEAD_INIT(NULL, 0) + /*tp_name*/ "KDTree", + /*tp_basicsize*/ sizeof(PyKDTree), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ (destructor)PyKDTree__tp_dealloc, + /*tp_vectorcall_offset*/ 0, + /*tp_getattr*/ NULL, + /*tp_setattr*/ NULL, + /*tp_as_async*/ NULL, + /*tp_repr*/ NULL, + /*tp_as_number*/ NULL, + /*tp_as_sequence*/ NULL, + /*tp_as_mapping*/ NULL, + /*tp_hash*/ NULL, + /*tp_call*/ NULL, + /*tp_str*/ NULL, + /*tp_getattro*/ NULL, + /*tp_setattro*/ NULL, + /*tp_as_buffer*/ NULL, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*Documentation string*/ py_KDtree_doc, + /*tp_traverse*/ NULL, + /*tp_clear*/ NULL, + /*tp_richcompare*/ NULL, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ NULL, + /*tp_iternext*/ NULL, + /*tp_methods*/ (struct PyMethodDef *)PyKDTree_methods, + /*tp_members*/ NULL, + /*tp_getset*/ NULL, + /*tp_base*/ NULL, + /*tp_dict*/ NULL, + /*tp_descr_get*/ NULL, + /*tp_descr_set*/ NULL, + /*tp_dictoffset*/ 0, + /*tp_init*/ (initproc)PyKDTree__tp_init, + /*tp_alloc*/ (allocfunc)PyType_GenericAlloc, + /*tp_new*/ (newfunc)PyType_GenericNew, + /*tp_free*/ (freefunc)0, + /*tp_is_gc*/ NULL, + /*tp_bases*/ NULL, + /*tp_mro*/ NULL, + /*tp_cache*/ NULL, + /*tp_subclasses*/ NULL, + /*tp_weaklist*/ NULL, + /*tp_del*/ (destructor)NULL, + /*tp_version_tag*/ 0, + /*tp_finalize*/ NULL, + /*tp_vectorcall*/ NULL, }; PyDoc_STRVAR(py_kdtree_doc, "Generic 3-dimensional kd-tree to perform spatial searches."); |