diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 37b2849aa94..75d7ebd3ee2 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -103,6 +103,13 @@ int PyC_AsArray_FAST(void *array, } else if (type == &PyLong_Type) { switch (array_item_size) { + case sizeof(int64_t): { + int64_t *array_int = array; + for (i = 0; i < length; i++) { + array_int[i] = PyC_Long_AsI64(value_fast_items[i]); + } + break; + } case sizeof(int32_t): { int32_t *array_int = array; for (i = 0; i < length; i++) { @@ -110,6 +117,20 @@ int PyC_AsArray_FAST(void *array, } break; } + case sizeof(int16_t): { + int16_t *array_int = array; + for (i = 0; i < length; i++) { + array_int[i] = PyC_Long_AsI16(value_fast_items[i]); + } + break; + } + case sizeof(int8_t): { + int8_t *array_int = array; + for (i = 0; i < length; i++) { + array_int[i] = PyC_Long_AsI8(value_fast_items[i]); + } + break; + } default: { /* Internal error. */ BLI_assert_unreachable(); @@ -118,8 +139,29 @@ int PyC_AsArray_FAST(void *array, } else if (type == &PyBool_Type) { switch (array_item_size) { - case sizeof(bool): { - bool *array_bool = array; + case sizeof(int64_t): { + int64_t *array_bool = array; + for (i = 0; i < length; i++) { + array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); + } + break; + } + case sizeof(int32_t): { + int32_t *array_bool = array; + for (i = 0; i < length; i++) { + array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); + } + break; + } + case sizeof(int16_t): { + int16_t *array_bool = array; + for (i = 0; i < length; i++) { + array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); + } + break; + } + case sizeof(int8_t): { + int8_t *array_bool = array; for (i = 0; i < length; i++) { array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); } |