diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-02-12 17:38:34 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-02-12 17:38:34 +0300 |
commit | fafbd9d71b95776d1c7583476de74fccefab7f10 (patch) | |
tree | 838e0fbc2e53c0700a87ebc1fdf4798837ffda3e /source/blender/blenloader | |
parent | c8c86aa6a12a253680aa266ce1c5d51b1b39005a (diff) |
Particles todo item: particle textures
* Effecting particle properties with textures was possible in 2.49,
but not in 2.5 anymore.
* Now particles have their own textures (available in texture panel
for objects with particle systems), which are totally separate from
the material textures.
* Currently a basic set of particle properties is available for
texture control. Some others could still be added, but the whole
system is not intended as an "change anything with a texture" as
this kind of functionality will be provided with node particles in
the future much better.
* Combined with the previously added "particle texture coordinates"
this new functionality also solves the problem of animating particle
properties through the particle lifetime nicely.
* Currently the textures only use the intensity of the texture in
"multiply" blending mode, so in order for the textures to effect
a particle parameter there has to be a non-zero value defined for
the parameter in the particle settings. Other blend modes can be
added later if they're considered useful enough.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6f22b1ad6f2..18fdff16acd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3017,6 +3017,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main) { ParticleSettings *part; ParticleDupliWeight *dw; + MTex *mtex; + int a; part= main->particle.first; while(part) { @@ -3062,6 +3064,15 @@ static void lib_link_particlesettings(FileData *fd, Main *main) } } } + + for(a=0; a<MAX_MTEX; a++) { + mtex= part->mtex[a]; + if(mtex) { + mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex); + mtex->object = newlibadr(fd, part->id.lib, mtex->object); + } + } + part->id.flag -= LIB_NEEDLINK; } part= part->id.next; @@ -3075,6 +3086,7 @@ static void direct_link_partdeflect(PartDeflect *pd) static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) { + int a; part->adt= newdataadr(fd, part->adt); part->pd= newdataadr(fd, part->pd); part->pd2= newdataadr(fd, part->pd2); @@ -3102,6 +3114,9 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) link_list(fd, &state->actions); } } + for(a=0; a<MAX_MTEX; a++) { + part->mtex[a]= newdataadr(fd, part->mtex[a]); + } } static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase *particles) @@ -6576,7 +6591,6 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) mtex->lifefac= (neg & MAP_PA_LIFE)? -varfac: varfac; mtex->sizefac= (neg & MAP_PA_SIZE)? -varfac: varfac; mtex->ivelfac= (neg & MAP_PA_IVEL)? -varfac: varfac; - mtex->pvelfac= (neg & MAP_PA_PVEL)? -varfac: varfac; mtex->shadowfac= (neg & LAMAP_SHAD)? -colfac: colfac; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c4623169aee..2b535945eff 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -823,6 +823,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) { ParticleSettings *part; ParticleDupliWeight *dw; + int a; part= idbase->first; while(part) { @@ -850,6 +851,10 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) if(part->fluid && part->phystype == PART_PHYS_FLUID){ writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid); } + + for(a=0; a<MAX_MTEX; a++) { + if(part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]); + } } part= part->id.next; } |