diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-18 07:09:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-18 07:16:34 +0300 |
commit | 4dfbaa34c98acd5940d7fb85b8d1f54ea7e4451e (patch) | |
tree | 9fcb242466a39f8d761bad3740ad2f471df0d3bd /source/blender/python/mathutils | |
parent | 5e67dcf3d2c337c0d4b0fb71b3800bd219629e2e (diff) |
PyAPI: allow any vector sequence for poly_3d_calc(..)
Previously only vectors were accepted for the second point argument:
mathutils.interpolate.poly_3d_calc()
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r-- | source/blender/python/mathutils/mathutils_interpolate.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/python/mathutils/mathutils_interpolate.c b/source/blender/python/mathutils/mathutils_interpolate.c index 6abb66899d5..bb6a7720c44 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.c +++ b/source/blender/python/mathutils/mathutils_interpolate.c @@ -54,24 +54,15 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar PyObject *point, *veclist, *ret; int i; - if (!PyArg_ParseTuple(args, "OO!:poly_3d_calc", &veclist, &vector_Type, &point)) { + if (!PyArg_ParseTuple(args, "OO:poly_3d_calc", &veclist, &point)) { return NULL; } - if (BaseMath_ReadCallback((VectorObject *)point) == -1) { + if (mathutils_array_parse( + fp, 2, 3 | MU_ARRAY_ZERO, point, "pt must be a 2-3 dimensional vector") == -1) { return NULL; } - fp[0] = ((VectorObject *)point)->vec[0]; - fp[1] = ((VectorObject *)point)->vec[1]; - if (((VectorObject *)point)->size > 2) { - fp[2] = ((VectorObject *)point)->vec[2]; - } - else { - /* if its a 2d vector then set the z to be zero */ - fp[2] = 0.0f; - } - len = mathutils_array_parse_alloc_v(((float **)&vecs), 3, veclist, __func__); if (len == -1) { return NULL; |