diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-04 22:08:07 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-04 22:08:07 +0300 |
commit | 56b0880d2f66ae77e34c7ac518758ea13792056f (patch) | |
tree | f8e51f73359721cdbbea0e59e00c8f3f9b0035e9 | |
parent | e9b7482b6a0b340a7045e55809cfe88500c04d1b (diff) |
Null check for baking progressend function
Simplify end of line for console progress.
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 4 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index cc7b942a6bb..7b2cf72e311 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2361,7 +2361,9 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) if(baker->break_test && baker->break_test(baker->break_data)) break; } - baker->progressend(baker->progresscontext); + + if (baker->progressend) + baker->progressend(baker->progresscontext); /* clear baking flag */ if(pid) { diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index a931e27bc83..858ff3637b1 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -84,11 +84,11 @@ void bake_console_progress(void *arg, int nr) { printf("\rbake: %3i%%", nr); fflush(stdout); +} - /* endline for last report */ - if (nr == 100) { - printf("\n"); - } +void bake_console_progress_end(void *arg, int nr) +{ + printf("\n"); } static int ptcache_bake_all_exec(bContext *C, wmOperator *op) @@ -113,7 +113,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) baker.progresscontext = win; } else { baker.progressbar = bake_console_progress; - baker.progressend = NULL; + baker.progressend = bake_console_progress_end; baker.progresscontext = NULL; } @@ -207,7 +207,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) } else { printf("\n"); /* empty first line before console reports */ baker.progressbar = bake_console_progress; - baker.progressend = NULL; + baker.progressend = bake_console_progress_end; baker.progresscontext = NULL; } |