diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-04 04:26:42 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-04 04:26:42 +0300 |
commit | 77aacc6ce437dbe526fe08e12a6f68a16d7e2c30 (patch) | |
tree | 6f3bd072d23e5099a0aa6e6e96015b75ed084074 | |
parent | b1a1a0f135f1f32551aea766c9faeb6f07875970 (diff) |
Print baking progress to console when window is not available.
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 784bc1ca30c..9973c38bb41 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -80,6 +80,17 @@ static int ptcache_poll(bContext *C) return (ptr.data && ptr.id.data); } +void bake_console_progress(void *arg, int nr) +{ + printf("\rbake: %3i%%", nr); + fflush(stdout); + + /* endline for last report */ + if (nr == 100) { + printf("\n"); + } +} + static int ptcache_bake_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -100,7 +111,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) baker.progressbar = (void (*)(void *, int))WM_timecursor; baker.progresscontext = win; } else { - baker.progressbar = NULL; + baker.progressbar = bake_console_progress; baker.progresscontext = NULL; } @@ -191,7 +202,8 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) baker.progressbar = (void (*)(void *, int))WM_timecursor; baker.progresscontext = win; } else { - baker.progressbar = NULL; + printf("\n"); /* empty first line before console reports */ + baker.progressbar = bake_console_progress; baker.progresscontext = NULL; } |