From 68b0a8e39026ea2b391751406dc4bdb0a4ed958c Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 23 Feb 2013 01:12:23 +0000 Subject: 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. --- .../StrokeShader/BPy_IncreasingColorShader.cpp | 47 +++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp') 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; } -- cgit v1.2.3