diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-22 05:57:20 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-22 05:57:20 +0400 |
commit | 33f34e1a7bc08f123d76198ae0671e3da1ded401 (patch) | |
tree | 2e94232e350814cd1334cc262309fd9efd8b9ab6 /source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float | |
parent | 6cd036ab96fa50b280a6a0cfda7f09f1c1f57600 (diff) |
Freestyle Python API improvements - part 6.
Fix for PyGetSetDef and proper handling of keyword arguments were done in
Function0D and Function1D classes. Additional code clean-up was also made.
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float')
6 files changed, 26 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index 4aaceb3559a..5e37c81306c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -28,9 +28,11 @@ static char GetCurvilinearAbscissaF0D___doc__[] = " :return: The curvilinear abscissa of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self, PyObject *args ) +static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D(); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index aeea47deffc..54aba274936 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -27,9 +27,11 @@ static char GetParameterF0D___doc__[] = " :return: The parameter of an Interface0D.\n" " :rtype: float\n"; -static int GetParameterF0D___init__( BPy_GetParameterF0D* self, PyObject *args ) +static int GetParameterF0D___init__(BPy_GetParameterF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D(); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index bac65716ba9..29c1373870e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -32,11 +32,12 @@ static char GetViewMapGradientNormF0D___doc__[] = " image.\n" " :rtype: float\n"; -static int GetViewMapGradientNormF0D___init__( BPy_GetViewMapGradientNormF0D* self, PyObject *args) +static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", NULL}; int i; - if( !PyArg_ParseTuple(args, "i", &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index 6a40266cf7b..3c9b9b52253 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -30,11 +30,12 @@ static char ReadCompleteViewMapPixelF0D___doc__[] = " :return: A pixel in one of the level of the complete viewmap.\n" " :rtype: float\n"; -static int ReadCompleteViewMapPixelF0D___init__( BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args) +static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", NULL}; int i; - if( !PyArg_ParseTuple(args, "i", &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index 74cf688507e..189a7c525c7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -13,12 +13,12 @@ extern "C" { static char ReadMapPixelF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" "\n" -".. method:: __init__(iMapName, level)\n" +".. method:: __init__(map_name, level)\n" "\n" " Builds a ReadMapPixelF0D object.\n" "\n" -" :arg iMapName: The name of the map to be read.\n" -" :type iMapName: str\n" +" :arg map_name: The name of the map to be read.\n" +" :type map_name: str\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" @@ -32,12 +32,13 @@ static char ReadMapPixelF0D___doc__[] = " :return: A pixel in a map.\n" " :rtype: float\n"; -static int ReadMapPixelF0D___init__( BPy_ReadMapPixelF0D* self, PyObject *args) +static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"map_name", "level", NULL}; const char *s; int i; - if( !PyArg_ParseTuple(args, "si", &s, &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "si", (char **)kwlist, &s, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::ReadMapPixelF0D(s,i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index db0145e3e2a..f42a65e4bf7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -13,13 +13,13 @@ extern "C" { static char ReadSteerableViewMapPixelF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" "\n" -".. method:: __init__(nOrientation, level)\n" +".. method:: __init__(orientation, level)\n" "\n" " Builds a ReadSteerableViewMapPixelF0D object.\n" "\n" -" :arg nOrientation: The integer belonging to [0, 4] indicating the\n" +" :arg orientation: The integer belonging to [0, 4] indicating the\n" " orientation (E, NE, N, NW) we are interested in.\n" -" :type nOrientation: int\n" +" :type orientation: int\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" @@ -33,12 +33,13 @@ static char ReadSteerableViewMapPixelF0D___doc__[] = " :return: A pixel in one of the level of one of the steerable viewmaps.\n" " :rtype: float\n"; -static int ReadSteerableViewMapPixelF0D___init__( BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args) +static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"orientation", "level", NULL}; unsigned int u; int i; - if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::ReadSteerableViewMapPixelF0D(u,i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; |