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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-03-08 09:35:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-03-08 09:35:01 +0300
commit8e0704f59a40d9dd89b0c9cf92ec3484a106fa78 (patch)
tree0ef91cc93c518ed3ec286279a5bff53e21055f04 /source/blender/python/api2_2x/Texture.c
parent4bd5ab628bbbdb23b1aeb074bc66f1133cb3af29 (diff)
Added python access to material and texture colorbands.
mat.colorbandDiffuse mat.colorbandSpecular tex.colorband gen_utils - removed unused func
Diffstat (limited to 'source/blender/python/api2_2x/Texture.c')
-rw-r--r--source/blender/python/api2_2x/Texture.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c
index c9cf3e406cf..67120b5f6c6 100644
--- a/source/blender/python/api2_2x/Texture.c
+++ b/source/blender/python/api2_2x/Texture.c
@@ -54,6 +54,7 @@
#include "gen_utils.h"
#include "vector.h" /* for Texture_evaluate(vec) */
+#include "Material.h" /* for EXPP_Colorband_fromPyList and EXPP_PyList_fromColorband */
#include "RE_shader_ext.h"
/*****************************************************************************/
@@ -201,9 +202,7 @@ static const EXPP_map_pair tex_type_map[] = {
static const EXPP_map_pair tex_flag_map[] = {
/* NOTE "CheckerOdd" and "CheckerEven" are new */
-#if 0
{"ColorBand", TEX_COLORBAND },
-#endif
{"FlipBlend", TEX_FLIPBLEND},
{"NegAlpha", TEX_NEGALPHA},
{"CheckerOdd",TEX_CHECKER_ODD},
@@ -491,8 +490,11 @@ static int Texture_setImageFlags( BPy_Texture *self, PyObject *args,
static int Texture_setNoiseBasis2( BPy_Texture *self, PyObject *args,
void *type );
+static PyObject *Texture_getColorband( BPy_Texture * self);
+int Texture_setColorband( BPy_Texture * self, PyObject * value);
static PyObject *Texture_evaluate( BPy_Texture *self, PyObject *args );
+
/*****************************************************************************/
/* Python BPy_Texture methods table: */
/*****************************************************************************/
@@ -754,6 +756,10 @@ static PyGetSetDef BPy_Texture_getseters[] = {
(getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
"Use of image RGB values for normal mapping enabled ('ImageFlags')",
(void *)TEX_NORMALMAP},
+ {"colorband",
+ (getter)Texture_getColorband, (setter)Texture_setColorband,
+ "Use of image RGB values for normal mapping enabled ('ImageFlags')",
+ (void *)TEX_NORMALMAP},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
@@ -1517,9 +1523,7 @@ static int Texture_setFlags( BPy_Texture * self, PyObject * value )
{
int param;
int bitmask = TEX_FLIPBLEND
-#if 0
| TEX_COLORBAND
-#endif
| TEX_NEGALPHA
| TEX_CHECKER_ODD
| TEX_CHECKER_EVEN;
@@ -2651,6 +2655,18 @@ static PyObject *Texture_oldsetImageFlags( BPy_Texture * self, PyObject * args )
Py_RETURN_NONE;
}
+static PyObject *Texture_getColorband( BPy_Texture * self)
+{
+ return EXPP_PyList_fromColorband( self->texture->coba );
+}
+
+int Texture_setColorband( BPy_Texture * self, PyObject * value)
+{
+ if (!self->texture->coba)
+ self->texture->coba = MEM_callocN( sizeof(ColorBand), "colorband");
+ return EXPP_Colorband_fromPyList( self->texture->coba, value );
+}
+
static PyObject *Texture_evaluate( BPy_Texture * self, PyObject * args )
{
VectorObject *vec_in = NULL;
@@ -2672,4 +2688,3 @@ static PyObject *Texture_evaluate( BPy_Texture * self, PyObject * args )
return newVectorObject(vec, 4, Py_NEW);
}
-