diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-08-19 03:07:17 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-08-19 03:07:17 +0400 |
commit | 4ec69d5a2beb02c57d079d41a76008320ef4885b (patch) | |
tree | bafa3043585c346569818177e596a8a14a515557 /source/blender/freestyle/intern/python | |
parent | 0ddf5b1da5ea11330b46571bd700e1f7c065f718 (diff) |
Added an optional argument 'seed' to the Freestyle.Noise class constructor.
The value is used as a seed for random number generation if it is equal to
or greater than zero; otherwise, time is used as a seed.
Diffstat (limited to 'source/blender/freestyle/intern/python')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_FrsNoise.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index bd2b5a4dad0..d58a37179ac 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -28,15 +28,21 @@ int FrsNoise_Init( PyObject *module ) static char FrsNoise___doc__[] = "Class to provide Perlin noise functionalities.\n" "\n" -".. method:: __init__()\n" +".. method:: __init__(seed = -1)\n" "\n" -" Builds a Noise object.\n"; +" Builds a Noise object. Seed is an optional argument. The seed value is used\n" +" as a seed for random number generation if it is equal to or greater than zero;\n" +" otherwise, time is used as a seed.\n" +"\n" +" :arg seed: Seed for random number generation.\n" +" :type seed: int\n"; static int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - if(!( PyArg_ParseTuple(args, "") )) + long seed = -1; + if(!( PyArg_ParseTuple(args, "|l", &seed) )) return -1; - self->n = new Noise(); + self->n = new Noise(seed); return 0; } |