Revision: 35465
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35465
Author: jhk
Date: 2011-03-11 02:00:05 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
Better progress info for physics baking:
* Using the job system for physics baking is not yet in the near future, so
here's some good old console based progress info to all point cache based
physics baking.
* The info contains current total bake time, baking time for the current frame,
and a simple estimate of completion time.
* The info is only shown if the estimated total time for the bake is higher
than one minute, so quick bakes don't suffer any performance hits due to
console printing.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/pointcache.c
Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c 2011-03-11
01:24:16 UTC (rev 35464)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c 2011-03-11
02:00:05 UTC (rev 35465)
@@ -2517,16 +2517,57 @@
Scene *scene;
} ptcache_bake_data;
+static void ptcache_dt_to_str(char *str, double dtime)
+{
+ if(dtime > 60.0) {
+ if(dtime > 3600.0)
+ sprintf(str, "%ih %im %is", (int)(dtime/3600),
((int)(dtime/60))%60, ((int)dtime) % 60);
+ else
+ sprintf(str, "%im %is", ((int)(dtime/60))%60,
((int)dtime) % 60);
+ }
+ else
+ sprintf(str, "%is", ((int)dtime) % 60);
+}
+
static void *ptcache_bake_thread(void *ptr) {
+ int usetimer = 0, sfra, efra;
+ double stime, ptime, ctime, fetd;
+ char run[32], cur[32], etd[32];
+
ptcache_bake_data *data = (ptcache_bake_data*)ptr;
+ stime = ptime = PIL_check_seconds_timer();
+ sfra = *data->cfra_ptr;
+ efra = data->endframe;
+
for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation;
*data->cfra_ptr+=data->step) {
scene_update_for_newframe(data->main, data->scene,
data->scene->lay);
if(G.background) {
printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr,
data->endframe);
}
+ else {
+ ctime = PIL_check_seconds_timer();
+
+ fetd = (ctime-ptime)*(efra-*data->cfra_ptr)/data->step;
+
+ if(usetimer || fetd > 60.0) {
+ usetimer = 1;
+
+ ptcache_dt_to_str(cur, ctime-ptime);
+ ptcache_dt_to_str(run, ctime-stime);
+ ptcache_dt_to_str(etd, fetd);
+
+ printf("Baked for %s, current frame: %i/%i
(%.3fs), ETC: %s \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1,
(float)(ctime-ptime), etd);
+ }
+ ptime = ctime;
+ }
}
+ if(usetimer) {
+ ptcache_dt_to_str(run, PIL_check_seconds_timer()-stime);
+ printf("Bake %s %s (%i frames simulated).
\n", (data->break_operation ? "canceled after" : "finished in"), run,
*data->cfra_ptr-sfra);
+ }
+
data->thread_ended = TRUE;
return NULL;
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs