Fix T83876: blender crashes when baking particles + smoke sim

This was introduced in rBe5c0d4613a8943c712b57fb336997ecd78e6508e.

The issue is that the new fluid system does not use the pointcache
system for caching anymore, but still relies on pointcache for
other things. For example, it uses DEG_add_collision_relations
which internally creates relations with pointcache. Not sure if
there are other issues.

Ideally, this dependence should be resolved in one way or another
at some point, but that is out of scope for this fix.

Differential Revision: https://developer.blender.org/D9984

Reviewers: brecht
This commit is contained in:
Jacques Lucke 2021-01-04 15:58:51 +01:00
parent 09c1cb8a17
commit 5aab7f66a0

View file

@ -1006,7 +1006,8 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *cl
}
/* The fluid modifier does not actually use this anymore, but some parts of Blender expect that it
* still has a point cache currently. */
* still has a point cache currently. For example, the fluid modifier uses
* #DEG_add_collision_relations, which internally creates relations with the point cache. */
void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct FluidModifierData *fmd)
{
FluidDomainSettings *fds = fmd->domain;
@ -2549,6 +2550,12 @@ static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite)
int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
{
PointCache *cache = pid->cache;
if (!pid->totpoint) {
/* This happens when `pid->type == PTCACHE_TYPE_SMOKE_DOMAIN`. The fluid system does not
* actually use the pointcache anymore for caching. */
return 0;
}
int totpoint = pid->totpoint(pid->calldata, cfra);
int overwrite = 0, error = 0;