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!)
This commit is contained in:
2004-07-26 21:44:55 +00:00
parent 0437f23008
commit 73f1da749b
16 changed files with 1551 additions and 242 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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)
/* ------------------------------------------------------------------------- */
Tex *give_current_texture(Object *ob, int act)
{
Material ***matarar, *ma;
Lamp *la = 0;
MTex *mtex = 0;
Tex *tex = 0;
/* eof */
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;
}

View File

@@ -4473,6 +4473,7 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key)
static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
{
expand_doit(fd, mainvar, tex->ima);
expand_doit(fd, mainvar, tex->ipo);
}
static void expand_material(FileData *fd, Main *mainvar, Material *ma)

View File

@@ -43,20 +43,22 @@ struct ListBase;
struct Object;
struct IpoKey;
struct TransOb;
struct Tex;
void remake_object_ipos(struct Object *ob);
void getname_ac_ei(int nr, char *str);
void getname_co_ei(int nr, char *str);
void getname_ob_ei(int nr, char *str, int colipo);
void getname_tex_ei(int nr, char *str);
void getname_mat_ei(int nr, char *str);
void getname_world_ei(int nr, char *str);
void getname_seq_ei(int nr, char *str);
void getname_cu_ei(int nr, char *str);
void getname_key_ei(int nr, char *str);
void getname_la_ei(int nr, char *str);
void getname_cam_ei(int nr, char *str);
void getname_snd_ei(int nr, char *str);
char *getname_ac_ei(int nr);
char *getname_co_ei(int nr);
char *getname_ob_ei(int nr, int colipo);
char *getname_mtex_ei(int nr);
char *getname_tex_ei(int nr);
char *getname_mat_ei(int nr);
char *getname_world_ei(int nr);
char *getname_seq_ei(int nr);
char *getname_cu_ei(int nr);
char *getname_key_ei(int nr);
char *getname_la_ei(int nr);
char *getname_cam_ei(int nr);
char *getname_snd_ei(int nr);
struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
void boundbox_ipocurve(struct IpoCurve *icu);
void boundbox_ipo(struct Ipo *ipo, struct rctf *bb);
@@ -71,6 +73,7 @@ void make_key_editipo(struct SpaceIpo *si);
int texchannel_to_adrcode(int channel);
void make_mat_editipo(struct SpaceIpo *si);
void make_world_editipo(struct SpaceIpo *si);
void make_texture_editipo(struct SpaceIpo *si);
void make_lamp_editipo(struct SpaceIpo *si);
void make_camera_editipo(struct SpaceIpo *si);
int make_action_editipo(struct Ipo *ipo, struct EditIpo **si);

View File

