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-07-27 01:44:55 +0400
committerTon Roosendaal <ton@blender.org>2004-07-27 01:44:55 +0400
commit73f1da749b5e721005dec2dec27134074f7e7679 (patch)
tree1e7e44c3ff5ab4b45ec49f9a6eeb6c293000aa72 /source/blender/blenkernel
parent0437f23008e7b3932e4febff26abb81182811c86 (diff)
Nathan's huge ipo patch.
- now more than 31 channels possible for ipos - added lotsa new channels all over - Texture block has ipo now too - recoded getname_ei functions (Will ask nathan to give release log info when he's back!)
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/intern/ipo.c144
-rw-r--r--source/blender/blenkernel/intern/texture.c43
3 files changed, 186 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index dc1856a4803..23c31564a66 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -59,6 +59,7 @@ struct MTex *add_mtex(void);
struct Tex *copy_texture(struct Tex *tex);
void make_local_texture(struct Tex *tex);
void autotexname(struct Tex *tex);
+struct Tex *give_current_texture(struct Object *ob, int act);
#endif
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 581877cf42e..1f4ecf133d3 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -115,6 +115,20 @@ int ma_ar[MA_TOTIPO]= {
MA_MAP1+MAP_DVAR, MA_MAP1+MAP_COLF, MA_MAP1+MAP_NORF, MA_MAP1+MAP_VARF, MA_MAP1+MAP_DISP
};
+int te_ar[TE_TOTIPO] ={
+
+ TE_NSIZE, TE_NDEPTH, TE_NTYPE, TE_TURB,
+
+ TE_VNW1, TE_VNW2, TE_VNW3, TE_VNW4,
+ TE_VNMEXP, TE_VN_COLT, TE_VN_DISTM,
+
+ TE_ISCA, TE_DISTA,
+
+ TE_MG_TYP, TE_MGH, TE_MG_LAC, TE_MG_OCT, TE_MG_OFF, TE_MG_GAIN,
+
+ TE_N_BAS1, TE_N_BAS2
+};
+
int seq_ar[SEQ_TOTIPO]= {
SEQ_FAC1
};
@@ -860,6 +874,58 @@ float read_ipo_poin(void *poin, int type)
return val;
}
+void *give_tex_poin(Tex *tex, int adrcode, int *type )
+{
+ void *poin=0;
+
+ switch(adrcode) {
+ case TE_NSIZE:
+ poin= &(tex->noisesize); break;
+ case TE_TURB:
+ poin= &(tex->turbul); break;
+ case TE_NDEPTH:
+ poin= &(tex->noisedepth); *type= IPO_SHORT; break;
+ case TE_NTYPE:
+ poin= &(tex->noisetype); *type= IPO_SHORT; break;
+ case TE_VNW1:
+ poin= &(tex->vn_w1); break;
+ case TE_VNW2:
+ poin= &(tex->vn_w2); break;
+ case TE_VNW3:
+ poin= &(tex->vn_w3); break;
+ case TE_VNW4:
+ poin= &(tex->vn_w4); break;
+ case TE_VNMEXP:
+ poin= &(tex->vn_mexp); break;
+ case TE_ISCA:
+ poin= &(tex->ns_outscale); break;
+ case TE_DISTA:
+ poin= &(tex->dist_amount); break;
+ case TE_VN_COLT:
+ poin= &(tex->vn_coltype); *type= IPO_SHORT; break;
+ case TE_VN_DISTM:
+ poin= &(tex->vn_distm); *type= IPO_SHORT; break;
+ case TE_MG_TYP:
+ poin= &(tex->stype); *type= IPO_SHORT; break;
+ case TE_MGH:
+ poin= &(tex->mg_H); break;
+ case TE_MG_LAC:
+ poin= &(tex->mg_lacunarity); break;
+ case TE_MG_OCT:
+ poin= &(tex->mg_octaves); break;
+ case TE_MG_OFF:
+ poin= &(tex->mg_offset); break;
+ case TE_MG_GAIN:
+ poin= &(tex->mg_gain); break;
+ case TE_N_BAS1:
+ poin= &(tex->noisebasis); *type= IPO_SHORT; break;
+ case TE_N_BAS2:
+ poin= &(tex->noisebasis2); *type= IPO_SHORT; break;
+ }
+
+ return poin;
+}
+
void *give_mtex_poin(MTex *mtex, int adrcode )
{
void *poin=0;
@@ -917,6 +983,7 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
Object *ob;
Material *ma;
MTex *mtex;
+ Tex *tex;
Lamp *la;
Sequence *seq;
World *wo;
@@ -1107,6 +1174,11 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
}
}
}
+ else if( GS(id->name)==ID_TE) {
+ tex= (Tex *)id;
+
+ if(tex) poin= give_tex_poin(tex, icu->adrcode, type);
+ }
else if( GS(id->name)==ID_SEQ) {
seq= (Sequence *)id;
@@ -1334,6 +1406,63 @@ void set_icu_vars(IpoCurve *icu)
}
}
}
+ else if(icu->blocktype==ID_TE) {
+ switch(icu->adrcode & (MA_MAP1-1)) {
+ case TE_NSIZE:
+ icu->ymin= 0.0001;
+ icu->ymax= 2.0; break;
+ case TE_NDEPTH:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 6.0; break;
+ case TE_NTYPE:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 1.0; break;
+ case TE_TURB:
+ icu->ymax= 200.0; break;
+ case TE_VNW1:
+ case TE_VNW2:
+ case TE_VNW3:
+ case TE_VNW4:
+ icu->ymax= 2.0;
+ icu->ymin= -2.0; break;
+ case TE_VNMEXP:
+ icu->ymax= 10.0;
+ icu->ymin= 0.01; break;
+ case TE_VN_DISTM:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 6.0; break;
+ case TE_VN_COLT:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 3.0; break;
+ case TE_ISCA:
+ icu->ymax= 10.0;
+ icu->ymin= 0.01; break;
+ case TE_DISTA:
+ icu->ymax= 10.0; break;
+ case TE_MG_TYP:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 4.0; break;
+ case TE_MGH:
+ icu->ymin= 0.0001;
+ icu->ymax= 2.0; break;
+ case TE_MG_LAC:
+ case TE_MG_OFF:
+ case TE_MG_GAIN:
+ icu->ymax= 6.0; break;
+ case TE_MG_OCT:
+ icu->ymax= 8.0; break;
+ case TE_N_BAS1:
+ case TE_N_BAS2:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 8.0; break;
+ }
+ }
else if(icu->blocktype==ID_SEQ) {
icu->ymax= 1.0;
@@ -1489,6 +1618,7 @@ void do_ipo_nocalc(Ipo *ipo)
{
Object *ob;
Material *ma;
+ Tex *tex;
World *wo;
Lamp *la;
Camera *ca;
@@ -1514,6 +1644,13 @@ void do_ipo_nocalc(Ipo *ipo)
ma= ma->id.next;
}
break;
+ case ID_TE:
+ tex= G.main->tex.first;
+ while(tex) {
+ if(tex->ipo==ipo) execute_ipo((ID *)tex, ipo);
+ tex=tex->id.next;
+ }
+ break;
case ID_WO:
wo= G.main->world.first;
while(wo) {
@@ -1643,6 +1780,7 @@ void do_all_ipos()
{
Base *base;
Material *ma;
+ Tex *tex;
World *wo;
Ipo *ipo;
Lamp *la;
@@ -1684,6 +1822,12 @@ void do_all_ipos()
}
}
+ tex= G.main->tex.first;
+ while(tex) {
+ if(tex->ipo) execute_ipo((ID *)tex, tex->ipo);
+ tex= tex->id.next;
+ }
+
ma= G.main->mat.first;
while(ma) {
if(ma->ipo) execute_ipo((ID *)ma, ma->ipo);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 2507ca5c2b8..95168c4c016 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -76,6 +76,7 @@
#include "BKE_library.h"
#include "BKE_image.h"
+#include "BKE_material.h"
#include "BKE_texture.h"
#include "BKE_key.h"
#include "BKE_ipo.h"
@@ -600,5 +601,43 @@ void autotexname(Tex *tex)
/* ------------------------------------------------------------------------- */
-
-/* eof */
+Tex *give_current_texture(Object *ob, int act)
+{
+ Material ***matarar, *ma;
+ Lamp *la = 0;
+ MTex *mtex = 0;
+ Tex *tex = 0;
+
+ if(ob==0) return 0;
+ if(ob->totcol==0) return 0;
+
+ if(ob->type==OB_LAMP) {
+ la=(Lamp *)ob->data;
+ if(la) {
+ mtex= la->mtex[(int)(la->texact)];
+ if(mtex) tex= mtex->tex;
+ }
+ else tex= 0;
+ } else {
+ if(act>ob->totcol) act= ob->totcol;
+ else if(act==0) act= 1;
+
+ if( BTST(ob->colbits, act-1) ) { /* in object */
+ ma= ob->mat[act-1];
+ }
+ else { /* in data */
+ matarar= give_matarar(ob);
+
+ if(matarar && *matarar) ma= (*matarar)[act-1];
+ else ma= 0;
+
+ }
+ if(ma) {
+ mtex= ma->mtex[(int)(ma->texact)];
+ if(mtex) tex= mtex->tex;
+ }
+ else tex= 0;
+ }
+
+ return tex;
+}