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_ViewMap.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_ViewMap.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_ViewMap.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 2160a9d2e38..46aad0d788c 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -99,11 +99,12 @@ PyDoc_STRVAR(ViewMap_get_closest_viewedge_doc, " :return: The ViewEdge nearest to the specified 2D point.\n" " :rtype: :class:`ViewEdge`"); -static PyObject * ViewMap_get_closest_viewedge(BPy_ViewMap *self , PyObject *args) +static PyObject * ViewMap_get_closest_viewedge(BPy_ViewMap *self , PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"x", "y", NULL}; double x, y; - if (!PyArg_ParseTuple(args, "dd", &x, &y)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) return NULL; ViewEdge *ve = const_cast<ViewEdge *>(self->vm->getClosestViewEdge(x,y)); if (ve) @@ -123,11 +124,12 @@ PyDoc_STRVAR(ViewMap_get_closest_fedge_doc, " :return: The FEdge nearest to the specified 2D point.\n" " :rtype: :class:`FEdge`"); -static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args) +static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"x", "y", NULL}; double x, y; - if (!PyArg_ParseTuple(args, "dd", &x, &y)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) return NULL; FEdge *fe = const_cast<FEdge *>(self->vm->getClosestFEdge(x,y)); if (fe) @@ -138,8 +140,8 @@ static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args) // static ViewMap *getInstance (); static PyMethodDef BPy_ViewMap_methods[] = { - {"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS, ViewMap_get_closest_viewedge_doc}, - {"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS, ViewMap_get_closest_fedge_doc}, + {"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS | METH_KEYWORDS, ViewMap_get_closest_viewedge_doc}, + {"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS | METH_KEYWORDS, ViewMap_get_closest_fedge_doc}, {NULL, NULL, 0, NULL} }; |