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/Interface0D | |
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/Interface0D')
-rw-r--r-- | source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 6845bc3ed12..1d51bf287af 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -400,13 +400,14 @@ static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure) Vec3r e2(info->e2.x(), info->e2.y(), info->e2.z()); Vec3r er(info->er.x(), info->er.y(), info->er.z()); PyObject *retval = PyTuple_New(7); - PyTuple_SET_ITEM(retval, 0, PyFloat_FromDouble(info->K1)); - PyTuple_SET_ITEM(retval, 2, Vector_from_Vec3r(e1)); - PyTuple_SET_ITEM(retval, 1, PyFloat_FromDouble(info->K2)); - PyTuple_SET_ITEM(retval, 3, Vector_from_Vec3r(e2)); - PyTuple_SET_ITEM(retval, 4, PyFloat_FromDouble(info->Kr)); - PyTuple_SET_ITEM(retval, 5, Vector_from_Vec3r(er)); - PyTuple_SET_ITEM(retval, 6, PyFloat_FromDouble(info->dKr)); + PyTuple_SET_ITEMS(retval, + PyFloat_FromDouble(info->K1), + PyFloat_FromDouble(info->K2), + Vector_from_Vec3r(e1), + Vector_from_Vec3r(e2), + PyFloat_FromDouble(info->Kr), + Vector_from_Vec3r(er), + PyFloat_FromDouble(info->dKr)); return retval; } |