fix: unbuffered stdout for live cinematic frame progress

Two fixes for frame progress not appearing in frontend:
1. Added flush=True to all print() calls in cinematic_render.py
2. Set PYTHONUNBUFFERED=1 in subprocess environment

Without these, Python buffers stdout inside Blender, so all frame
progress lines arrive in a batch after the process exits instead
of streaming line-by-line during rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 21:53:26 +01:00
parent e0714854d2
commit 75ad397c09
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -605,6 +605,7 @@ def render_cinematic_to_file(
env = dict(os.environ)
env["EGL_PLATFORM"] = "surfaceless"
env["PYTHONUNBUFFERED"] = "1" # Force unbuffered stdout for live frame progress
glb_arg = "" if use_usd else str(glb_path)
cmd = [
+2 -2
View File
@@ -849,10 +849,10 @@ def main():
bpy.ops.render.render(write_still=True)
elapsed = _time.time() - _render_start
fps_so_far = frame / elapsed
print(f"[cinematic_render] Frame {frame}/{frame_count} -- {elapsed:.1f}s elapsed ({fps_so_far:.2f} fps)")
print(f"[cinematic_render] Frame {frame}/{frame_count} -- {elapsed:.1f}s elapsed ({fps_so_far:.2f} fps)", flush=True)
total = _time.time() - _render_start
print(f"[cinematic_render] Cinematic render complete: {frame_count} frames in {total:.1f}s ({frame_count/total:.2f} fps avg)")
print(f"[cinematic_render] Cinematic render complete: {frame_count} frames in {total:.1f}s ({frame_count/total:.2f} fps avg)", flush=True)
if __name__ == "__main__":