From 5aab7f66a0bc5d7888c98fad3da697af8a623bff Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 4 Jan 2021 15:58:51 +0100 Subject: 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 --- source/blender/blenkernel/intern/pointcache.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 14e049384ef..8ee8821eeb6 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -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; -- cgit v1.2.3