[Bf-blender-cvs] [011c307] gooseberry_farm: Flush stdout prior of calling render stats callback

Sergey Sharybin noreply at git.blender.org
Wed Jun 17 16:33:58 CEST 2015


Commit: 011c30707d55d304ccfe87550c66b7905222323e
Author: Sergey Sharybin
Date:   Wed Jun 17 15:49:09 2015 +0200
Branches: gooseberry_farm
https://developer.blender.org/rB011c30707d55d304ccfe87550c66b7905222323e

Flush stdout prior of calling render stats callback

Without this extra flush order of stat prints is undefined in the
output. which makes it rather tricky to write custom output in a
reliable way.

===================================================================

M	source/blender/render/intern/source/pipeline.c

===================================================================

diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index eb831db..260300e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -182,6 +182,9 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
 			fprintf(stdout, IFACE_("Sce: %s Ve:%d Fa:%d La:%d"), rs->scene_name, rs->totvert, rs->totface, rs->totlamp);
 	}
 
+	/* Flush stdout to be sure python callbacks are printing stuff after blender. */
+	fflush(stdout);
+
 	BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS);
 
 	fputc('\n', stdout);
@@ -3408,7 +3411,10 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 	
 	BLI_timestr(re->i.lastframetime, name, sizeof(name));
 	printf(" Time: %s", name);
-	
+
+	/* Flush stdout to be sure python callbacks are printing stuff after blender. */
+	fflush(stdout);
+
 	BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS);
 
 	BLI_timestr(re->i.lastframetime - render_time, name, sizeof(name));




More information about the Bf-blender-cvs mailing list