diff options
-rw-r--r-- | release/scripts/textplugin_convert_ge.py | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Material.c | 60 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Material.py | 9 |
3 files changed, 70 insertions, 1 deletions
diff --git a/release/scripts/textplugin_convert_ge.py b/release/scripts/textplugin_convert_ge.py index f3b44cdb14b..21e065bcfd7 100644 --- a/release/scripts/textplugin_convert_ge.py +++ b/release/scripts/textplugin_convert_ge.py @@ -718,7 +718,7 @@ def convert248to249(lines, log = True, logErrors = True, fileName = None): try: # Convert! func(lines, row, match.start(1), match.end(1), closure) - except ConversionError as e: + except ConversionError, e: # Insert a comment saying the conversion failed. print "ERROR: %sline %d, %s: %s\n" % ( fileIdStr, row + 1, attrName, e) diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index ad4296d19d8..50a1be3fa97 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -139,6 +139,12 @@ #define EXPP_MAT_RAYTRANSPGLOSS_MAX 1.0 #define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN 0 #define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 1024 +#define EXPP_MAT_ANISO_GLOSS_MIR_MIN 0.0 +#define EXPP_MAT_ANISO_GLOSS_MIR_MAX 1.0 +#define EXPP_MAT_ADAPT_THRESH_MIR_MIN 0.0 +#define EXPP_MAT_ADAPT_THRESH_MIR_MAX 1.0 +#define EXPP_MAT_ADAPT_THRESH_TRA_MIN 0.0 +#define EXPP_MAT_ADAPT_THRESH_TRA_MAX 1.0 #define EXPP_MAT_FILTER_MIN 0.0 #define EXPP_MAT_FILTER_MAX 1.0 #define EXPP_MAT_TRANSLUCENCY_MIN 0.0 @@ -598,6 +604,9 @@ static int Material_setGlossMirr( BPy_Material * self, PyObject * value ); static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value ); static int Material_setGlossTrans( BPy_Material * self, PyObject * value ); static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value ); +static int Material_setAniso( BPy_Material * self, PyObject * value ); +static int Material_setThreshMirr( BPy_Material * self, PyObject * value ); +static int Material_setThreshTrans( BPy_Material * self, PyObject * value ); static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value ); static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value ); @@ -689,6 +698,9 @@ static PyObject *Material_getGlossMirr( BPy_Material * self ); static PyObject *Material_getGlossMirrSamples( BPy_Material * self ); static PyObject *Material_getGlossTrans( BPy_Material * self ); static PyObject *Material_getGlossTransSamples( BPy_Material * self ); +static PyObject *Material_getAniso( BPy_Material * self ); +static PyObject *Material_getThreshMirr( BPy_Material * self ); +static PyObject *Material_getThreshTrans( BPy_Material * self ); static PyObject *Material_getRigidBodyFriction( BPy_Material * self ); static PyObject *Material_getRigidBodyRestitution( BPy_Material * self ); @@ -1169,6 +1181,18 @@ static PyGetSetDef BPy_Material_getseters[] = { (getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples, "Refraction glossiness", NULL}, + {"anisotropy", + (getter)Material_getAniso, (setter)Material_setAniso, + "Anisotropy", + NULL}, + {"threshMir", + (getter)Material_getThreshMirr, (setter)Material_setThreshMirr, + "Reflections threshold", + NULL}, + {"threshTra", + (getter)Material_getThreshTrans, (setter)Material_setThreshTrans, + "Refractions threshold", + NULL}, {"rgbCol", (getter)Material_getRGBCol, (setter)Material_setRGBCol, "Diffuse RGB color triplet", @@ -1804,6 +1828,21 @@ static PyObject *Material_getGlossTransSamples( BPy_Material * self ) return PyInt_FromLong( ( long ) self->material->samp_gloss_tra ); } +static PyObject *Material_getAniso( BPy_Material * self ) +{ + return PyFloat_FromDouble( ( double ) self->material->aniso_gloss_mir ); +} + +static PyObject *Material_getThreshMirr( BPy_Material * self ) +{ + return PyFloat_FromDouble( ( double ) self->material->adapt_thresh_mir ); +} + +static PyObject *Material_getThreshTrans( BPy_Material * self ) +{ + return PyFloat_FromDouble( ( double ) self->material->adapt_thresh_tra ); +} + static PyObject* Material_getRigidBodyFriction( BPy_Material * self ) { return PyFloat_FromDouble( ( double ) self->material->friction ); @@ -2379,6 +2418,27 @@ static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX, 'h' ); } +static int Material_setAniso( BPy_Material * self, PyObject * value ) +{ + return EXPP_setFloatClamped ( value, &self->material->aniso_gloss_mir, + EXPP_MAT_ANISO_GLOSS_MIR_MIN, + EXPP_MAT_ANISO_GLOSS_MIR_MAX ); +} + +static int Material_setThreshMirr( BPy_Material * self, PyObject * value ) +{ + return EXPP_setFloatClamped ( value, &self->material->adapt_thresh_mir, + EXPP_MAT_ADAPT_THRESH_MIR_MIN, + EXPP_MAT_ADAPT_THRESH_MIR_MAX ); +} + +static int Material_setThreshTrans( BPy_Material * self, PyObject * value ) +{ + return EXPP_setFloatClamped ( value, &self->material->adapt_thresh_tra, + EXPP_MAT_ADAPT_THRESH_TRA_MIN, + EXPP_MAT_ADAPT_THRESH_TRA_MAX ); +} + static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value ) { return EXPP_setFloatClamped ( value, &self->material->friction, diff --git a/source/blender/python/api2_2x/doc/Material.py b/source/blender/python/api2_2x/doc/Material.py index 3b8148b3f11..59ff4bc8503 100644 --- a/source/blender/python/api2_2x/doc/Material.py +++ b/source/blender/python/api2_2x/doc/Material.py @@ -285,6 +285,15 @@ class Material: @ivar sampGlossTra: Refraction glossy samples. Value is clamped to the range [1,1024]. @type sampGlossTra: int + @ivar anisotropy: The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent). + Value is clamped to the range [0.0,1.0]. + @type anisotropy: float + @ivar threshMir: Threshold below which reflections will not be computed. + Value is clamped to the range [0.0,1.0]. + @type threshMir: float + @ivar threshTra: threshold below which refractions will not be computed. + Value is clamped to the range [0.0,1.0]. + @type threshTra: float @ivar rayMirrDepth: Amount of raytrace inter-reflections. Value is clamped to the range [0,10]. @type rayMirrDepth: int |