Hi @NibblingFeet sorry for the late reply, as said everything you need is provided by RenderDocumen callbacks.
Find bellow a code that start the render and print something to the console for each frame rendered.
import c4d
def PythonWriteCallBack(mode, bmp, fn, mainImage, frame, renderTime, streamnum, streamname):
"""Function passed in RenderDocument.
It will be called automatically by Cinema 4D when the file rendered file should be saved.
Args:
mode (c4d.WRITEMODE): The write mode.
bmp (c4d.bitmaps.BaseBitmap): The bitmap written to.
fn (str): The path where the file should be saved.
mainImage (bool): True for main image, otherwise False.
frame (int): The frame number.
renderTime (int): The bitmap frame time.
streamnum (int): The stream number.
streamname (streamname: str): The stream name.
"""
if not fn:
return
if frame == -1:
frame = 0
print(f"ProgressWriteHook called [Frame: {frame} / Render Time: {renderTime}, Name: {fn}]")
def main():
rd = doc.GetActiveRenderData()
# Allocate a picture, that will receive the rendered picture.
# In case of animation this one will be cloned for each frame of the animation
# and this one will be used for the last frame. Therefor if you want to access the picture of each frame
# you should do it through the ##wprog callback passed to RenderDocument
bmp = c4d.bitmaps.MultipassBitmap(int(rd[c4d.RDATA_XRES]), int(rd[c4d.RDATA_YRES]), c4d.COLORMODE_RGB)
# Renders the document
if c4d.documents.RenderDocument(doc, rd.GetData(), bmp, c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_OPEN_PICTUREVIEWER | c4d.RENDERFLAGS_CREATE_PICTUREVIEWER,
wprog=PythonWriteCallBack) != c4d.RENDERRESULT_OK:
raise RuntimeError("Failed to render the temporary document.")
if __name__ == "__main__":
main()
Cheers,
Maxime.