Fix T49608: runtime-only particle's boid->ground Object pointer was left dangling to invalid value in read code...

This commit is contained in:
Bastien Montagne 2016-10-08 15:18:35 +02:00
parent 74e0f900c5
commit 00dc0666b3
Notes: blender-bot 2023-02-14 07:31:32 +01:00
Referenced by commit c275870673, Ammend to rB00dc0666b3fe: forgot to fix boid->ground of first particle.
Referenced by issue #49608, ID remap: crash with boid particles, colliders and baked physics cache
1 changed files with 5 additions and 3 deletions

View File

@ -4277,12 +4277,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
psys->flag &= ~PSYS_KEYED;
}
if (psys->particles && psys->particles->boid) {
pa = psys->particles;
pa->boid = newdataadr(fd, pa->boid);
for (a=1, pa++; a<psys->totpart; a++, pa++)
pa->boid = (pa-1)->boid + 1;
for (a = 1, pa++; a < psys->totpart; a++, pa++) {
pa->boid = (pa - 1)->boid + 1;
pa->boid->ground = NULL; /* This is purely runtime data, but still can be an issue if left dangling. */
}
}
else if (psys->particles) {
for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)