diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-07-27 15:26:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-07-27 15:36:01 +0300 |
commit | 58eacb8e7c7ae95bf34896d9cdd868e7a11e044e (patch) | |
tree | 7e62d569d7196bbfc20be0b4a5cb3e822eaa8bc4 /source/blender/python/intern/bpy_props.c | |
parent | b1a2abd6b2ba92c0b9134ae72b502a375556a417 (diff) |
Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.
This allows supporting different sized int types more easily.
Diffstat (limited to 'source/blender/python/intern/bpy_props.c')
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index f332d547965..0b812037810 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -719,7 +719,8 @@ static void bpy_prop_boolean_array_get_fn(struct PointerRNA *ptr, } } else { - if (PyC_AsArray(values, ret, len, &PyBool_Type, false, "BoolVectorProperty get") == -1) { + if (PyC_AsArray(values, sizeof(*values), ret, len, &PyBool_Type, "BoolVectorProperty get: ") == + -1) { PyC_Err_PrintWithFunc(py_func); for (i = 0; i < len; i++) { @@ -969,7 +970,8 @@ static void bpy_prop_int_array_get_fn(struct PointerRNA *ptr, } } else { - if (PyC_AsArray(values, ret, len, &PyLong_Type, false, "IntVectorProperty get") == -1) { + if (PyC_AsArray(values, sizeof(*values), ret, len, &PyLong_Type, "IntVectorProperty get: ") == + -1) { PyC_Err_PrintWithFunc(py_func); for (i = 0; i < len; i++) { @@ -1219,7 +1221,8 @@ static void bpy_prop_float_array_get_fn(struct PointerRNA *ptr, } } else { - if (PyC_AsArray(values, ret, len, &PyFloat_Type, false, "FloatVectorProperty get") == -1) { + if (PyC_AsArray( + values, sizeof(*values), ret, len, &PyFloat_Type, "FloatVectorProperty get: ") == -1) { PyC_Err_PrintWithFunc(py_func); for (i = 0; i < len; i++) { @@ -2629,9 +2632,12 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject return NULL; } - if (pydef && - PyC_AsArray( - def, pydef, size, &PyBool_Type, false, "BoolVectorProperty(default=sequence)") == -1) { + if (pydef && (PyC_AsArray(def, + sizeof(*def), + pydef, + size, + &PyBool_Type, + "BoolVectorProperty(default=sequence): ") == -1)) { return NULL; } @@ -2916,9 +2922,12 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject return NULL; } - if (pydef && - PyC_AsArray( - def, pydef, size, &PyLong_Type, false, "IntVectorProperty(default=sequence)") == -1) { + if (pydef && (PyC_AsArray(def, + sizeof(*def), + pydef, + size, + &PyLong_Type, + "IntVectorProperty(default=sequence): ") == -1)) { return NULL; } @@ -3196,10 +3205,12 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec return NULL; } - if (pydef && - PyC_AsArray( - def, pydef, size, &PyFloat_Type, false, "FloatVectorProperty(default=sequence)") == - -1) { + if (pydef && (PyC_AsArray(def, + sizeof(*def), + pydef, + size, + &PyFloat_Type, + "FloatVectorProperty(default=sequence): ") == -1)) { return NULL; } |