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>2011-03-11 05:00:05 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-03-11 05:00:05 +0300
commitbc97f88576713ac76fbc238cbb439347dfcbddff (patch)
tree2335960e6875194e50a3a44b493519b5b3558bec /source/blender/blenkernel/intern/pointcache.c
parent9c032756e9243f7c62b6a2b0dd1e2c319e0affcd (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r--source/blender/blenkernel/intern/pointcache.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index c70a02ac457..618945b27bd 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2517,14 +2517,55 @@ typedef struct {
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;