diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 06:39:38 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 06:39:38 +0400 |
commit | 3df023ae82eef0ea105dc61c9730af87b59a07d1 (patch) | |
tree | 2d2a4e753c1129fc91f360f0457d30859cd38737 /source/blender/freestyle/intern/python/BPy_Interface1D.cpp | |
parent | d38a335d47f1632000db5172877499ff0184d114 (diff) |
Freestyle Python API improvements - part 8.
* Proper handling of keyword arguments was implemented in Operators and ContextFunctions,
as well as in methods of Interface0D, Interface1D, Iterator, their subclasses, Noise and
IntegrationType.
* Operators' methods and functions in the ContextFunctions module were renamed from
CamelCase to lower cases + underscores. Style modules were updated accordingly.
* Additional code clean-up was also made.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_Interface1D.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Interface1D.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 4a66ca14021..e990f10f946 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -180,11 +180,12 @@ PyDoc_STRVAR(Interface1D_points_begin_doc, " :return: An Interface0DIterator pointing to the first point.\n" " :rtype: :class:`Interface0DIterator`"); -static PyObject * Interface1D_points_begin(BPy_Interface1D *self, PyObject *args) +static PyObject * Interface1D_points_begin(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - float f = 0; + static const char *kwlist[] = {"t", NULL}; + float f = 0.0f; - if(!(PyArg_ParseTuple(args, "|f", &f))) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) return NULL; Interface0DIterator if0D_it(self->if1D->pointsBegin(f)); return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0); @@ -204,11 +205,12 @@ PyDoc_STRVAR(Interface1D_points_end_doc, " :return: An Interface0DIterator pointing after the last point.\n" " :rtype: :class:`Interface0DIterator`"); -static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args) +static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - float f = 0; + static const char *kwlist[] = {"t", NULL}; + float f = 0.0f; - if (!PyArg_ParseTuple(args, "|f", &f)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) return NULL; Interface0DIterator if0D_it(self->if1D->pointsEnd(f)); return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 1); @@ -217,8 +219,8 @@ static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args) static PyMethodDef BPy_Interface1D_methods[] = { {"vertices_begin", (PyCFunction)Interface1D_vertices_begin, METH_NOARGS, Interface1D_vertices_begin_doc}, {"vertices_end", (PyCFunction)Interface1D_vertices_end, METH_NOARGS, Interface1D_vertices_end_doc}, - {"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS, Interface1D_points_begin_doc}, - {"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS, Interface1D_points_end_doc}, + {"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS | METH_KEYWORDS, Interface1D_points_begin_doc}, + {"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS | METH_KEYWORDS, Interface1D_points_end_doc}, {NULL, NULL, 0, NULL} }; |