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.
This commit is contained in:
parent
d5a913378f
commit
f15187cfcd
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user