Fix #68436: External Particle Disk Cache Playback Is Broken
This has been broken since 2.8. The highlevel reason for this is that the "info file" (saved as frame zero) was not written anymore. Reason for that in turn is that when calling `BKE_ptcache_write` outside the bake job, the `PTCacheID` `calldata` (a psys in our case) is not the evaluated particle system, causing a check for `totpoint` to fail (these were always zero). Deeper reasoning is unclear, no further investigations were done as to why/when this happened. The solution proposed here is using the evaluated psys when writing the info frame (and this is isolated to just this spot). File then gets written and can/will be read when using this as an external disk cache in another file. Pull Request: https://projects.blender.org/blender/blender/pulls/117291
This commit is contained in:
committed by
Philipp Oeser
parent
3b23105120
commit
ab9c0af1ce
@@ -62,6 +62,8 @@
|
||||
|
||||
#include "BLO_read_write.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "BIK_api.h"
|
||||
|
||||
#ifdef WITH_BULLET
|
||||
@@ -3349,6 +3351,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
|
||||
}
|
||||
|
||||
/* clear baking flag */
|
||||
PTCacheID pid_eval;
|
||||
if (pid && cache) {
|
||||
cache->flag &= ~(PTCACHE_BAKING | PTCACHE_REDO_NEEDED);
|
||||
cache->flag |= PTCACHE_SIMULATION_VALID;
|
||||
@@ -3356,7 +3359,13 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
|
||||
cache->flag |= PTCACHE_BAKED;
|
||||
/* write info file */
|
||||
if (cache->flag & PTCACHE_DISK_CACHE) {
|
||||
BKE_ptcache_write(pid, 0);
|
||||
ID *id = pid->owner_id;
|
||||
Object *ob = (GS(id->name) == ID_OB) ? reinterpret_cast<Object *>(id) : nullptr;
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
ParticleSystem *psys = static_cast<ParticleSystem *>(pid->calldata);
|
||||
ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
|
||||
BKE_ptcache_id_from_particles(&pid_eval, ob_eval, psys_eval);
|
||||
BKE_ptcache_write(&pid_eval, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3386,7 +3395,13 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
|
||||
if (bake) {
|
||||
cache->flag |= PTCACHE_BAKED;
|
||||
if (cache->flag & PTCACHE_DISK_CACHE) {
|
||||
BKE_ptcache_write(pid, 0);
|
||||
ID *id = pid->owner_id;
|
||||
Object *ob = (GS(id->name) == ID_OB) ? reinterpret_cast<Object *>(id) : nullptr;
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
ParticleSystem *psys = static_cast<ParticleSystem *>(pid->calldata);
|
||||
ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
|
||||
BKE_ptcache_id_from_particles(&pid_eval, ob_eval, psys_eval);
|
||||
BKE_ptcache_write(&pid_eval, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user