[Bf-blender-cvs] [5aab7f66a0b] master: Fix T83876: blender crashes when baking particles + smoke sim

Jacques Lucke noreply at git.blender.org
Mon Jan 4 15:59:05 CET 2021


Commit: 5aab7f66a0bc5d7888c98fad3da697af8a623bff
Author: Jacques Lucke
Date:   Mon Jan 4 15:58:51 2021 +0100
Branches: master
https://developer.blender.org/rB5aab7f66a0bc5d7888c98fad3da697af8a623bff

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

===================================================================

M	source/blender/blenkernel/intern/pointcache.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list