diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-12-16 19:09:23 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-12-16 19:09:23 +0300 |
commit | f7c60cab96146dbf7ebf0ddac9d55432afc5b37c (patch) | |
tree | f2dd2c3f668f0bec117e4f20204da1f1f931fade /source/blender/blenloader | |
parent | 0a7853478f74814a02254a18f4830089716dc07a (diff) |
Fix for [#25202] Blender crashes when opening smoke simulations made with Blender 2.55.1 r33530
* Since r33398 smoke only uses one pointcache, but old versions want two caches so save new files with a fake second pointcache.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 13b741e5661..34825af6c6a 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -143,6 +143,7 @@ Any case: direct data is ALWAYS after the lib block #include "BKE_utildefines.h" // for defines #include "BKE_modifier.h" #include "BKE_fcurve.h" +#include "BKE_pointcache.h" #include "BLO_writefile.h" #include "BLO_readfile.h" @@ -1176,19 +1177,32 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) if(smd->type & MOD_SMOKE_TYPE_DOMAIN) { + if(smd->domain) + { + write_pointcaches(wd, &(smd->domain->ptcaches[0])); + + /* create fake pointcache so that old blender versions can read it */ + smd->domain->point_cache[1] = BKE_ptcache_add(&smd->domain->ptcaches[1]); + smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE; + smd->domain->point_cache[1]->step = 1; + + write_pointcaches(wd, &(smd->domain->ptcaches[1])); + } + writestruct(wd, DATA, "SmokeDomainSettings", 1, smd->domain); - writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights); + + if(smd->domain) { + /* cleanup the fake pointcache */ + BKE_ptcache_free_list(&smd->domain->ptcaches[1]); + smd->domain->point_cache[1] = NULL; + + writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights); + } } else if(smd->type & MOD_SMOKE_TYPE_FLOW) writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow); else if(smd->type & MOD_SMOKE_TYPE_COLL) writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll); - - if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) - { - write_pointcaches(wd, &(smd->domain->ptcaches[0])); - write_pointcaches(wd, &(smd->domain->ptcaches[1])); - } } else if(md->type==eModifierType_Fluidsim) { FluidsimModifierData *fluidmd = (FluidsimModifierData*) md; |