Null check for baking progressend function

Simplify end of line for console progress.
This commit is contained in:
Martin Poirier 2009-12-04 19:08:07 +00:00
parent e9b7482b6a
commit 56b0880d2f
2 changed files with 9 additions and 7 deletions

@ -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) {

@ -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;
}