diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 08:42:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 11:09:11 +0300 |
commit | 9fd569a654ded46901c7f20c5fe080972cbb10d2 (patch) | |
tree | 933b893aeaa0a8bffe230933523512340dfa016d /source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp | |
parent | ee58d449455df9470c4a0a902056b8c2001128bf (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/freestyle/intern/python/BPy_ContextFunctions.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index dd678ee6fbd..ad54a81f156 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -92,10 +92,11 @@ ContextFunctions_get_border(PyObject *self) { BBox<Vec2i> border(ContextFunctions::GetBorderCF()); PyObject *v = PyTuple_New(4); - PyTuple_SET_ITEM(v, 0, PyLong_FromLong(border.getMin().x())); - PyTuple_SET_ITEM(v, 1, PyLong_FromLong(border.getMin().y())); - PyTuple_SET_ITEM(v, 2, PyLong_FromLong(border.getMax().x())); - PyTuple_SET_ITEM(v, 3, PyLong_FromLong(border.getMax().y())); + PyTuple_SET_ITEMS(v, + PyLong_FromLong(border.getMin().x()), + PyLong_FromLong(border.getMin().y()), + PyLong_FromLong(border.getMax().x()), + PyLong_FromLong(border.getMax().y())); return v; } |