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/BPy_SpatialNoiseShader.cpp | |
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/BPy_SpatialNoiseShader.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
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; } |