Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-09 16:18:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-09 16:18:20 +0400
commite4b427bb595f15956f72b53961586504464fdb8a (patch)
tree279f2746b61c3744257c00f6a6719c4871c92fd9 /source
parent105d3fd32324c3d6dcf1b1ecbd5d50c4afea89cc (diff)
[#18847] Material.c Python API calls
Adds access to... - Anisotropy - Mirr Threshold - Trans Threshold Breaks rule of no additions but python data access is quite safe, vray exporter needed these attributes. [#18891] BGE Convert script Python 2.5 compatible
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/api2_2x/Material.c60
-rw-r--r--source/blender/python/api2_2x/doc/Material.py9
2 files changed, 69 insertions, 0 deletions
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