diff options
author | Ken Hughes <khughes@pacific.edu> | 2008-08-11 23:06:30 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2008-08-11 23:06:30 +0400 |
commit | 7f3a2a4abecb1b3b8958c019b9278852f20e51bb (patch) | |
tree | 1a55c151d9ce34c147af1452d19768abb71f946d /source/blender | |
parent | 04b90467c3ab6223c5f24f248c38fd6e03d227e1 (diff) |
Python API
----------
Added texture.offset and textute.gain attributes, to access parameters for Musgrove textures.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/api2_2x/Texture.c | 40 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Texture.py | 6 |
2 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index 696c78f2bac..7ba8ad88ea6 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -105,6 +105,10 @@ #define EXPP_TEX_LACUNARITY_MAX 6.0f #define EXPP_TEX_OCTS_MIN 0.0f #define EXPP_TEX_OCTS_MAX 8.0f +#define EXPP_TEX_OFST_MIN 0.0f +#define EXPP_TEX_OFST_MAX 6.0f +#define EXPP_TEX_GAIN_MIN 0.0f +#define EXPP_TEX_GAIN_MAX 6.0f #define EXPP_TEX_ISCALE_MIN 0.0f #define EXPP_TEX_ISCALE_MAX 10.0f #define EXPP_TEX_EXP_MIN 0.010f @@ -430,6 +434,8 @@ GETFUNC( getNoiseDepth ); GETFUNC( getNoiseSize ); GETFUNC( getNoiseType ); GETFUNC( getOcts ); +GETFUNC( getOffset ); +GETFUNC( getGain ); GETFUNC( getRepeat ); GETFUNC( getRGBCol ); GETFUNC( getSType ); @@ -478,6 +484,8 @@ SETFUNC( setNoiseDepth ); SETFUNC( setNoiseSize ); SETFUNC( setNoiseType ); SETFUNC( setOcts ); +SETFUNC( setOffset ); +SETFUNC( setGain ); SETFUNC( setRepeat ); SETFUNC( setRGBCol ); SETFUNC( setSType ); @@ -646,6 +654,14 @@ static PyGetSetDef BPy_Texture_getseters[] = { (getter)Texture_getLacunarity, (setter)Texture_setLacunarity, "Gap between succesive frequencies (for Musgrave textures)", NULL}, + {"offset", + (getter)Texture_getOffset, (setter)Texture_setOffset, + "Fractal offset (for Musgrave textures)", + NULL}, + {"gain", + (getter)Texture_getGain, (setter)Texture_setGain, + "Gain multiplier (for Musgrave textures)", + NULL}, {"noiseBasis", (getter)Texture_getNoiseBasis, (setter)Texture_setNoiseBasis, "Noise basis type (wood, stucci, marble, clouds, Musgrave, distorted noise)", @@ -1837,6 +1853,20 @@ static int Texture_setLacunarity( BPy_Texture * self, PyObject * value ) EXPP_TEX_LACUNARITY_MAX ); } +static int Texture_setOffset( BPy_Texture * self, PyObject * value ) +{ + return EXPP_setFloatClamped ( value, &self->texture->mg_offset, + EXPP_TEX_OFST_MIN, + EXPP_TEX_OFST_MAX ); +} + +static int Texture_setGain( BPy_Texture * self, PyObject * value ) +{ + return EXPP_setFloatClamped ( value, &self->texture->mg_gain, + EXPP_TEX_GAIN_MIN, + EXPP_TEX_GAIN_MAX ); +} + static int Texture_setOcts( BPy_Texture * self, PyObject * value ) { return EXPP_setFloatClamped ( value, &self->texture->mg_octaves, @@ -2168,6 +2198,16 @@ static PyObject *Texture_getOcts( BPy_Texture *self ) return PyFloat_FromDouble( self->texture->mg_octaves ); } +static PyObject *Texture_getOffset( BPy_Texture *self ) +{ + return PyFloat_FromDouble( self->texture->mg_offset ); +} + +static PyObject *Texture_getGain( BPy_Texture *self ) +{ + return PyFloat_FromDouble( self->texture->mg_gain ); +} + static PyObject *Texture_getRepeat( BPy_Texture *self ) { return Py_BuildValue( "(i,i)", self->texture->xrepeat, diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py index 7f42d06240b..cebb7de7011 100644 --- a/source/blender/python/api2_2x/doc/Texture.py +++ b/source/blender/python/api2_2x/doc/Texture.py @@ -344,6 +344,12 @@ class Texture: @ivar octs: Number of frequencies (for Musgrave textures). Value is clamped to the range [0.0,8.0]. @type octs: float + @ivar offset: Fractal offset (for hetero terrain and multifractal Musgrave textures). + Value is clamped to the range [0.0,6.0]. + @type offset: float + @ivar gain: Gain multiplier (for multifractal Musgrave textures). + Value is clamped to the range [0.0,6.0]. + @type gain: float @ivar repeat: Repetition multiplier (for image textures). @type repeat: tuple of 2 ints @ivar rgbCol: RGB color tuple. |