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>2015-01-06 08:42:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-01-06 11:09:11 +0300
commit9fd569a654ded46901c7f20c5fe080972cbb10d2 (patch)
tree933b893aeaa0a8bffe230933523512340dfa016d /source/blender/python/generic/blf_py_api.c
parentee58d449455df9470c4a0a902056b8c2001128bf (diff)
PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro. Also added Py_INCREF_RET to avoid confusing use of comma operator.
Diffstat (limited to 'source/blender/python/generic/blf_py_api.c')
-rw-r--r--source/blender/python/generic/blf_py_api.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 655542e320a..ed1ac7ceed9 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -33,6 +33,9 @@
#include "BLI_utildefines.h"
+#include "../generic/python_utildefines.h"
+
+
PyDoc_STRVAR(py_blf_position_doc,
".. function:: position(fontid, x, y, z)\n"
"\n"
@@ -183,8 +186,9 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
BLF_width_and_height(fontid, text, INT_MAX, &r_width, &r_height);
ret = PyTuple_New(2);
- PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(r_width));
- PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(r_height));
+ PyTuple_SET_ITEMS(ret,
+ PyFloat_FromDouble(r_width),
+ PyFloat_FromDouble(r_height));
return ret;
}