[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29607] trunk/blender/source/blender/ editors/space_time/space_time.c: hopefully fix some flickering in timeline cache display
Matt Ebb
matt at mke3.net
Tue Jun 22 11:12:22 CEST 2010
Revision: 29607
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29607
Author: broken
Date: 2010-06-22 11:12:22 +0200 (Tue, 22 Jun 2010)
Log Message:
-----------
hopefully fix some flickering in timeline cache display
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_time/space_time.c
Modified: trunk/blender/source/blender/editors/space_time/space_time.c
===================================================================
--- trunk/blender/source/blender/editors/space_time/space_time.c 2010-06-22 08:38:12 UTC (rev 29606)
+++ trunk/blender/source/blender/editors/space_time/space_time.c 2010-06-22 09:12:22 UTC (rev 29607)
@@ -169,8 +169,6 @@
Object *ob = CTX_data_active_object(C);
PTCacheID *pid;
ListBase pidlist;
- float *fp;
- int i;
time_cache_free(stime);
@@ -183,6 +181,8 @@
* add spacetimecache and vertex array for each */
for(pid=pidlist.first; pid; pid=pid->next) {
SpaceTimeCache *stc;
+ float *fp, *array;
+ int i, len;
switch(pid->type) {
case PTCACHE_TYPE_SOFTBODY:
@@ -211,11 +211,12 @@
/* first allocate with maximum number of frames needed */
BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, &stc->startframe, &stc->endframe, NULL);
- stc->len = (stc->endframe - stc->startframe + 1)*4;
- fp = stc->array = MEM_callocN(stc->len*2*sizeof(float), "SpaceTimeCache array");
-
+ len = (stc->endframe - stc->startframe + 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++) {
+
if (BKE_ptcache_id_exist(pid, i)) {
fp[0] = (float)i;
fp[1] = 0.0;
@@ -236,8 +237,12 @@
}
/* update with final number of frames */
stc->len = i*4;
- stc->array = MEM_reallocN(stc->array, stc->len*2*sizeof(float));
+ stc->array = MEM_mallocN(stc->len*2*sizeof(float), "SpaceTimeCache array");
+ memcpy(stc->array, array, stc->len*2*sizeof(float));
+ MEM_freeN(array);
+ array = NULL;
+
stc->ok = 1;
BLI_addtail(&stime->caches, stc);
More information about the Bf-blender-cvs
mailing list