------
New: Child particles are used as emitter. 

Based on the patch #30013 by Kai Kostack. Thank you!

Please do test this code!
This commit is contained in:
Daniel Genrich 2012-02-19 20:05:01 +00:00
parent 4504ac27a6
commit d8a70df8cc

@ -1008,6 +1008,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
{
ParticleSimulationData sim;
ParticleSystem *psys = sfs->psys;
int totpart=psys->totpart, totchild;
int p = 0;
float *density = smoke_get_density(sds->fluid);
float *bigdensity = smoke_turbulence_get_density(sds->wt);
@ -1043,7 +1044,23 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
// mostly copied from particle code
for(p=0; p<psys->totpart; p++)
if(psys->part->type==PART_HAIR)
{
/*
if(psys->childcache)
{
totchild = psys->totchildcache;
}
else
*/
// TODO: PART_HAIR not supported whatsoever
totchild=0;
}
else
totchild=psys->totchild*psys->part->disp/100;
for(p=0; p<totpart+totchild; p++)
{
int cell[3];
size_t i = 0;
@ -1051,11 +1068,21 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
int badcell = 0;
ParticleKey state;
if(p < totpart)
{
if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
continue;
}
else
{
/* handle child particle */
ChildParticle *cpa = &psys->child[p - totpart];
if(psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
continue;
}
state.time = smd->time;
if(psys_get_particle_state(&sim, p, &state, 0) == 0)
continue;