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_ViewShape.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_ViewShape.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_ViewShape.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 72ebe43fab5..fdb2a695456 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -125,40 +125,42 @@ static void ViewShape_dealloc(BPy_ViewShape *self) static PyObject * ViewShape_repr(BPy_ViewShape *self) { - return PyUnicode_FromFormat("ViewShape - address: %p", self->vs ); + return PyUnicode_FromFormat("ViewShape - address: %p", self->vs); } PyDoc_STRVAR(ViewShape_add_edge_doc, -".. method:: add_edge(iEdge)\n" +".. method:: add_edge(edge)\n" "\n" " Adds a ViewEdge to the list of ViewEdge objects.\n" "\n" -" :arg iEdge: A ViewEdge object.\n" -" :type iEdge: :class:`ViewEdge`\n"); +" :arg edge: A ViewEdge object.\n" +" :type edge: :class:`ViewEdge`\n"); -static PyObject * ViewShape_add_edge(BPy_ViewShape *self , PyObject *args) +static PyObject * ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"edge", NULL}; PyObject *py_ve = 0; - if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve)) + if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) return NULL; self->vs->AddEdge(((BPy_ViewEdge *)py_ve)->ve); Py_RETURN_NONE; } PyDoc_STRVAR(ViewShape_add_vertex_doc, -".. method:: add_vertex(iVertex)\n" +".. method:: add_vertex(vertex)\n" "\n" " Adds a ViewVertex to the list of the ViewVertex objects.\n" "\n" -" :arg iVertex: A ViewVertex object.\n" -" :type iVertex: :class:`ViewVertex`"); +" :arg vertex: A ViewVertex object.\n" +" :type vertex: :class:`ViewVertex`"); -static PyObject * ViewShape_add_vertex(BPy_ViewShape *self , PyObject *args) +static PyObject * ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"vertex", NULL}; PyObject *py_vv = 0; - if (!PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv)) + if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewVertex_Type, &py_vv)) return NULL; self->vs->AddVertex(((BPy_ViewVertex *)py_vv)->vv); Py_RETURN_NONE; @@ -167,8 +169,8 @@ static PyObject * ViewShape_add_vertex(BPy_ViewShape *self , PyObject *args) // virtual ViewShape *duplicate() static PyMethodDef BPy_ViewShape_methods[] = { - {"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS, ViewShape_add_edge_doc}, - {"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS, ViewShape_add_vertex_doc}, + {"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS | METH_KEYWORDS, ViewShape_add_edge_doc}, + {"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS | METH_KEYWORDS, ViewShape_add_vertex_doc}, {NULL, NULL, 0, NULL} }; |