Fix T47773: Particle System with Boids Crash.
Problem was, during initialization of boids particles in `dynamics_step()`, psys of target objects was not obtained with generic `psys_get_target_system()` as later in code, which could lead to some uninitialized `psys->tree` usage... Think it's safe enough for 2.77, though not a regression.
This commit is contained in:
parent
ed28134f71
commit
34fe03c7f2
Notes:
blender-bot
2023-02-14 08:06:36 +01:00
Referenced by issue #47783, Grease pencil sculpt stroke size not displayed in the viewport. Referenced by issue #47773, Particle System Crash
|
@ -310,6 +310,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
|
|||
ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
|
||||
|
||||
if (epsys) {
|
||||
BLI_assert(epsys->tree != NULL);
|
||||
neighbors = BLI_kdtree_range_search__normal(
|
||||
epsys->tree, pa->prev_state.co, pa->prev_state.ave,
|
||||
&ptn, acbr->look_ahead * len_v3(pa->prev_state.vel));
|
||||
|
|
|
@ -3510,8 +3510,10 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
|
|||
boids_precalc_rules(part, cfra);
|
||||
|
||||
for (; pt; pt=pt->next) {
|
||||
if (pt->ob)
|
||||
psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
|
||||
ParticleSystem *psys_target = psys_get_target_system(sim->ob, pt);
|
||||
if (psys_target && psys_target != psys) {
|
||||
psys_update_particle_tree(psys_target, cfra);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue