Fix for [#26873] Animated displacement modifier on an object doesn't work with hair particle objects
* Noise is now considered an animated texture as it changes with every frame * Converted a few places in particles code to use the particle system's own random table instead of BLI_frand.
This commit is contained in:
parent
b62a956cc8
commit
de7592b489
@ -937,6 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
|
||||
BoidValues val;
|
||||
BoidState *state = get_boid_state(boids, pa);
|
||||
BoidParticle *bpa = pa->boid;
|
||||
ParticleSystem *psys = bbd->sim->psys;
|
||||
int rand;
|
||||
//BoidCondition *cond;
|
||||
|
||||
@ -959,9 +960,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
|
||||
bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
|
||||
|
||||
/* create random seed for every particle & frame */
|
||||
BLI_srandom(bbd->sim->psys->seed + p);
|
||||
rand = BLI_rand();
|
||||
BLI_srandom((int)bbd->cfra + rand);
|
||||
rand = (int)(PSYS_FRAND(psys->seed + p) * 1000);
|
||||
rand = (int)(PSYS_FRAND((int)bbd->cfra + rand) * 1000);
|
||||
|
||||
set_boid_values(&val, bbd->part->boids, pa);
|
||||
|
||||
|
@ -2889,8 +2889,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
|
||||
if(psys_in_edit_mode(sim->scene, psys))
|
||||
if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
|
||||
return;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
keyed = psys->flag & PSYS_KEYED;
|
||||
baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR;
|
||||
|
@ -3514,8 +3514,6 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
|
||||
PARTICLE_P;
|
||||
float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
LOOP_PARTICLES {
|
||||
if(PSYS_FRAND(p) > disp)
|
||||
pa->flag |= PARS_NO_DISP;
|
||||
@ -3801,8 +3799,6 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
|
||||
PARTICLE_P;
|
||||
float disp, dietime;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
psys_update_effectors(sim);
|
||||
|
||||
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
@ -4054,7 +4050,6 @@ static void system_step(ParticleSimulationData *sim, float cfra)
|
||||
/* set particles to be not calculated TODO: can't work with pointcache */
|
||||
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
LOOP_PARTICLES {
|
||||
if(PSYS_FRAND(p) > disp)
|
||||
pa->flag |= PARS_NO_DISP;
|
||||
|
@ -1486,6 +1486,10 @@ int BKE_texture_dependsOnTime(const struct Tex *texture)
|
||||
// assume anything in adt means the texture is animated
|
||||
return 1;
|
||||
}
|
||||
else if(texture->type == TEX_NOISE) {
|
||||
// noise always varies with time
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1798,10 +1798,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
|
||||
pa_size = pa->size;
|
||||
|
||||
BLI_srandom(psys->seed+a);
|
||||
|
||||
r_tilt = 2.0f*(BLI_frand() - 0.5f);
|
||||
r_length = BLI_frand();
|
||||
r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f);
|
||||
r_length = PSYS_FRAND(a+1);
|
||||
|
||||
if(path_nbr) {
|
||||
cache = psys->pathcache[a];
|
||||
|
Loading…
Reference in New Issue
Block a user