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_double | |
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_double')
10 files changed, 41 insertions, 23 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index e28b1ca138a..1e2e78852cf 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -30,9 +30,11 @@ static char Curvature2DAngleF0D___doc__[] = " pointed Interface0D.\n" " :rtype: float\n"; -static int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self, PyObject *args ) +static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D* 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_double.uf0D_double = new Functions0D::Curvature2DAngleF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index 64c2d453552..213dc77446f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -35,11 +35,12 @@ static char DensityF0D___doc__[] = " Interface0D.\n" " :rtype: float\n"; -static int DensityF0D___init__( BPy_DensityF0D* self, PyObject *args) +static int DensityF0D___init__(BPy_DensityF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"sigma", NULL}; double d = 2; - if( !PyArg_ParseTuple(args, "|d", &d) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index e539ca10dc8..99c9f43eecb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -27,9 +27,11 @@ static char GetProjectedXF0D___doc__[] = " :return: The X 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self, PyObject *args ) +static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D* 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_double.uf0D_double = new Functions0D::GetProjectedXF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index 4e1fbbd699c..da328a79ab9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -27,9 +27,11 @@ static char GetProjectedYF0D___doc__[] = " :return: The Y 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self, PyObject *args ) +static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D* 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_double.uf0D_double = new Functions0D::GetProjectedYF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index 73a68b8f6a8..9c761a58e38 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -27,9 +27,11 @@ static char GetProjectedZF0D___doc__[] = " :return: The Z 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self, PyObject *args ) +static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D* 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_double.uf0D_double = new Functions0D::GetProjectedZF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index 099977e35eb..fb2c8be6a9a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -27,9 +27,11 @@ static char GetXF0D___doc__[] = " :return: The X 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetXF0D___init__( BPy_GetXF0D* self, PyObject *args ) +static int GetXF0D___init__(BPy_GetXF0D* 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_double.uf0D_double = new Functions0D::GetXF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index 7640dafef6f..97882fc51e2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -27,9 +27,11 @@ static char GetYF0D___doc__[] = " :return: The Y 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetYF0D___init__( BPy_GetYF0D* self, PyObject *args ) +static int GetYF0D___init__(BPy_GetYF0D* 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_double.uf0D_double = new Functions0D::GetYF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 01932c2b4ed..58eea1d5240 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -27,9 +27,11 @@ static char GetZF0D___doc__[] = " :return: The Z 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetZF0D___init__( BPy_GetZF0D* self, PyObject *args ) +static int GetZF0D___init__(BPy_GetZF0D* 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_double.uf0D_double = new Functions0D::GetZF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index f268fdf7003..0c4c4135b7c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -13,12 +13,12 @@ extern "C" { static char LocalAverageDepthF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" "\n" -".. method:: __init__(maskSize=5.0)\n" +".. method:: __init__(mask_size=5.0)\n" "\n" " Builds a LocalAverageDepthF0D object.\n" "\n" -" :arg maskSize: The size of the mask.\n" -" :type maskSize: float\n" +" :arg mask_size: The size of the mask.\n" +" :type mask_size: float\n" "\n" ".. method:: __call__(it)\n" "\n" @@ -31,11 +31,12 @@ static char LocalAverageDepthF0D___doc__[] = " :return: The average depth around the pointed Interface0D.\n" " :rtype: float\n"; -static int LocalAverageDepthF0D___init__( BPy_LocalAverageDepthF0D* self, PyObject *args) +static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"mask_size", NULL}; double d = 5.0; - if( !PyArg_ParseTuple(args, "|d", &d) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index 20e2ab31bda..599ba5ee76b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -32,9 +32,11 @@ static char ZDiscontinuityF0D___doc__[] = " and the occludee.\n" " :rtype: float\n"; -static int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self, PyObject *args ) +static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D* 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_double.uf0D_double = new Functions0D::ZDiscontinuityF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; |