@@ -69,6 +69,7 @@ typedef short IPO_Channel;
/* ******************** */
#define OB_TOTIPO 29
#define OB_TOTNAM 29
#define OB_LOC_X 1
#define OB_LOC_Y 2
@@ -115,6 +116,7 @@ typedef short IPO_Channel;
/* ******************** */
#define MA_TOTIPO 40
#define MA_TOTNAM 26
#define MA_COL_R 1
#define MA_COL_G 2
@@ -152,6 +154,8 @@ typedef short IPO_Channel;
#define MA_MAP7 0x800
#define MA_MAP8 0x1000
#define TEX_TOTNAM 14
#define MAP_OFS_X 1
#define MAP_OFS_Y 2
#define MAP_OFS_Z 3
@@ -170,19 +174,53 @@ typedef short IPO_Channel;
/* ******************** */
#define TE_TOTIPO 21
#define TE_TOTNAM 21
#define TE_NSIZE 1
#define TE_NDEPTH 2
#define TE_NTYPE 3
#define TE_TURB 4
#define TE_VNW1 5
#define TE_VNW2 6
#define TE_VNW3 7
#define TE_VNW4 8
#define TE_VNMEXP 9
#define TE_VN_DISTM 10
#define TE_VN_COLT 11
#define TE_ISCA 12
#define TE_DISTA 13
#define TE_MG_TYP 14
#define TE_MGH 15
#define TE_MG_LAC 16
#define TE_MG_OCT 17
#define TE_MG_OFF 18
#define TE_MG_GAIN 19
#define TE_N_BAS1 20
#define TE_N_BAS2 21
/* ******************** */
#define SEQ_TOTIPO 1
#define SEQ_TOTNAM 1
#define SEQ_FAC1 1
/* ******************** */
#define CU_TOTIPO 1
#define CU_TOTNAM 1
#define CU_SPEED 1
/* ******************** */
#define KEY_TOTIPO 32
#define KEY_TOTNAM 32
#define KEY_SPEED 0
#define KEY_NR 1
@@ -190,6 +228,7 @@ typedef short IPO_Channel;
/* ******************** */
#define WO_TOTIPO 29
#define WO_TOTNAM 16
#define WO_HOR_R 1
#define WO_HOR_G 2
@@ -214,6 +253,7 @@ typedef short IPO_Channel;
/* ******************** */
#define LA_TOTIPO 23
#define LA_TOTNAM 10
#define LA_ENERGY 1
#define LA_COL_R 2
@@ -229,6 +269,7 @@ typedef short IPO_Channel;
/* ******************** */
#define CAM_TOTIPO 3
#define CAM_TOTNAM 3
#define CAM_LENS 1
#define CAM_STA 2
@@ -238,6 +279,7 @@ typedef short IPO_Channel;
/* ******************** */
#define SND_TOTIPO 4
#define SND_TOTNAM 4
#define SND_VOLUME 1
#define SND_PITCH 2
@@ -247,6 +289,7 @@ typedef short IPO_Channel;
/* ******************** */
#define AC_TOTIPO 10 /* __NLA */
#define AC_TOTNAM 10
#define AC_LOC_X 1
#define AC_LOC_Y 2
@@ -263,6 +306,7 @@ typedef short IPO_Channel;
/* ******************** */
#define CO_TOTIPO 1 /* Constraint Ipos */
#define CO_TOTNAM 1
#define CO_ENFORCE 1
/*

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Jacques Guignot
* Contributor(s): Jacques Guignot, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -37,6 +37,7 @@
#include <BKE_library.h>
#include <BKE_ipo.h>
#include <BLI_blenlib.h>
#include <BSE_editipo.h>
#include "constant.h"
#include "gen_utils.h"
@@ -349,46 +350,35 @@ IpoCurve_Recalc (C_IpoCurve * self)
static PyObject *
IpoCurve_getName (C_IpoCurve * self)
{
const int objectType=self->ipocurve->blocktype;
const int trackType=self->ipocurve->adrcode;
const char * ob_nametab[24] = {"LocX","LocY","LocZ","dLocX","dLocY","dLocZ",
"RotX","RotY","RotZ","dRotX","dRotY","dRotZ","SizeX","SizeY","SizeZ",
"dSizeX","dSizeY","dSizeZ","Layer","Time","ColR","ColG","ColB","ColA"};
const char * ac_nametab[5] = {"QuatW", "QuatX", "QuatY", "QuatZ"};
switch (objectType) {
case ID_OB: {
if (self->ipocurve->adrcode <= 0 ) {
return PyString_FromString("Index too small");
} else if (self->ipocurve->adrcode >= 25 ) {
return PyString_FromString("Index too big");
} else {
return PyString_FromString(ob_nametab[trackType-1]);
}
}
break;
case ID_AC: {
switch (trackType) {
case 1: case 2: case 3: case 13: case 14: case 15:
return PyString_FromString(ob_nametab[trackType-1]);
break;
case 25: case 26: case 27: case 28:
return PyString_FromString(ac_nametab[trackType-25]);
break;
default:
return PyString_FromString("Index out of range");
}
}
break;
switch (self->ipocurve->blocktype) {
case ID_OB:
return PyString_FromString(getname_ob_ei(self->ipocurve->adrcode, 1)); /* solve: what if EffX/Y/Z are wanted? */
case ID_TE:
return PyString_FromString(getname_tex_ei(self->ipocurve->adrcode));
case ID_LA:
return PyString_FromString(getname_la_ei(self->ipocurve->adrcode));
case ID_MA:
return PyString_FromString(getname_mat_ei(self->ipocurve->adrcode));
case ID_CA:
return PyString_FromString(getname_cam_ei(self->ipocurve->adrcode));
case ID_WO:
return PyString_FromString(getname_world_ei(self->ipocurve->adrcode));
case ID_AC:
return PyString_FromString(getname_ac_ei(self->ipocurve->adrcode));
case ID_CU:
return PyString_FromString(getname_cu_ei(self->ipocurve->adrcode));
case ID_KE:
return PyString_FromString(getname_key_ei(self->ipocurve->adrcode));
case ID_SEQ:
return PyString_FromString(getname_seq_ei(self->ipocurve->adrcode));
case IPO_CO:
return PyString_FromString(getname_co_ei(self->ipocurve->adrcode));
default:
return EXPP_ReturnPyObjError (PyExc_TypeError,
"This function doesn't support this ipocurve type yet");
}
return PyString_FromString("");
}
static void

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Willian P. Germano
* Contributor(s): Willian P. Germano, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -167,6 +167,9 @@ static PyObject *Lamp_getHaloInt(BPy_Lamp *self);
static PyObject *Lamp_getQuad1(BPy_Lamp *self);
static PyObject *Lamp_getQuad2(BPy_Lamp *self);
static PyObject *Lamp_getCol(BPy_Lamp *self);
static PyObject *Lamp_getIpo(BPy_Lamp *self);
static PyObject *Lamp_clearIpo(BPy_Lamp *self);
static PyObject *Lamp_setIpo(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setName(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setType(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setIntType(BPy_Lamp *self, PyObject *args);
@@ -1370,3 +1373,76 @@ static PyObject *Lamp_repr (BPy_Lamp *self)
{
return PyString_FromFormat("[Lamp \"%s\"]", self->lamp->id.name+2);
}
static PyObject *
Lamp_getIpo (BPy_Lamp * self)
{
struct Ipo *ipo = self->lamp->ipo;
if (!ipo)
{
Py_INCREF (Py_None);
return Py_None;
}
return Ipo_CreatePyObject (ipo);
}
extern PyTypeObject Ipo_Type;
static PyObject *
Lamp_setIpo (BPy_Lamp * self, PyObject * args)
{
PyObject *pyipo = 0;
Ipo *ipo = NULL;
Ipo *oldipo;
if (!PyArg_ParseTuple (args, "O!", &Ipo_Type, &pyipo))
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected Ipo as argument");
ipo = Ipo_FromPyObject (pyipo);
if (!ipo)
return EXPP_ReturnPyObjError (PyExc_RuntimeError, "null ipo!");
if (ipo->blocktype != ID_TE)
return EXPP_ReturnPyObjError (PyExc_TypeError,
"this ipo is not a lamp data ipo");
oldipo = self->lamp->ipo;
if (oldipo)
{
ID *id = &oldipo->id;
if (id->us > 0)
id->us--;
}
((ID *) & ipo->id)->us++;
self->lamp->ipo = ipo;
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
Lamp_clearIpo (BPy_Lamp * self)
{
Lamp *lamp = self->lamp;
Ipo *ipo = (Ipo *) lamp->ipo;
if (ipo)
{
ID *id = &ipo->id;
if (id->us > 0)
id->us--;
lamp->ipo = NULL;
Py_INCREF (Py_True);
return Py_True;
}
Py_INCREF (Py_False); /* no ipo found */
return Py_False;
}

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Willian P. Germano
* Contributor(s): Willian P. Germano, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Alex Mole
* Contributor(s): Alex Mole, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -59,9 +59,12 @@
#define EXPP_TEX_TYPE_IMAGE TEX_IMAGE
#define EXPP_TEX_TYPE_PLUGIN TEX_PLUGIN
#define EXPP_TEX_TYPE_ENVMAP TEX_ENVMAP
#define EXPP_TEX_TYPE_MUSGRAVE TEX_MUSGRAVE
#define EXPP_TEX_TYPE_VORONOI TEX_VORONOI
#define EXPP_TEX_TYPE_DISTNOISE TEX_DISTNOISE
#define EXPP_TEX_TYPE_MIN EXPP_TEX_TYPE_NONE
#define EXPP_TEX_TYPE_MAX EXPP_TEX_TYPE_ENVMAP
#define EXPP_TEX_TYPE_MAX EXPP_TEX_TYPE_DISTNOISE
/* i can't find these defined anywhere- they're just taken from looking at */
/* the button creation code in source/blender/src/buttons_shading.c */
@@ -90,6 +93,12 @@
#define EXPP_TEX_STYPE_ENV_STATIC 0
#define EXPP_TEX_STYPE_ENV_ANIM 1
#define EXPP_TEX_STYPE_ENV_LOAD 2
/* musgrave stype */
#define EXPP_TEX_STYPE_MUS_MFRACTAL 0
#define EXPP_TEX_STYPE_MUS_RIDGEDMF 1
#define EXPP_TEX_STYPE_MUS_HYBRIDMF 2
#define EXPP_TEX_STYPE_MUS_FBM 3
#define EXPP_TEX_STYPE_MUS_HTERRAIN 4
#define EXPP_TEX_FLAG_COLORBAND TEX_COLORBAND
#define EXPP_TEX_FLAG_FLIPBLEND TEX_FLIPBLEND
@@ -150,6 +159,9 @@ static const EXPP_map_pair tex_type_map[] = {
{ "Image", EXPP_TEX_TYPE_IMAGE },
{ "Plugin", EXPP_TEX_TYPE_PLUGIN },
{ "EnvMap", EXPP_TEX_TYPE_ENVMAP },
{ "Musgrave", EXPP_TEX_TYPE_MUSGRAVE },
{ "Voronoi", EXPP_TEX_TYPE_VORONOI },
{ "DistortedNoise", EXPP_TEX_TYPE_DISTNOISE },
{ NULL, 0 }
};
@@ -234,6 +246,16 @@ static const EXPP_map_pair tex_stype_envmap_map[] = {
{ NULL , 0 }
};
static const EXPP_map_pair tex_stype_musg_map[] = {
{ "Default", 0},
{ "MultiFractal", EXPP_TEX_STYPE_MUS_MFRACTAL },
{ "HeteroTerrain", EXPP_TEX_STYPE_MUS_HTERRAIN },
{ "RidgedMultiFractal", EXPP_TEX_STYPE_MUS_RIDGEDMF },
{ "HybridMultiFractal", EXPP_TEX_STYPE_MUS_HYBRIDMF },
{ "fBM", EXPP_TEX_STYPE_MUS_FBM },
{ NULL , 0 }
};
static const EXPP_map_pair *tex_stype_map[] = {
tex_stype_default_map, /* none */
tex_stype_clouds_map,
@@ -245,7 +267,8 @@ static const EXPP_map_pair *tex_stype_map[] = {
tex_stype_default_map, /* noise */
tex_stype_default_map, /* image */
tex_stype_default_map, /* plugin */
tex_stype_envmap_map
tex_stype_envmap_map,
tex_stype_musg_map /* musgrave */
};
@@ -298,6 +321,9 @@ GETFUNC (getImage);
GETFUNC (getName);
GETFUNC (getType);
GETFUNC (getSType);
GETFUNC (getIpo);
GETFUNC (clearIpo);
SETFUNC (setIpo);
SETFUNC (setAnimFrames);
SETFUNC (setAnimLength);
SETFUNC (setAnimMontage);
@@ -342,6 +368,12 @@ static PyMethodDef BPy_Texture_methods[] = {
"() - Return Texture stype as string"},
{"getType", (PyCFunction)Texture_getType, METH_NOARGS,
"() - Return Texture type as string"},
{"getIpo", (PyCFunction)Texture_getIpo, METH_NOARGS,
"() - Return Texture Ipo"},
{"setIpo", (PyCFunction)Texture_setIpo, METH_VARARGS,
"(Blender Ipo) - Set Texture Ipo"},
{"clearIpo", (PyCFunction) Texture_clearIpo, METH_NOARGS,
"() - Unlink Ipo from this Texture."},
{"setExtend", (PyCFunction)Texture_setExtend, METH_VARARGS,
"(s) - Set Texture extend mode"},
{"setFlags", (PyCFunction)Texture_setFlags, METH_VARARGS,
@@ -508,6 +540,9 @@ static PyObject *M_Texture_TypesDict (void)
EXPP_ADDCONST (IMAGE);
EXPP_ADDCONST (PLUGIN);
EXPP_ADDCONST (ENVMAP);
EXPP_ADDCONST (MUSGRAVE);
EXPP_ADDCONST (VORONOI);
EXPP_ADDCONST (DISTNOISE);
}
return Types;
}
@@ -547,6 +582,11 @@ static PyObject *M_Texture_STypesDict (void)
EXPP_ADDCONST(ENV_STATIC);
EXPP_ADDCONST(ENV_ANIM);
EXPP_ADDCONST(ENV_LOAD);
EXPP_ADDCONST(MUS_MFRACTAL);
EXPP_ADDCONST(MUS_RIDGEDMF);
EXPP_ADDCONST(MUS_HYBRIDMF);
EXPP_ADDCONST(MUS_FBM);
EXPP_ADDCONST(MUS_HTERRAIN);
}
return STypes;
}
@@ -1511,3 +1551,76 @@ static PyObject *Texture_repr (BPy_Texture *self)
return PyString_FromFormat("[Texture \"%s\"]", self->texture->id.name+2);
}
static PyObject *
Texture_getIpo (BPy_Texture * self)
{
struct Ipo *ipo = self->texture->ipo;
if (!ipo)
{
Py_INCREF (Py_None);
return Py_None;
}
return Ipo_CreatePyObject (ipo);
}
extern PyTypeObject Ipo_Type;
static PyObject *
Texture_setIpo (BPy_Texture * self, PyObject * args)
{
PyObject *pyipo = 0;
Ipo *ipo = NULL;
Ipo *oldipo;
if (!PyArg_ParseTuple (args, "O!", &Ipo_Type, &pyipo))
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected Ipo as argument");
ipo = Ipo_FromPyObject (pyipo);
if (!ipo)
return EXPP_ReturnPyObjError (PyExc_RuntimeError, "null ipo!");
if (ipo->blocktype != ID_TE)
return EXPP_ReturnPyObjError (PyExc_TypeError,
"this ipo is not a texture data ipo");
oldipo = self->texture->ipo;
if (oldipo)
{
ID *id = &oldipo->id;
if (id->us > 0)
id->us--;
}
((ID *) & ipo->id)->us++;
self->texture->ipo = ipo;
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
Texture_clearIpo (BPy_Texture * self)
{
Tex *tex = self->texture;
Ipo *ipo = (Ipo *) tex->ipo;
if (ipo)
{
ID *id = &ipo->id;
if (id->us > 0)
id->us--;
tex->ipo = NULL;
Py_INCREF (Py_True);
return Py_True;
}
Py_INCREF (Py_False); /* no ipo found */
return Py_False;
}

View File

@@ -26,7 +26,8 @@ def New (type, name):
@type type: string
@type name: string
@param type: The Ipo's blocktype. Depends on the object the ipo will be
linked to. Currently supported types are Object, Camera, World, Material.
linked to. Currently supported types are Object, Camera, World,
Material, Texture, Lamp, Curve, Key.
@param name: The name for this Ipo.
@rtype: Blender Ipo
@return: The created Ipo.
@@ -71,14 +72,26 @@ class Ipo:
'curvename' are:
1. Camera Ipo: Lens, ClSta, ClEnd.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ang, Mode, HaSize, OfsX, OfsY,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ang, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var;
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA;
4. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFOff, Damping,
RDamp, Perm;
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaIntl;
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var;
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGan, NBase1, NBase2;
7. Curve Ipo: Speed;
8. Key Ipo: Speed, 'Key 1' - 'Key 31';
9. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ,
QuatX, QuatY, QuatZ, QuatW;
10.Sequence Ipo: Fac;
11.Constraint Ipo: Inf.
@type curvename : string
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@@ -89,7 +102,21 @@ class Ipo:
Add a new curve to the IPO object. The possible values for 'curvename' are:
1. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA.
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFOff, Damping, RDamp,
Perm;
2. Camera Ipo: Lens, ClSta, ClEnd;
3. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaIntl
4. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGan, NBase1, NBase2;
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var;
6. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow;
7. Curve Ipo: Speed;
8. Key Ipo: Speed, 'Key 1' - 'Key 31'
@type curvename : string
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@@ -265,10 +292,28 @@ class IpoCurve:
def getName():
"""
Returns the name of the ipo curve. This name can be:
1. LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
1. Camera Ipo: Lens, ClSta, ClEnd.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ang, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var;
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA, QuatX, QuatY, QuatZ or QuatW.
@warn: currently this only works with object and action IPO's..
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFOff, Damping,
RDamp, Perm;
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaIntl;
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var;
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGan, NBase1, NBase2;
7. Curve Ipo: Speed;
8. Key Ipo: Speed, 'Key 1' - 'Key 31';
9. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ,
QuatX, QuatY, QuatZ, QuatW;
10.Sequence Ipo: Fac;
11.Constraint Ipo: Inf.
@rtype: string
@return: the name of the ipo curve.
"""

View File

@@ -348,3 +348,23 @@ class Lamp:
@type event: string
@param event: "FrameChanged" or "Redraw".
"""
def getIpo():
"""
Get the Ipo associated with this Lamp object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def setIpo(ipo):
"""
Link an ipo to this Lamp object.
@type ipo: Blender Ipo
@param ipo: a "lamp data" ipo.
"""
def clearIpo():
"""
Unlink the ipo from this Lamp object.
@return: True if there was an ipo linked or False otherwise.
"""

View File

@@ -302,3 +302,22 @@ class MTex:
@cvar mapto: "Map to" field of texture. OR'd values of L{MapTo}
"""
def getIpo():
"""
Get the Ipo associated with this texture object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def setIpo(ipo):
"""
Link an ipo to this texture object.
@type ipo: Blender Ipo
@param ipo: a "texture data" ipo.
"""
def clearIpo():
"""
Unlink the ipo from this texture object.
@return: True if there was an ipo linked or False otherwise.
"""

View File

@@ -145,7 +145,6 @@ class World:
@return: the skytype of the world object.
"""
def setSkytype(skytype):
"""
Sets the skytype of a world object.
@@ -164,7 +163,6 @@ class World:
@return: the mode of the world object.
"""
def setMode(mode):
"""
Sets the mode of a world object.
@@ -183,7 +181,6 @@ class World:
@return: the mistype of the world object.
"""
def setMistype(mistype):
"""
Sets the mist type of a world object.
@@ -202,7 +199,6 @@ class World:
@return: the horizon color of the world object.
"""
def setHor(hor):
"""
Sets the horizon color of a world object.
@@ -220,7 +216,6 @@ class World:
@return: the zenith color of the world object.
"""
def setZen(zen):
"""
Sets the zenith color of a world object.
@@ -238,7 +233,6 @@ class World:
@return: the ambient color of the world object.
"""
def setAmb(amb):
"""
Sets the ambient color of a world object.
@@ -263,7 +257,6 @@ class World:
@return: the star parameters
"""
def setStar(star):
"""
Sets the star parameters of a world object.
@@ -286,7 +279,6 @@ class World:
@return: the mist parameters
"""
def setMist(mist):
"""
Sets the mist parameters of a world object.

View File

@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
* Contributor(s): Michel Selten, Willian P. Germano
* Contributor(s): Michel Selten, Willian P. Germano, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -46,9 +46,13 @@
#include <DNA_effect_types.h>
#include <DNA_meta_types.h>
#include <DNA_image_types.h>
#include <DNA_texture_types.h>
#include <DNA_text_types.h>
#include <DNA_world_types.h>
#include <DNA_key_types.h>
#include <DNA_sequence_types.h>
#include <DNA_action_types.h>
#include <DNA_constraint_types.h>
/*****************************************************************************/
/* Global variables */