Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2010-09-27 13:58:37 +0400
committerJanne Karhu <jhkarh@gmail.com>2010-09-27 13:58:37 +0400
commitafa4b855caa874d32d0cd0e02524846da58628c1 (patch)
treee9f7da1bb430aa309ddf32672802d559e1c3e578 /source/blender/editors/space_time/space_time.c
parent03c65a0c01cd463f87bc9ccafebb3e10a7db5527 (diff)
Fixed: Showing pointcached frames in the timeline was terribly slow when using disk cache.
* The existence of cached frames was checked each frame causing hundreds of disk operations per frame update. * Pointcache now keeps an updated array of the cached frames for fast "frame exists in cache" queries. * This fix also speeds up some other pointcache operations nicely.
Diffstat (limited to 'source/blender/editors/space_time/space_time.c')
-rw-r--r--source/blender/editors/space_time/space_time.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index de9c063f069..bbdd6891199 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -181,6 +181,7 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar)
SpaceTimeCache *stc;
float *fp, *array;
int i, len;
+ int sta, end;
switch(pid->type) {
case PTCACHE_TYPE_SOFTBODY:
@@ -197,6 +198,11 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar)
if (!(stime->cache_display & TIME_CACHE_SMOKE)) continue;
break;
}
+
+ BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, &sta, &end, NULL);
+
+ if(pid->cache->cached_frames==NULL)
+ continue;
stc= MEM_callocN(sizeof(SpaceTimeCache), "spacetimecache");
@@ -208,14 +214,15 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar)
stc->flag |= PTCACHE_DISK_CACHE;
/* first allocate with maximum number of frames needed */
- BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, &stc->startframe, &stc->endframe, NULL);
- len = (stc->endframe - stc->startframe + 1)*4;
+ stc->startframe = sta;
+ stc->endframe = end;
+ len = (end - sta + 1)*4;
fp = array = MEM_callocN(len*2*sizeof(float), "temporary timeline cache array");
/* fill the vertex array with a quad for each cached frame */
- for (i=stc->startframe; i<=stc->endframe; i++) {
+ for (i=sta; i<=end; i++) {
- if (BKE_ptcache_id_exist(pid, i)) {
+ if (pid->cache->cached_frames[i-sta]) {
fp[0] = (float)i;
fp[1] = 0.0;
fp+=2;