diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-23 05:12:23 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-23 05:12:23 +0400 |
commit | 68b0a8e39026ea2b391751406dc4bdb0a4ed958c (patch) | |
tree | cdf8a143a6cf2b832f49a31c2d3b7003f92eaa43 /source/blender/freestyle/intern/python/BinaryPredicate1D | |
parent | 0fb83d78faa99a8ea3fd396887b2b31a6a36a8cd (diff) |
Freestyle Python API improvements - part 7.
Fix for PyGetSetDef and proper handling of keyword arguments were done in
UnaryPredicate0D, UnaryPredicate1D, BinaryPredicate1D, and StrokeShader classes.
Style modules were updated accordingly. Additional code clean-up was also made.
Diffstat (limited to 'source/blender/freestyle/intern/python/BinaryPredicate1D')
5 files changed, 38 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index ad2885fb95a..a784e953270 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -22,9 +22,11 @@ static char FalseBP1D___doc__[] = " :return: False.\n" " :rtype: bool\n"; -static int FalseBP1D___init__( BPy_FalseBP1D* self, PyObject *args ) +static int FalseBP1D___init__(BPy_FalseBP1D* 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_bp1D.bp1D = new Predicates1D::FalseBP1D(); return 0; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 1a59091c453..d30b164298f 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -23,9 +23,11 @@ static char Length2DBP1D___doc__[] = " :return: True or false.\n" " :rtype: bool\n"; -static int Length2DBP1D___init__( BPy_Length2DBP1D* self, PyObject *args ) +static int Length2DBP1D___init__(BPy_Length2DBP1D* 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_bp1D.bp1D = new Predicates1D::Length2DBP1D(); return 0; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index 2b479a49fc0..115f9e03b1f 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -22,9 +22,11 @@ static char SameShapeIdBP1D___doc__[] = " :return: True or false.\n" " :rtype: bool\n"; -static int SameShapeIdBP1D___init__( BPy_SameShapeIdBP1D* self, PyObject *args ) +static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D* 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_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); return 0; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index 090a8232794..37c39ed6cd9 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -22,9 +22,11 @@ static char TrueBP1D___doc__[] = " :return: True.\n" " :rtype: bool\n"; -static int TrueBP1D___init__( BPy_TrueBP1D* self, PyObject *args ) +static int TrueBP1D___init__(BPy_TrueBP1D* 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_bp1D.bp1D = new Predicates1D::TrueBP1D(); return 0; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index f5ba9d58d72..06e01dea826 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -16,6 +16,22 @@ extern "C" { static char ViewMapGradientNormBP1D___doc__[] = "Class hierarchy: :class:`BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" "\n" +".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" +"\n" +" Builds a ViewMapGradientNormBP1D object.\n" +"\n" +" :arg level: The level of the pyramid from which the pixel must be\n" +" read.\n" +" :type level: int\n" +" :arg integration_type: The integration method used to compute a single value\n" +" from a set of values.\n" +" :type integration_type: :class:`IntegrationType`\n" +" :arg sampling: The resolution used to sample the chain:\n" +" GetViewMapGradientNormF0D is evaluated at each sample point and\n" +" the result is obtained by combining the resulting values into a\n" +" single one, following the method specified by integration_type.\n" +" :type sampling: float\n" +"\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Returns true if the evaluation of the Gradient norm Function is\n" @@ -28,17 +44,17 @@ static char ViewMapGradientNormBP1D___doc__[] = " :return: True or false.\n" " :rtype: bool\n"; -static int ViewMapGradientNormBP1D___init__( BPy_ViewMapGradientNormBP1D* self, PyObject *args ) +static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; int i; - PyObject *obj; float f = 2.0; - if(!( PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; - self->py_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i,t,f); + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + self->py_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i, t, f); return 0; } |