diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-11-08 14:19:53 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-11-08 14:19:53 +0300 |
commit | f15187cfcdfcc4f1210ce2b9ff7caba804411867 (patch) | |
tree | 915988f6d70c54a0e987f7445cc75009c9d6a98a | |
parent | d5a913378f1ed12f62abc9e0205e233ad66b2cf3 (diff) |
Fix for [#24597] Option External in Smoke cache affects settings of start and end frame of simulation
* Don't change anything in the pointcache unless a valid external cache is found.
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 20 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 35e0441739e..bceff487543 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2847,6 +2847,8 @@ void BKE_ptcache_load_external(PTCacheID *pid) PointCache *cache = pid->cache; int len; /* store the length of the string */ int info = 0; + int start = MAXFRAME; + int end = -1; /* mode is same as fopen's modes */ DIR *dir; @@ -2858,10 +2860,6 @@ void BKE_ptcache_load_external(PTCacheID *pid) if(!cache) return; - cache->startframe = MAXFRAME; - cache->endframe = -1; - cache->totpoint = 0; - ptcache_path(pid, path); len = BKE_ptcache_id_filename(pid, filename, 1, 0, 0); /* no path */ @@ -2887,8 +2885,8 @@ void BKE_ptcache_load_external(PTCacheID *pid) frame = atoi(num); if(frame) { - cache->startframe = MIN2(cache->startframe, frame); - cache->endframe = MAX2(cache->endframe, frame); + start = MIN2(start, frame); + end = MAX2(end, frame); } else info = 1; @@ -2898,9 +2896,13 @@ void BKE_ptcache_load_external(PTCacheID *pid) } closedir(dir); - if(cache->startframe != MAXFRAME) { + if(start != MAXFRAME) { PTCacheFile *pf; + cache->startframe = start; + cache->endframe = end; + cache->totpoint = 0; + /* read totpoint from info file (frame 0) */ if(info) { pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0); @@ -2931,10 +2933,10 @@ void BKE_ptcache_load_external(PTCacheID *pid) ptcache_file_close(pf); } } + cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID); + cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED); } - cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED); - BKE_ptcache_update_info(pid); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 3a8f66a3773..13a62c913d1 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -171,10 +171,8 @@ static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr) if(!pid) return; - cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID); - cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED); - BKE_ptcache_load_external(pid); + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } else { |