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/StrokeShader | |
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/StrokeShader')
22 files changed, 287 insertions, 269 deletions
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index cdab4b38b95..a0da18ddb37 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -15,28 +15,28 @@ static char BackboneStretcherShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(iAmount=2.0)\n" +".. method:: __init__(amount=2.0)\n" "\n" " Builds a BackboneStretcherShader object.\n" "\n" -" :arg iAmount: The stretching amount value.\n" -" :type iAmount: float\n" +" :arg amount: The stretching amount value.\n" +" :type amount: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Stretches the stroke at its two extremities and following the\n" " respective directions: v(1)v(0) and v(n-1)v(n).\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int BackboneStretcherShader___init__( BPy_BackboneStretcherShader* self, PyObject *args) +static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"amount", NULL}; float f = 2.0; - if(!( PyArg_ParseTuple(args, "|f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index f3d3bfafd08..05c533d631a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -24,21 +24,21 @@ static char BezierCurveShader___doc__[] = " original geometry.\n" " :type error: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Transforms the stroke backbone geometry so that it corresponds to a\n" " Bezier Curve approximation of the original backbone geometry.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int BezierCurveShader___init__( BPy_BezierCurveShader* self, PyObject *args) +static int BezierCurveShader___init__(BPy_BezierCurveShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"error", NULL}; float f = 4.0; - if(!( PyArg_ParseTuple(args, "|f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index bb77d0ba5be..c1d9ccc8599 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -16,51 +16,53 @@ static char CalligraphicShader___doc__[] = "\n" "[Thickness Shader]\n" "\n" -".. method:: __init__(iMinThickness, iMaxThickness, iOrientation, iClamp)\n" +".. method:: __init__(thickness_min, thickness_max, orientation, clamp)\n" "\n" " Builds a CalligraphicShader object.\n" "\n" -" :arg iMinThickness: The minimum thickness in the direction\n" +" :arg thickness_min: The minimum thickness in the direction\n" " perpendicular to the main direction.\n" -" :type iMinThickness: float\n" -" :arg iMaxThickness: The maximum thickness in the main direction.\n" -" :type iMaxThickness: float\n" -" :arg iOrientation: The 2D vector giving the main direction.\n" -" :type iOrientation: :class:`mathutils.Vector`\n" -" :arg iClamp: If true, the strokes are drawn in black when the stroke\n" +" :type thickness_min: float\n" +" :arg thickness_max: The maximum thickness in the main direction.\n" +" :type thickness_max: float\n" +" :arg orientation: The 2D vector giving the main direction.\n" +" :type orientation: :class:`mathutils.Vector`\n" +" :arg clamp: If true, the strokes are drawn in black when the stroke\n" " direction is between -90 and 90 degrees with respect to the main\n" " direction and drawn in white otherwise. If false, the strokes\n" " are always drawn in black.\n" -" :type iClamp: bool\n" +" :type clamp: bool\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns thicknesses to the stroke vertices so that the stroke looks\n" " like made with a calligraphic tool, i.e. the stroke will be the\n" " thickest in a main direction, and the thinest in the direction\n" " perpendicular to this one, and an interpolation inbetween.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) +static int convert_v2(PyObject *obj, void *v) { + return float_array_from_PyObject(obj, (float *)v, 2); +} + +static int CalligraphicShader___init__(BPy_CalligraphicShader* self, PyObject *args, PyObject *kwds) +{ + static const char *kwlist[] = {"thickness_min", "thickness_max", "orientation", "clamp", NULL}; double d1, d2; - PyObject *obj3 = 0, *obj4 = 0; - + float f3[2]; + PyObject *obj4 = 0; - if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) )) - return -1; - Vec2f *v = Vec2f_ptr_from_PyObject(obj3); - if( !v ) { - PyErr_SetString(PyExc_TypeError, "argument 3 must be a 2D vector (either a list of 2 elements or Vector)"); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ddO&O!", (char **)kwlist, + &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4)) + { return -1; } - self->py_ss.ss = new CalligraphicShader(d1, d2, *v, bool_from_PyBool(obj4) ); - delete v; - + Vec2f v(f3[0], f3[1]); + self->py_ss.ss = new CalligraphicShader(d1, d2, v, bool_from_PyBool(obj4)); return 0; - } /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index d005e8ccfe8..3e0f864f468 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -15,29 +15,29 @@ static char ColorNoiseShader___doc__[] = "\n" "[Color shader]\n" "\n" -".. method:: __init__(iAmplitude, iPeriod)\n" +".. method:: __init__(amplitude, period)\n" "\n" " Builds a ColorNoiseShader object.\n" "\n" -" :arg iAmplitude: The amplitude of the noise signal.\n" -" :type iAmplitude: float\n" -" :arg iPeriod: The period of the noise signal.\n" -" :type iPeriod: float\n" +" :arg amplitude: The amplitude of the noise signal.\n" +" :type amplitude: float\n" +" :arg period: The period of the noise signal.\n" +" :type period: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Shader to add noise to the stroke colors.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ColorNoiseShader___init__( BPy_ColorNoiseShader* self, PyObject *args) +static int ColorNoiseShader___init__(BPy_ColorNoiseShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"amplitude", "period", NULL}; float f1, f2; - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) return -1; - self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp index 2d48df78da1..d0451578f87 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp @@ -27,24 +27,24 @@ static char ColorVariationPatternShader___doc__[] = " repeted to fit the stroke.\n" " :type stretch: bool\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Applies a pattern to vary the original color. The new color is the\n" " result of the multiplication of the pattern and the original color.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ColorVariationPatternShader___init__( BPy_ColorVariationPatternShader* self, PyObject *args) +static int ColorVariationPatternShader___init__(BPy_ColorVariationPatternShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"pattern_name", "stretch", NULL}; const char *s; PyObject *obj = 0; - - if(!( PyArg_ParseTuple(args, "s|O", &s, &obj) )) - return -1; - bool b = (obj) ? bool_from_PyBool(obj) : true; - self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s,b); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!", (char **)kwlist, &s, &PyBool_Type, &obj)) + return -1; + bool b = (!obj) ? true : bool_from_PyBool(obj); + self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s, b); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index d0f4c365a80..61d46f58f26 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -15,33 +15,33 @@ static char ConstantColorShader___doc__[] = "\n" "[Color shader]\n" "\n" -".. method:: __init__(iR, iG, iB, iAlpha=1.0)\n" +".. method:: __init__(red, green, blue, alpha=1.0)\n" "\n" " Builds a ConstantColorShader object.\n" "\n" -" :arg iR: The red component.\n" -" :type iR: float\n" -" :arg iG: The green component.\n" -" :type iG: float\n" -" :arg iB: The blue component.\n" -" :type iB: float\n" -" :arg iAlpha: The alpha value.\n" -" :type iAlpha: float\n" +" :arg red: The red component.\n" +" :type red: float\n" +" :arg green: The green component.\n" +" :type green: float\n" +" :arg blue: The blue component.\n" +" :type blue: float\n" +" :arg alpha: The alpha value.\n" +" :type alpha: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns a constant color to every vertex of the Stroke.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ConstantColorShader___init__( BPy_ConstantColorShader* self, PyObject *args) +static int ConstantColorShader___init__(BPy_ConstantColorShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"red", "green", "blue", "alpha", NULL}; float f1, f2, f3, f4 = 1.0; - if(!( PyArg_ParseTuple(args, "fff|f", &f1, &f2, &f3, &f4) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4)) return -1; - self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 60d3e696675..656cec8f651 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -22,20 +22,20 @@ static char ConstantThicknessShader___doc__[] = " :arg thickness: The thickness that must be assigned to the stroke.\n" " :type thickness: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns an absolute constant thickness to every vertex of the Stroke.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ConstantThicknessShader___init__( BPy_ConstantThicknessShader* self, PyObject *args) +static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"thickness", NULL}; float f; - if(!( PyArg_ParseTuple(args, "f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index 3892ccca37b..3abf2716695 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -15,33 +15,33 @@ static char ConstrainedIncreasingThicknessShader___doc__[] = "\n" "[Thickness shader]\n" "\n" -".. method:: __init__(iThicknessMin, iThicknessMax, iRatio)\n" +".. method:: __init__(thickness_min, thickness_max, ratio)\n" "\n" " Builds a ConstrainedIncreasingThicknessShader object.\n" "\n" -" :arg iThicknessMin: The minimum thickness.\n" -" :type iThicknessMin: float\n" -" :arg iThicknessMax: The maximum thickness.\n" -" :type iThicknessMax: float\n" -" :arg iRatio: The thickness/length ratio that we don't want to exceed. \n" -" :type iRatio: float\n" +" :arg thickness_min: The minimum thickness.\n" +" :type thickness_min: float\n" +" :arg thickness_max: The maximum thickness.\n" +" :type thickness_max: float\n" +" :arg ratio: The thickness/length ratio that we don't want to exceed. \n" +" :type ratio: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Same as the :class:`IncreasingThicknessShader`, but here we allow\n" " the user to control the thickness/length ratio so that we don't get\n" " fat short lines.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args) +static int ConstrainedIncreasingThicknessShader___init__(BPy_ConstrainedIncreasingThicknessShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", NULL}; float f1, f2, f3; - if(!( PyArg_ParseTuple(args, "fff", &f1, &f2, &f3) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", (char **)kwlist, &f1, &f2, &f3)) return -1; - self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index 79af155b728..f2dace8b4d5 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -15,17 +15,17 @@ static char GuidingLinesShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(iOffset)\n" +".. method:: __init__(offset)\n" "\n" " Builds a GuidingLinesShader object.\n" "\n" -" :arg iOffset: The line that replaces the stroke is initially in the\n" -" middle of the initial stroke bounding box. iOffset is the value\n" +" :arg offset: The line that replaces the stroke is initially in the\n" +" middle of the initial stroke bounding box. offset is the value\n" " of the displacement which is applied to this line along its\n" " normal.\n" -" :type iOffset: float\n" +" :type offset: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Shader to modify the Stroke geometry so that it corresponds to its\n" " main direction line. This shader must be used together with the\n" @@ -34,16 +34,16 @@ static char GuidingLinesShader___doc__[] = " stroke's pieces. The bigger the pieces are, the rougher the\n" " approximation is.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int GuidingLinesShader___init__( BPy_GuidingLinesShader* self, PyObject *args) +static int GuidingLinesShader___init__(BPy_GuidingLinesShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"offset", NULL}; float f; - if(!( PyArg_ParseTuple(args, "f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index 063e5cd587d..3cf5800e77d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -15,43 +15,44 @@ static char IncreasingColorShader___doc__[] = "\n" "[Color shader]\n" "\n" -".. method:: __init__(iRm, iGm, iBm, iAlpham, iRM, iGM, iBM, iAlphaM)\n" +".. method:: __init__(red_min, green_min, blue_min, alpha_min, red_max, green_max, blue_max, alpha_max)\n" "\n" " Builds an IncreasingColorShader object.\n" "\n" -" :arg iRm: The first color red component.\n" -" :type iRm: float\n" -" :arg iGm: The first color green component.\n" -" :type iGm: float\n" -" :arg iBm: The first color blue component.\n" -" :type iBm: float\n" -" :arg iAlpham: The first color alpha value.\n" -" :type iAlpham: float\n" -" :arg iRM: The second color red component.\n" -" :type iRM: float\n" -" :arg iGM: The second color green component.\n" -" :type iGM: float\n" -" :arg iBM: The second color blue component.\n" -" :type iBM: float\n" -" :arg iAlphaM: The second color alpha value.\n" -" :type iAlphaM: float\n" +" :arg red_min: The first color red component.\n" +" :type red_min: float\n" +" :arg green_min: The first color green component.\n" +" :type green_min: float\n" +" :arg blue_min: The first color blue component.\n" +" :type blue_min: float\n" +" :arg alpha_min: The first color alpha value.\n" +" :type alpha_min: float\n" +" :arg red_max: The second color red component.\n" +" :type red_max: float\n" +" :arg green_max: The second color green component.\n" +" :type green_max: float\n" +" :arg blue_max: The second color blue component.\n" +" :type blue_max: float\n" +" :arg alpha_max: The second color alpha value.\n" +" :type alpha_max: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns a varying color to the stroke. The user specifies two\n" " colors A and B. The stroke color will change linearly from A to B\n" " between the first and the last vertex.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int IncreasingColorShader___init__( BPy_IncreasingColorShader* self, PyObject *args) +static int IncreasingColorShader___init__(BPy_IncreasingColorShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"red_min", "green_min", "blue_min", "alpha_min", + "red_max", "green_max", "blue_max", "alpha_max", NULL}; float f1, f2, f3, f4, f5, f6, f7, f8; - if(!( PyArg_ParseTuple(args, "ffffffff", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffffffff", (char **)kwlist, &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8)) return -1; - self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index 398587df23e..fe051ebaed4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -15,16 +15,16 @@ static char IncreasingThicknessShader___doc__[] = "\n" "[Thickness shader]\n" "\n" -".. method:: __init__(iThicknessA, iThicknessB)\n" +".. method:: __init__(thickness_A, thickness_B)\n" "\n" " Builds an IncreasingThicknessShader object.\n" "\n" -" :arg iThicknessA: The first thickness value.\n" -" :type iThicknessA: float\n" -" :arg iThicknessB: The second thickness value.\n" -" :type iThicknessB: float\n" +" :arg thickness_A: The first thickness value.\n" +" :type thickness_A: float\n" +" :arg thickness_B: The second thickness value.\n" +" :type thickness_B: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns thicknesses values such as the thickness increases from a\n" " thickness value A to a thickness value B between the first vertex\n" @@ -32,16 +32,16 @@ static char IncreasingThicknessShader___doc__[] = " this midpoint vertex and the last vertex. The thickness is\n" " linearly interpolated from A to B.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int IncreasingThicknessShader___init__( BPy_IncreasingThicknessShader* self, PyObject *args) +static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"thickness_A", "thickness_B", NULL}; float f1, f2; - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) return -1; - self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index 2ea4bf14941..367d0004995 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -15,17 +15,17 @@ static char PolygonalizationShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(iError)\n" +".. method:: __init__(error)\n" "\n" " Builds a PolygonalizationShader object.\n" "\n" -" :arg iError: The error we want our polygonal approximation to have\n" +" :arg error: The error we want our polygonal approximation to have\n" " with respect to the original geometry. The smaller, the closer\n" " the new stroke is to the orinal one. This error corresponds to\n" " the maximum distance between the new stroke and the old one.\n" -" :type iError: float\n" +" :type error: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Modifies the Stroke geometry so that it looks more \"polygonal\".\n" " The basic idea is to start from the minimal stroke approximation\n" @@ -33,16 +33,16 @@ static char PolygonalizationShader___doc__[] = " to subdivide using the original stroke vertices until a certain\n" " error is reached.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int PolygonalizationShader___init__( BPy_PolygonalizationShader* self, PyObject *args) +static int PolygonalizationShader___init__(BPy_PolygonalizationShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"error", NULL}; float f; - if(!( PyArg_ParseTuple(args, "f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index 08b1e64f7a5..a33ad8dd9c4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -22,20 +22,20 @@ static char SamplingShader___doc__[] = " :arg sampling: The sampling to use for the stroke resampling.\n" " :type sampling: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Resamples the stroke.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int SamplingShader___init__( BPy_SamplingShader* self, PyObject *args) +static int SamplingShader___init__(BPy_SamplingShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"sampling", NULL}; float f; - if(!( PyArg_ParseTuple(args, "f", &f) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) return -1; - self->py_ss.ss = new StrokeShaders::SamplingShader(f); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 6f62865f99a..a041449db4b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -15,45 +15,53 @@ static char SmoothingShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(iNbIteration, iFactorPoint, ifactorCurvature, iFactorCurvatureDifference, iAnisoPoint, iAnisNormal, iAnisoCurvature, icarricatureFactor)\n" +".. method:: __init__(num_iterations=100, factor_point=0.1,\n" +" factor_curvature=0.0, factor_curvature_difference=0.2,\n" +" aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,\n" +" carricature_factor=1.0)\n" "\n" " Builds a SmoothingShader object.\n" "\n" -" :arg iNbIteration: The number of iterations (400).\n" -" :type iNbIteration: int\n" -" :arg iFactorPoint: 0.0\n" -" :type iFactorPoint: float\n" -" :arg ifactorCurvature: 0.0\n" -" :type ifactorCurvature: float\n" -" :arg iFactorCurvatureDifference: 0.2\n" -" :type iFactorCurvatureDifference: float\n" -" :arg iAnisoPoint: \n" -" :type iAnisoPoint: float\n" -" :arg iAnisNormal: 0.0\n" -" :type iAnisNormal: float\n" -" :arg iAnisoCurvature: 0.0\n" -" :type iAnisoCurvature: float\n" -" :arg icarricatureFactor: 1.0\n" -" :type icarricatureFactor: float\n" +" :arg num_iterations: The number of iterations.\n" +" :type num_iterations: int\n" +" :arg factor_point: 0.1\n" +" :type factor_point: float\n" +" :arg factor_curvature: 0.0\n" +" :type factor_curvature: float\n" +" :arg factor_curvature_difference: 0.2\n" +" :type factor_curvature_difference: float\n" +" :arg aniso_point: 0.0\n" +" :type aniso_point: float\n" +" :arg aniso_normal: 0.0\n" +" :type aniso_normal: float\n" +" :arg aniso_curvature: 0.0\n" +" :type aniso_curvature: float\n" +" :arg carricature_factor: 1.0\n" +" :type carricature_factor: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Smoothes the stroke by moving the vertices to make the stroke\n" " smoother. Uses curvature flow to converge towards a curve of\n" " constant curvature. The diffusion method we use is anisotropic to\n" " prevent the diffusion accross corners.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int SmoothingShader___init__( BPy_SmoothingShader* self, PyObject *args) +static int SmoothingShader___init__(BPy_SmoothingShader* self, PyObject *args, PyObject *kwds) { - int i1; - double d2, d3, d4, d5, d6, d7, d8; + static const char *kwlist[] = {"num_iterations", "factor_point", "factor_curvature", + "factor_curvature_difference", "aniso_point", "aniso_normal", + "aniso_curvature", "carricature_factor", NULL}; + int i1 = 100; + double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0; - if(!( PyArg_ParseTuple(args, "iddddddd", &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iddddddd", (char **)kwlist, + &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8)) + { return -1; - + } self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index 245212c3950..89991ff43f5 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -16,39 +16,42 @@ static char SpatialNoiseShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(iAmount, ixScale, nbOctave, smooth, pureRandom)\n" +".. method:: __init__(amount, scale, num_octaves, smooth, pure_random)\n" "\n" " Builds a SpatialNoiseShader object.\n" "\n" -" :arg iAmount: The amplitude of the noise.\n" -" :type iAmount: float\n" -" :arg ixScale: The noise frequency.\n" -" :type ixScale: float\n" -" :arg nbOctave: The number of octaves\n" -" :type nbOctave: int\n" +" :arg amount: The amplitude of the noise.\n" +" :type amount: float\n" +" :arg scale: The noise frequency.\n" +" :type scale: float\n" +" :arg num_octaves: The number of octaves\n" +" :type num_octaves: int\n" " :arg smooth: True if you want the noise to be smooth.\n" " :type smooth: bool\n" -" :arg pureRandom: True if you don't want any coherence.\n" -" :type pureRandom: bool\n" +" :arg pure_random: True if you don't want any coherence.\n" +" :type pure_random: bool\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Spatial Noise stroke shader. Moves the vertices to make the stroke\n" " more noisy.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int SpatialNoiseShader___init__( BPy_SpatialNoiseShader* self, PyObject *args) +static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"amount", "scale", "num_octaves", "smooth", "pure_random", NULL}; float f1, f2; int i3; PyObject *obj4 = 0, *obj5 = 0; - - if(!( PyArg_ParseTuple(args, "ffiOO", &f1, &f2, &i3, &obj4, &obj5) )) - return -1; - self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5) ); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffiO!O!", (char **)kwlist, + &f1, &f2, &i3, &PyBool_Type, &obj4, &PyBool_Type, &obj5)) + { + return -1; + } + self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5)); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp index a6e2d9f71e0..8ea2eac552d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp @@ -17,18 +17,18 @@ static char StrokeTextureShader___doc__[] = "\n" "[Texture shader]\n" "\n" -".. method:: __init__(textureFile, mediumType=MediumType.OPAQUE_MEDIUM, iTips=False)\n" +".. method:: __init__(texture_file, medium_type=MediumType.OPAQUE_MEDIUM, tips=False)\n" "\n" " Builds a StrokeTextureShader object.\n" "\n" -" :arg textureFile: \n" -" :type textureFile: str\n" -" :arg mediumType: The medium type and therefore, the blending mode\n" +" :arg texture_file: \n" +" :type texture_file: str\n" +" :arg medium_type: The medium type and therefore, the blending mode\n" " that must be used for the rendering of this stroke.\n" -" :type mediumType: :class:`MediumType`\n" -" :arg iTips: Tells whether the texture includes tips or not. If it\n" +" :type medium_type: :class:`MediumType`\n" +" :arg tips: Tells whether the texture includes tips or not. If it\n" " is the case, the texture image must respect the following format.\n" -" :type iTips: bool\n" +" :type tips: bool\n" "\n" " The format of a texture image including tips::\n" "\n" @@ -44,26 +44,28 @@ static char StrokeTextureShader___doc__[] = " * B : The stroke's left extremity texture.\n" " * C : The stroke's right extremity texture.\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns a texture and a blending mode to the stroke in order to\n" " simulate its marks system.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int StrokeTextureShader___init__( BPy_StrokeTextureShader* self, PyObject *args) +static int StrokeTextureShader___init__(BPy_StrokeTextureShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL}; const char *s1; PyObject *obj2 = 0, *obj3 = 0; - - if(!( PyArg_ParseTuple(args, "s|O!O", &s1, &MediumType_Type, &obj2, &obj3) )) - return -1; - Stroke::MediumType mt = (obj2) ? MediumType_from_BPy_MediumType(obj2) : Stroke::OPAQUE_MEDIUM; - bool b = (obj3) ? bool_from_PyBool(obj3) : true; - - self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1,mt,b); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist, + &s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3)) + { + return -1; + } + Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2); + bool b = (!obj3) ? false : bool_from_PyBool(obj3); + self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp index 7fbb3462fb4..ea0b0e26f87 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp @@ -15,14 +15,14 @@ static char TextureAssignerShader___doc__[] = "\n" "[Texture shader]\n" "\n" -".. method:: __init__(id)\n" +".. method:: __init__(preset)\n" "\n" " Builds a TextureAssignerShader object.\n" "\n" -" :arg id: The preset number to use.\n" -" :type id: int\n" +" :arg preset: The preset number to use.\n" +" :type preset: int\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Assigns a texture to the stroke in order to simulate its marks\n" " system. This shader takes as input an integer value telling which\n" @@ -42,16 +42,16 @@ static char TextureAssignerShader___doc__[] = "\n" " * Default: `/brushes/smoothAlpha.bmp`, `MediumType.OPAQUE_MEDIUM`\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int TextureAssignerShader___init__( BPy_TextureAssignerShader* self, PyObject *args) +static int TextureAssignerShader___init__(BPy_TextureAssignerShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"preset", NULL}; int i; - if(!( PyArg_ParseTuple(args, "i", &i) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) return -1; - self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index c0cf2176b52..d0f476a4e10 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -15,29 +15,29 @@ static char ThicknessNoiseShader___doc__[] = "\n" "[Thickness shader]\n" "\n" -".. method:: __init__(iAmplitude, iPeriod)\n" +".. method:: __init__(amplitude, period)\n" "\n" " Builds a ThicknessNoiseShader object.\n" "\n" -" :arg iAmplitude: The amplitude of the noise signal.\n" -" :type iAmplitude: float\n" -" :arg iPeriod: The period of the noise signal.\n" -" :type iPeriod: float\n" +" :arg amplitude: The amplitude of the noise signal.\n" +" :type amplitude: float\n" +" :arg period: The period of the noise signal.\n" +" :type period: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Adds some noise to the stroke thickness.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ThicknessNoiseShader___init__( BPy_ThicknessNoiseShader* self, PyObject *args) +static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"amplitude", "period", NULL}; float f1, f2; - - if(!( PyArg_ParseTuple(args, "ff", &f1, &f2) )) - return -1; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) + return -1; self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp index afcfd68fcec..70c76dd22d3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp @@ -16,39 +16,39 @@ static char ThicknessVariationPatternShader___doc__[] = "\n" "[Thickness shader]\n" "\n" -".. method:: __init__(pattern_name, iMinThickness, iMaxThickness, stretch)\n" +".. method:: __init__(pattern_name, thickness_min=1.0, thickness_max=5.0, stretch=True)\n" "\n" " Builds a ThicknessVariationPatternShader object.\n" "\n" " :arg pattern_name: The texture file name.\n" " :type pattern_name: str\n" -" :arg iMinThickness: The minimum thickness we don't want to exceed.\n" -" :type iMinThickness: float\n" -" :arg iMaxThickness: The maximum thickness we don't want to exceed.\n" -" :type iMaxThickness: float\n" +" :arg thickness_min: The minimum thickness we don't want to exceed.\n" +" :type thickness_min: float\n" +" :arg thickness_max: The maximum thickness we don't want to exceed.\n" +" :type thickness_max: float\n" " :arg stretch: Tells whether the pattern texture must be stretched\n" -" or repeted to fit the stroke.\n" +" or repeated to fit the stroke.\n" " :type stretch: bool\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Applies a pattern (texture) to vary thickness. The new thicknesses\n" " are the result of the multiplication of the pattern and the\n" " original thickness.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args) +static int ThicknessVariationPatternShader___init__(BPy_ThicknessVariationPatternShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"pattern_name", "thickness_min", "thickness_max", "stretch", NULL}; const char *s1; float f2 = 1.0, f3 = 5.0; PyObject *obj4 = 0; - if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ffO!", (char **)kwlist, &s1, &f2, &f3, &PyBool_Type, &obj4)) return -1; - - bool b = (obj4) ? bool_from_PyBool(obj4) : true; + bool b = (!obj4) ? true : bool_from_PyBool(obj4); self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 8241a03892c..34ab23687bb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -15,28 +15,28 @@ static char TipRemoverShader___doc__[] = "\n" "[Geometry shader]\n" "\n" -".. method:: __init__(tipLength)\n" +".. method:: __init__(tip_length)\n" "\n" " Builds a TipRemoverShader object.\n" "\n" -" :arg tipLength: The length of the piece of stroke we want to remove\n" +" :arg tip_length: The length of the piece of stroke we want to remove\n" " at each extremity.\n" -" :type tipLength: float\n" +" :type tip_length: float\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Removes the stroke's extremities.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int TipRemoverShader___init__( BPy_TipRemoverShader* self, PyObject *args) +static int TipRemoverShader___init__(BPy_TipRemoverShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"tip_length", NULL}; double d; - if(!( PyArg_ParseTuple(args, "d", &d) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d)) return -1; - self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp index 2d9828c232c..765465cac6c 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp @@ -15,27 +15,27 @@ static char fstreamShader___doc__[] = "\n" "[Output shader]\n" "\n" -".. method:: __init__(iFileName)\n" +".. method:: __init__(filename)\n" "\n" " Builds a fstreamShader object.\n" "\n" -" :arg iFileName: The output file name.\n" -" :type iFileName: str\n" +" :arg filename: The output file name.\n" +" :type filename: str\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Streams the Stroke in a file.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int fstreamShader___init__( BPy_fstreamShader* self, PyObject *args) +static int fstreamShader___init__(BPy_fstreamShader* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"filename", NULL}; const char *s; - if(!( PyArg_ParseTuple(args, "s", &s) )) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &s)) return -1; - self->py_ss.ss = new StrokeShaders::fstreamShader(s); return 0; } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp index 722c51c440e..a37cfc68d44 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp @@ -19,16 +19,18 @@ static char streamShader___doc__[] = "\n" " Builds a streamShader object.\n" "\n" -".. method:: shade(s)\n" +".. method:: shade(stroke)\n" "\n" " Streams the Stroke into stdout.\n" "\n" -" :arg s: A Stroke object.\n" -" :type s: :class:`Stroke`\n"; +" :arg stroke: A Stroke object.\n" +" :type stroke: :class:`Stroke`\n"; -static int streamShader___init__( BPy_streamShader* self, PyObject *args) +static int streamShader___init__(BPy_streamShader* 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_ss.ss = new StrokeShaders::streamShader(); return 0; |