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:
authorTon Roosendaal <ton@blender.org>2004-12-05 00:49:02 +0300
committerTon Roosendaal <ton@blender.org>2004-12-05 00:49:02 +0300
commitaad31875d7224c58b1d94bd716bb5aab295fc8cb (patch)
tree8ef506c415f32ce8c5c5116c9f725f4369468852 /source/blender
parent8d4782f7297c4a703b23b6b5383c0d76e4907903 (diff)
Special bf-committers request; Lamp/World/Material now each have 10
channels to link texture to. The amount of code changes seems large, but is mostly getting rind of hardcoded values (6 and 8) for channels, replacing it with MAX_MTEX. Further did some fixes; - Ipo for Lamp showed too many mapping channels - Texture MapTo buttons for lamp missed the slider to blend texture color - Lamp texture mapping "View" only worked for Spot, now it uses lamp- view vector for all types. (Nice for projections!)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/ipo.c8
-rw-r--r--source/blender/blenkernel/intern/material.c10
-rw-r--r--source/blender/blenkernel/intern/object.c8
-rw-r--r--source/blender/blenkernel/intern/texture.c12
-rw-r--r--source/blender/blenkernel/intern/world.c7
-rw-r--r--source/blender/blenloader/intern/readfile.c18
-rw-r--r--source/blender/blenloader/intern/writefile.c6
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h4
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h6
-rw-r--r--source/blender/makesdna/DNA_material_types.h6
-rw-r--r--source/blender/makesdna/DNA_world_types.h6
-rw-r--r--source/blender/python/api2_2x/Material.c16
-rw-r--r--source/blender/render/extern/include/render_types.h2
-rw-r--r--source/blender/render/intern/source/texture.c13
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c6
-rw-r--r--source/blender/src/buttons_shading.c30
-rw-r--r--source/blender/src/editipo.c4
-rw-r--r--source/blender/src/editobject.c24
-rw-r--r--source/blender/src/header_buttonswin.c8
-rw-r--r--source/blender/src/header_ipo.c9
-rw-r--r--source/blender/src/oops.c10
-rw-r--r--source/blender/src/outliner.c14
-rw-r--r--source/blender/src/previewrender.c4
23 files changed, 128 insertions, 103 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 9476cd1aab7..06197bc99c5 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -165,7 +165,7 @@ int la_ar[LA_TOTIPO]= {
MA_MAP1+MAP_OFS_X, MA_MAP1+MAP_OFS_Y, MA_MAP1+MAP_OFS_Z,
MA_MAP1+MAP_SIZE_X, MA_MAP1+MAP_SIZE_Y, MA_MAP1+MAP_SIZE_Z,
MA_MAP1+MAP_R, MA_MAP1+MAP_G, MA_MAP1+MAP_B,
- MA_MAP1+MAP_DVAR, MA_MAP1+MAP_COLF, MA_MAP1+MAP_NORF, MA_MAP1+MAP_VARF
+ MA_MAP1+MAP_DVAR, MA_MAP1+MAP_COLF
};
/* yafray: aperture & focal distance curves added */
@@ -1172,6 +1172,8 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
else if(icu->adrcode & MA_MAP6) mtex= ma->mtex[5];
else if(icu->adrcode & MA_MAP7) mtex= ma->mtex[6];
else if(icu->adrcode & MA_MAP8) mtex= ma->mtex[7];
+ else if(icu->adrcode & MA_MAP9) mtex= ma->mtex[8];
+ else if(icu->adrcode & MA_MAP10) mtex= ma->mtex[9];
if(mtex) {
poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
@@ -1254,6 +1256,8 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
else if(icu->adrcode & MA_MAP6) mtex= wo->mtex[5];
else if(icu->adrcode & MA_MAP7) mtex= wo->mtex[6];
else if(icu->adrcode & MA_MAP8) mtex= wo->mtex[7];
+ else if(icu->adrcode & MA_MAP9) mtex= wo->mtex[8];
+ else if(icu->adrcode & MA_MAP10) mtex= wo->mtex[9];
if(mtex) {
poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
@@ -1297,6 +1301,8 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
else if(icu->adrcode & MA_MAP6) mtex= la->mtex[5];
else if(icu->adrcode & MA_MAP7) mtex= la->mtex[6];
else if(icu->adrcode & MA_MAP8) mtex= la->mtex[7];
+ else if(icu->adrcode & MA_MAP9) mtex= la->mtex[8];
+ else if(icu->adrcode & MA_MAP10) mtex= la->mtex[9];
if(mtex) {
poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index be99b7b8d98..71e19c040c5 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -73,7 +73,7 @@ void free_material(Material *ma)
if(ma->ren) MEM_freeN(ma->ren);
ma->ren= NULL;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) mtex->tex->id.us--;
if(mtex) MEM_freeN(mtex);
@@ -143,7 +143,7 @@ Material *copy_material(Material *ma)
id_us_plus((ID *)man->ipo);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
@@ -177,7 +177,7 @@ void make_local_material(Material *ma)
ma->id.lib= 0;
ma->id.flag= LIB_LOCAL;
new_id(0, (ID *)ma, 0);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
}
@@ -241,7 +241,7 @@ void make_local_material(Material *ma)
ma->id.lib= 0;
ma->id.flag= LIB_LOCAL;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
}
@@ -554,7 +554,7 @@ void init_render_material(Material *ma)
ma= ma->ren;
ma->texco= 0;
ma->mapto= 0;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 0d2f216e24e..2dc8b67a540 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -287,7 +287,7 @@ void unlink_object(Object *ob)
mat= G.main->mat.first;
while(mat) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(mat->mtex[a] && ob==mat->mtex[a]->object) {
/* actually, test for lib here... to do */
mat->mtex[a]->object= 0;
@@ -316,7 +316,7 @@ void unlink_object(Object *ob)
wrld= G.main->world.first;
while(wrld) {
if(wrld->id.lib==0) {
- for(a=0; a<6; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && ob==wrld->mtex[a]->object)
wrld->mtex[a]->object =0;
}
@@ -519,7 +519,7 @@ Lamp *copy_lamp(Lamp *la)
lan= copy_libblock(la);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(lan->mtex[a]) {
lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
@@ -600,7 +600,7 @@ void free_lamp(Lamp *la)
BPY_free_scriptlink(&la->scriptlink);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= la->mtex[a];
if(mtex && mtex->tex) mtex->tex->id.us--;
if(mtex) MEM_freeN(mtex);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 95168c4c016..a0a7c178521 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -493,7 +493,7 @@ void make_local_texture(Tex *tex)
ma= G.main->mat.first;
while(ma) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
if(ma->id.lib) lib= 1;
else local= 1;
@@ -503,7 +503,7 @@ void make_local_texture(Tex *tex)
}
la= G.main->lamp.first;
while(la) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
if(la->id.lib) lib= 1;
else local= 1;
@@ -513,7 +513,7 @@ void make_local_texture(Tex *tex)
}
wrld= G.main->world.first;
while(wrld) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
if(wrld->id.lib) lib= 1;
else local= 1;
@@ -533,7 +533,7 @@ void make_local_texture(Tex *tex)
ma= G.main->mat.first;
while(ma) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
if(ma->id.lib==0) {
ma->mtex[a]->tex= texn;
@@ -546,7 +546,7 @@ void make_local_texture(Tex *tex)
}
la= G.main->lamp.first;
while(la) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
if(la->id.lib==0) {
la->mtex[a]->tex= texn;
@@ -559,7 +559,7 @@ void make_local_texture(Tex *tex)
}
wrld= G.main->world.first;
while(wrld) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
if(wrld->id.lib==0) {
wrld->mtex[a]->tex= texn;
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 2f5b440a33a..9676f08ee78 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -69,7 +69,7 @@ void free_world(World *wrld)
BPY_free_scriptlink(&wrld->scriptlink);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= wrld->mtex[a];
if(mtex && mtex->tex) mtex->tex->id.us--;
if(mtex) MEM_freeN(mtex);
@@ -110,7 +110,7 @@ World *copy_world(World *wrld)
wrldn= copy_libblock(wrld);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) {
wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
@@ -196,7 +196,8 @@ void init_render_world()
Normalise(R.grvec);
Mat3CpyMat4(R.imat, R.viewinv);
- for(a=0; a<6; a++) if(R.wrld.mtex[a] && R.wrld.mtex[a]->tex) R.wrld.skytype |= WO_SKYTEX;
+ for(a=0; a<MAX_MTEX; a++)
+ if(R.wrld.mtex[a] && R.wrld.mtex[a]->tex) R.wrld.skytype |= WO_SKYTEX;
if(G.scene->camera && G.scene->camera->type==OB_CAMERA) {
Camera *cam= G.scene->camera->data;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 18c70b0586b..3c87de94b5f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1542,7 +1542,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
while(la) {
if(la->id.flag & LIB_NEEDLINK) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= la->mtex[a];
if(mtex) {
mtex->tex= newlibadr_us(fd, la->id.lib, mtex->tex);
@@ -1566,7 +1566,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
direct_link_scriptlink(fd, &la->scriptlink);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
la->mtex[a]= newdataadr(fd, la->mtex[a]);
}
}
@@ -1691,7 +1691,7 @@ static void lib_link_world(FileData *fd, Main *main)
wrld->ipo= newlibadr_us(fd, wrld->id.lib, wrld->ipo);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= wrld->mtex[a];
if(mtex) {
mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex);
@@ -1713,7 +1713,7 @@ static void direct_link_world(FileData *fd, World *wrld)
direct_link_scriptlink(fd, &wrld->scriptlink);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]);
}
}
@@ -1985,7 +1985,7 @@ static void lib_link_material(FileData *fd, Main *main)
ma->ipo= newlibadr_us(fd, ma->id.lib, ma->ipo);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex) {
mtex->tex= newlibadr_us(fd, ma->id.lib, mtex->tex);
@@ -2005,7 +2005,7 @@ static void direct_link_material(FileData *fd, Material *ma)
direct_link_scriptlink(fd, &ma->scriptlink);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
}
@@ -4805,7 +4805,7 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
{
int a;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
expand_doit(fd, mainvar, ma->mtex[a]->tex);
expand_doit(fd, mainvar, ma->mtex[a]->object);
@@ -4818,7 +4818,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
{
int a;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) {
expand_doit(fd, mainvar, la->mtex[a]->tex);
expand_doit(fd, mainvar, la->mtex[a]->object);
@@ -4838,7 +4838,7 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
{
int a;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) {
expand_doit(fd, mainvar, wrld->mtex[a]->tex);
expand_doit(fd, mainvar, wrld->mtex[a]->object);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 4a2dfd4889b..a325749dede 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -960,7 +960,7 @@ static void write_materials(WriteData *wd, ListBase *idbase)
/* write LibData */
writestruct(wd, ID_MA, "Material", 1, ma);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
}
@@ -984,7 +984,7 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
/* write LibData */
writestruct(wd, ID_WO, "World", 1, wrld);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
}
@@ -1006,7 +1006,7 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
writestruct(wd, ID_LA, "Lamp", 1, la);
/* direct data */
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
}
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 8363fa0481a..206c531d77f 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -153,6 +153,8 @@ typedef short IPO_Channel;
#define MA_MAP6 0x400
#define MA_MAP7 0x800
#define MA_MAP8 0x1000
+#define MA_MAP9 0x2000
+#define MA_MAP10 0x4000
#define TEX_TOTNAM 14
@@ -252,7 +254,7 @@ typedef short IPO_Channel;
/* ******************** */
-#define LA_TOTIPO 23
+#define LA_TOTIPO 21
#define LA_TOTNAM 10
#define LA_ENERGY 1
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 4c8811e1d52..96aaf66f2eb 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -37,6 +37,10 @@
#include "DNA_ID.h"
#include "DNA_scriptlink_types.h"
+#ifndef MAX_MTEX
+#define MAX_MTEX 10
+#endif
+
struct MTex;
struct Ipo;
@@ -68,7 +72,7 @@ typedef struct Lamp {
short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
float YF_causticblur, YF_ltradius;
- struct MTex *mtex[8];
+ struct MTex *mtex[10];
struct Ipo *ipo;
ScriptLink scriptlink;
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index f2c41845320..28f3a7551c7 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -39,6 +39,10 @@
#include "DNA_ID.h"
#include "DNA_scriptlink_types.h"
+#ifndef MAX_MTEX
+#define MAX_MTEX 10
+#endif
+
struct MTex;
struct Ipo;
struct Material;
@@ -87,7 +91,7 @@ typedef struct Material {
short ramp_show, pad3;
float rampfac_col, rampfac_spec;
- struct MTex *mtex[8];
+ struct MTex *mtex[10];
struct Ipo *ipo;
struct Material *ren;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 30cb6071d78..8404beaf733 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -40,6 +40,10 @@
struct Ipo;
struct MTex;
+#ifndef MAX_MTEX
+#define MAX_MTEX 10
+#endif
+
/**
* World defines general modelling data such as a background fill,
@@ -101,7 +105,7 @@ typedef struct World {
int physicsEngine;
struct Ipo *ipo;
- struct MTex *mtex[8];
+ struct MTex *mtex[10];
ScriptLink scriptlink;
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 01e91cbb0b3..37c250b6c13 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -1146,11 +1146,11 @@ static PyObject *Material_getTextures( BPy_Material * self )
{
int i;
struct MTex *mtex;
- PyObject *t[8];
+ PyObject *t[MAX_MTEX];
PyObject *tuple;
/* build a texture list */
- for( i = 0; i < 8; ++i ) {
+ for( i = 0; i < MAX_MTEX; ++i ) {
mtex = self->material->mtex[i];
if( mtex ) {
@@ -1805,10 +1805,10 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
if( !PyArg_ParseTuple( args, "iO!|ii", &texnum, &Texture_Type, &pytex,
&texco, &mapto ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,7] and Texture" );
- if( ( texnum < 0 ) || ( texnum >= 8 ) )
+ "expected int in [0,9] and Texture" );
+ if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,7] and Texture" );
+ "expected int in [0,9] and Texture" );
bltex = Texture_FromPyObject( pytex );
@@ -1836,10 +1836,10 @@ static PyObject *Material_clearTexture( BPy_Material * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &texnum ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,7]" );
- if( ( texnum < 0 ) || ( texnum >= 8 ) )
+ "expected int in [0,9]" );
+ if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,7]" );
+ "expected int in [0,9]" );
mtex = self->material->mtex[texnum];
if( mtex ) {
diff --git a/source/blender/render/extern/include/render_types.h b/source/blender/render/extern/include/render_types.h
index 332171e4643..9f1fb9efef2 100644
--- a/source/blender/render/extern/include/render_types.h
+++ b/source/blender/render/extern/include/render_types.h
@@ -275,7 +275,7 @@ typedef struct LampRen
VlakRen *vlr_last;
struct LampRen *org;
- struct MTex *mtex[8];
+ struct MTex *mtex[MAX_MTEX];
} LampRen;
#endif /* RENDER_TYPES_H */
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index d08012cc3fd..6226cd9b418 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -1270,7 +1270,7 @@ void do_material_tex(ShadeInput *shi)
mat_col=mat_colspec=mat_colmir=mat_ref=mat_spec=mat_har=mat_emit=mat_alpha=mat_ray_mirr=mat_translu=mat_amb= shi->mat;
- for(tex_nr=0; tex_nr<8; tex_nr++) {
+ for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
/* separate tex switching */
if(shi->mat->septex & (1<<tex_nr)) continue;
@@ -1792,8 +1792,7 @@ void do_sky_tex(float *lo)
wrld_hor= wrld_zen= G.scene->world;
- /* The 6 here is the max amount of channels for a world */
- for(tex_nr=0; tex_nr<6; tex_nr++) {
+ for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
if(R.wrld.mtex[tex_nr]) {
mtex= R.wrld.mtex[tex_nr];
@@ -1960,7 +1959,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi)
tex_nr= 0;
- for(; tex_nr<6; tex_nr++) {
+ for(; tex_nr<MAX_MTEX; tex_nr++) {
if(la->mtex[tex_nr]) {
mtex= la->mtex[tex_nr];
@@ -2000,8 +1999,10 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi)
VECCOPY(tempvec, lavec);
MTC_Mat3MulVecfl(la->imat, tempvec);
- tempvec[0]*= la->spottexfac;
- tempvec[1]*= la->spottexfac;
+ if(la->type==LA_SPOT) {
+ tempvec[0]*= la->spottexfac;
+ tempvec[1]*= la->spottexfac;
+ }
co= tempvec;
dx= dxt; dy= dyt;
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 5727c967ff0..5acb9d280f9 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -1432,7 +1432,7 @@ static void init_render_mesh(Object *ob)
if(ma->alpha==0.0 && ma->spectra==0.0) {
ok= 0;
/* texture on transparency? */
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex) {
if(ma->mtex[a]->mapto & MAP_ALPHA) ok= 1;
}
@@ -1711,7 +1711,7 @@ void RE_add_render_lamp(Object *ob, int doshadbuf)
lar->spotsi= cos( M_PI*lar->spotsi/360.0 );
lar->spotbl= (1.0-lar->spotsi)*la->spotblend;
- memcpy(lar->mtex, la->mtex, 8*4);
+ memcpy(lar->mtex, la->mtex, MAX_MTEX*sizeof(void *));
lar->lay= ob->lay & 0xFFFFFF; // higher 8 bits are localview layers
@@ -1756,7 +1756,7 @@ void RE_add_render_lamp(Object *ob, int doshadbuf)
}
}
- for(c=0; c<6; c++) {
+ for(c=0; c<MAX_MTEX; c++) {
if(la->mtex[c] && la->mtex[c]->tex) {
lar->mode |= LA_TEXTURE;
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 98ceb0a8664..1e5ca8c6422 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -1393,11 +1393,11 @@ static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *l
/* CHANNELS */
uiBlockBeginAlign(block);
yco= 150;
- for(a= 0; a<8; a++) {
+ for(a= 0; a<MAX_MTEX; a++) {
if(ma) mt= ma->mtex[a];
- else if(wrld && a<6) mt= wrld->mtex[a];
- else if(la && a<6) mt= la->mtex[a];
+ else if(wrld) mt= wrld->mtex[a];
+ else if(la) mt= la->mtex[a];
if(mt && mt->tex) splitIDname(mt->tex->id.name+2, str, &loos);
else strcpy(str, "");
@@ -1407,11 +1407,11 @@ static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *l
uiDefButC(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(ma->texact), 0.0, (float)a, 0, 0, "Click to select texture channel");
yco-= 20;
}
- else if(wrld && a<6) {
+ else if(wrld) {
uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(wrld->texact), 0.0, (float)a, 0, 0, "");
yco-= 20;
}
- else if(la && a<6) {
+ else if(la) {
uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(la->texact), 0.0, (float)a, 0, 0, "");
yco-= 20;
}
@@ -1763,12 +1763,12 @@ static void world_panel_texture(World *wrld)
/* TEX CHANNELS */
uiBlockSetCol(block, TH_BUT_NEUTRAL);
uiBlockBeginAlign(block);
- for(a= 0; a<6; a++) {
+ for(a= 0; a<MAX_MTEX; a++) {
mtex= wrld->mtex[a];
if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
else strcpy(str, "");
str[10]= 0;
- uiDefButS(block, ROW, REDRAWBUTSSHADING, str,10, 160-20*a, 80, 20, &(wrld->texact), 3.0, (float)a, 0, 0, "Texture channel");
+ uiDefButS(block, ROW, REDRAWBUTSSHADING, str,10, 160-18*a, 80, 20, &(wrld->texact), 3.0, (float)a, 0, 0, "Texture channel");
}
uiBlockEndAlign(block);
@@ -2081,6 +2081,8 @@ static void lamp_panel_mapto(Object *ob, Lamp *la)
uiDefButS(block, MENU, B_MATPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode");
uiBlockEndAlign(block);
+ uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 155,100,155,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects colour values");
+
}
@@ -2100,12 +2102,12 @@ static void lamp_panel_texture(Object *ob, Lamp *la)
/* TEX CHANNELS */
uiBlockSetCol(block, TH_BUT_NEUTRAL);
uiBlockBeginAlign(block);
- for(a= 0; a<6; a++) {
+ for(a= 0; a<MAX_MTEX; a++) {
mtex= la->mtex[a];
if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
else strcpy(str, "");
str[10]= 0;
- uiDefButS(block, ROW, B_REDR, str, 10, 160-20*a, 80, 20, &(la->texact), 3.0, (float)a, 0, 0, "");
+ uiDefButS(block, ROW, B_REDR, str, 10, 160-18*a, 80, 20, &(la->texact), 3.0, (float)a, 0, 0, "");
}
uiBlockEndAlign(block);
@@ -2691,24 +2693,24 @@ static void material_panel_texture(Material *ma)
uiBlockSetCol(block, TH_BUT_NEUTRAL);
uiBlockBeginAlign(block);
- for(a= 0; a<8; a++) {
+ for(a= 0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
else strcpy(str, "");
str[10]= 0;
- uiDefButC(block, ROW, B_MATPRV_DRAW, str, 10, 180-20*a, 70, 20, &(ma->texact), 3.0, (float)a, 0, 0, "");
+ uiDefButC(block, ROW, B_MATPRV_DRAW, str, 10, 180-18*a, 70, 20, &(ma->texact), 3.0, (float)a, 0, 0, "");
}
uiBlockEndAlign(block);
/* SEPTEX */
uiBlockSetCol(block, TH_AUTO);
- for(a= 0; a<8; a++) {
+ for(a= 0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) {
if(ma->septex & (1<<a))
- uiDefButC(block, TOG|BIT|a, B_MATPRV_DRAW, " ", -20, 180-20*a, 28, 20, &ma->septex, 0.0, 0.0, 0, 0, "Click to disable or enable this texture channel");
- else uiDefIconButC(block, TOG|BIT|a, B_MATPRV_DRAW, ICON_CHECKBOX_HLT, -20, 180-20*a, 28, 20, &ma->septex, 0.0, 0.0, 0, 0, "Click to disable or enable this texture channel");
+ uiDefButC(block, TOG|BIT|a, B_MATPRV_DRAW, " ", -20, 180-18*a, 28, 20, &ma->septex, 0.0, 0.0, 0, 0, "Click to disable or enable this texture channel");
+ else uiDefIconButC(block, TOG|BIT|a, B_MATPRV_DRAW, ICON_CHECKBOX_HLT, -20, 180-18*a, 28, 20, &ma->septex, 0.0, 0.0, 0, 0, "Click to disable or enable this texture channel");
}
}
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 9d7d02f80db..fa327316642 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -814,6 +814,8 @@ int texchannel_to_adrcode(int channel)
case 5: return MA_MAP6;
case 6: return MA_MAP7;
case 7: return MA_MAP8;
+ case 8: return MA_MAP9;
+ case 9: return MA_MAP10;
default: return 0;
}
}
@@ -2040,7 +2042,7 @@ void add_vert_ipo()
ei= get_editipo();
if(ei==0) {
- error("Too many EditIpos");
+ error("Too many (or no) EditIpos");
return;
}
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 961a4f2515b..225e73a6b7d 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -6840,7 +6840,7 @@ void single_obdata_users(int flag)
case OB_LAMP:
if(id && id->us>1 && id->lib==0) {
ob->data= la= copy_lamp(ob->data);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) {
ID_NEW(la->mtex[a]->object);
}
@@ -6981,7 +6981,7 @@ void single_mat_users(int flag)
ma->ipo->id.us--;
}
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
tex= ma->mtex[b]->tex;
if(tex->id.us>1) {
@@ -7031,7 +7031,7 @@ void single_tex_users_expand()
ma= G.main->mat.first;
while(ma) {
if(ma->id.flag & LIB_NEW) {
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
do_single_tex_user( &(ma->mtex[b]->tex) );
}
@@ -7043,7 +7043,7 @@ void single_tex_users_expand()
la= G.main->lamp.first;
while(la) {
if(la->id.flag & LIB_NEW) {
- for(b=0; b<6; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(la->mtex[b] && la->mtex[b]->tex) {
do_single_tex_user( &(la->mtex[b]->tex) );
}
@@ -7054,7 +7054,7 @@ void single_tex_users_expand()
wo= G.main->world.first;
while(wo) {
if(wo->id.flag & LIB_NEW) {
- for(b=0; b<6; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(wo->mtex[b] && wo->mtex[b]->tex) {
do_single_tex_user( &(wo->mtex[b]->tex) );
}
@@ -7111,7 +7111,7 @@ void single_mat_users_expand(void)
ma= G.main->mat.first;
while(ma) {
if(ma->id.flag & LIB_NEW) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
ID_NEW(ma->mtex[a]->object);
}
@@ -7270,7 +7270,7 @@ void make_local(void)
if(ob->type==OB_LAMP) {
la= ob->data;
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(la->mtex[b] && la->mtex[b]->tex) {
make_local_texture(la->mtex[b]->tex);
}
@@ -7283,7 +7283,7 @@ void make_local(void)
if(ma) {
make_local_material(ma);
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
make_local_texture(ma->mtex[b]->tex);
}
@@ -7300,7 +7300,7 @@ void make_local(void)
if(ma) {
make_local_material(ma);
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
make_local_texture(ma->mtex[b]->tex);
}
@@ -7541,7 +7541,7 @@ void adduplicate(float *dtrans)
ma= (Material *)mao->id.newid;
if(dupflag & USER_DUP_TEX) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
id= (ID *)ma->mtex[a]->tex;
if(id) {
@@ -7653,7 +7653,7 @@ void selectlinks(int nr)
if(mat1==mat) base->flag |= SELECT;
}
else if(mat1 && nr==4) {
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(mat1->mtex[b]) {
if(tex==mat1->mtex[b]->tex) base->flag |= SELECT;
}
@@ -7695,7 +7695,7 @@ void image_aspect(void)
for(a=1; a<=ob->totcol; a++) {
ma= give_current_material(ob, a);
if(ma) {
- for(b=0; b<8; b++) {
+ for(b=0; b<MAX_MTEX; b++) {
if(ma->mtex[b] && ma->mtex[b]->tex) {
tex= ma->mtex[b]->tex;
if(tex->type==TEX_IMAGE && tex->ima && tex->ima->ibuf) {
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
index 1f53373c31a..d0375a0163e 100644
--- a/source/blender/src/header_buttonswin.c
+++ b/source/blender/src/header_buttonswin.c
@@ -99,7 +99,7 @@ void free_matcopybuf(void)
extern MTex mtexcopybuf; /* buttons.c */
int a;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(matcopybuf.mtex[a]) {
MEM_freeN(matcopybuf.mtex[a]);
matcopybuf.mtex[a]= NULL;
@@ -153,7 +153,7 @@ void do_buts_buttons(short event)
if(matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
if(matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= matcopybuf.mtex[a];
if(mtex) {
matcopybuf.mtex[a]= MEM_dupallocN(mtex);
@@ -168,7 +168,7 @@ void do_buts_buttons(short event)
/* free current mat */
if(ma->ramp_col) MEM_freeN(ma->ramp_col);
if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) mtex->tex->id.us--;
if(mtex) MEM_freeN(mtex);
@@ -181,7 +181,7 @@ void do_buts_buttons(short event)
if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
if(matcopybuf.ramp_spec) ma->ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
mtex= ma->mtex[a];
if(mtex) {
ma->mtex[a]= MEM_dupallocN(mtex);
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
index b2e5ca3df2c..0b9fa56281b 100644
--- a/source/blender/src/header_ipo.c
+++ b/source/blender/src/header_ipo.c
@@ -56,6 +56,7 @@
#include "DNA_ID.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
+#include "DNA_material_types.h"
#include "DNA_ipo_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -867,21 +868,21 @@ void ipo_buttons(void)
else if(G.sipo->blocktype == ID_TE)
icon = ICON_TEXTURE;
- uiDefIconTextButS(block, MENU, B_IPOMAIN, icon, ipo_modeselect_pup(), xco,0,100,20, &(G.sipo->blocktype), 0, 0, 0, 0, "Display IPO type");
+ uiDefIconTextButS(block, MENU, B_IPOMAIN, icon, ipo_modeselect_pup(), xco,0,100,20, &(G.sipo->blocktype), 0, 0, 0, 0, "Show IPO type");
xco += 85;
if(G.sipo->blocktype==ID_MA) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, 7.0, 0, 0, "Displays Channel Number of the active Material texture. Click to change.");
+ uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active Material texture.");
xco-= 4;
}
if(G.sipo->blocktype==ID_WO) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, 7.0, 0, 0, "Displays Channel Number of the active World texture. Click to change.");
+ uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active World texture.");
xco-= 4;
}
if(G.sipo->blocktype==ID_LA) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, 7.0, 0, 0, "Displays Channel Number of the active Lamp texture. Click to change.");
+ uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active Lamp texture. ");
xco-= 4;
}
diff --git a/source/blender/src/oops.c b/source/blender/src/oops.c
index 8b2bee49a9f..ec219e32163 100644
--- a/source/blender/src/oops.c
+++ b/source/blender/src/oops.c
@@ -647,12 +647,12 @@ void add_material_oopslinks(Material *ma, Oops *oops, short flag)
int a;
if(flag & OOPS_TE) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) add_oopslink("tex", oops, ID_TE, &(ma->mtex[a]->tex), (float)(0.5*OOPSX), (float)OOPSY);
}
}
if(flag & OOPS_OB) {
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) add_oopslink("ob", oops, ID_OB, &(ma->mtex[a]->object), 0.0, (float)(0.2*OOPSY));
}
}
@@ -755,7 +755,7 @@ void add_lamp_oopslinks(Lamp *la, Oops *oops, short flag)
int a;
if(flag & OOPS_TE) {
- for(a=0; a<6; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) {
add_oopslink("tex", oops, ID_TE, &(la->mtex[a]->tex), 0.0, (float)(0.5*OOPSY));
}
@@ -829,7 +829,7 @@ void add_texture_oops(Material *ma)
{
int a;
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
add_test_oops(ma->mtex[a]->tex);
if(ma->mtex[a]->tex) if(G.soops->visiflag & OOPS_IM) add_test_oops(ma->mtex[a]->tex->ima);
@@ -1047,7 +1047,7 @@ void build_oops()
oops= add_test_oops(ob->data);
if(G.soops->visiflag & OOPS_IP) add_test_oops(la->ipo);
if(G.soops->visiflag & OOPS_TE) {
- for(a=0; a<6; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) add_test_oops(la->mtex[a]->tex);
}
}
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index 7db1318d214..5181d253d6e 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -519,7 +519,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
Material *ma= (Material *)id;
outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0);
- for(a=0; a<8; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
}
}
@@ -542,7 +542,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
{
Lamp *la= (Lamp *)id;
outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0);
- for(a=0; a<6; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
}
}
@@ -551,7 +551,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
{
World *wrld= (World *)id;
outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0);
- for(a=0; a<6; a++) {
+ for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
}
}
@@ -1600,25 +1600,23 @@ static void unlink_material_cb(TreeElement *te, TreeStoreElem *tsep)
static void unlink_texture_cb(TreeElement *te, TreeStoreElem *tsep)
{
MTex **mtex= NULL;
- int tottex= 0;
int a;
if( GS(tsep->id->name)==ID_MA) {
Material *ma= (Material *)tsep->id;
mtex= ma->mtex;
- tottex= 8;
}
else if( GS(tsep->id->name)==ID_LA) {
Lamp *la= (Lamp *)tsep->id;
mtex= la->mtex;
- tottex= 6;
}
else if( GS(tsep->id->name)==ID_WO) {
World *wrld= (World *)tsep->id;
mtex= wrld->mtex;
- tottex= 6;
}
- for(a=0; a<tottex; a++) {
+ else return;
+
+ for(a=0; a<MAX_MTEX; a++) {
if(a==te->index && mtex[a]) {
if(mtex[a]->tex) {
mtex[a]->tex->id.us--;
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index 4db3f795910..b36483837d3 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -1076,7 +1076,7 @@ void BIF_previewrender(SpaceButs *sbuts)
init_render_material(mat);
/* clear imats */
- for(x=0; x<8; x++) {
+ for(x=0; x<MAX_MTEX; x++) {
if(mat->mtex[x]) {
if(mat->mtex[x]->tex) {
init_render_texture(mat->mtex[x]->tex);
@@ -1279,7 +1279,7 @@ void BIF_previewrender(SpaceButs *sbuts)
if(mat) {
end_render_material(mat);
- for(x=0; x<8; x++) {
+ for(x=0; x<MAX_MTEX; x++) {
if(mat->mtex[x] && mat->mtex[x]->tex) end_render_texture(mat->mtex[x]->tex);
}
}