Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-02 20:48:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-02 20:48:34 +0300
commit31f2a6755db5bf9439e51701eddcadfca773459a (patch)
treeaac49c8281a57e3d44805a27fd305d33ae475216 /source/blender/python
parent71d7d6cd8c431b7f4fac8d65a4eaedf3cff6c8f6 (diff)
PyAPI: Add PyC_Tuple_Pack_F64 utility
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/py_capi_utils.c9
-rw-r--r--source/blender/python/generic/py_capi_utils.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 62ef1b773c7..6f265b2ae87 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -146,6 +146,15 @@ PyObject *PyC_Tuple_PackArray_F32(const float *array, uint len)
return tuple;
}
+PyObject *PyC_Tuple_PackArray_F64(const double *array, uint len)
+{
+ PyObject *tuple = PyTuple_New(len);
+ for (uint i = 0; i < len; i++) {
+ PyTuple_SET_ITEM(tuple, i, PyFloat_FromDouble(array[i]));
+ }
+ return tuple;
+}
+
PyObject *PyC_Tuple_PackArray_I32(const int *array, uint len)
{
PyObject *tuple = PyTuple_New(len);
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index e4d6d3fe557..fe7a046d99c 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -51,12 +51,15 @@ int PyC_AsArray(
const PyTypeObject *type, const bool is_double, const char *error_prefix);
PyObject *PyC_Tuple_PackArray_F32(const float *array, uint len);
+PyObject *PyC_Tuple_PackArray_F64(const double *array, uint len);
PyObject *PyC_Tuple_PackArray_I32(const int *array, uint len);
PyObject *PyC_Tuple_PackArray_I32FromBool(const int *array, uint len);
PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len);
#define PyC_Tuple_Pack_F32(...) \
PyC_Tuple_PackArray_F32(((const float []){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
+#define PyC_Tuple_Pack_F64(...) \
+ PyC_Tuple_PackArray_F64(((const double []){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
#define PyC_Tuple_Pack_I32(...) \
PyC_Tuple_PackArray_I32(((const int []){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
#define PyC_Tuple_Pack_I32FromBool(...) \