Is There a Python API Equivalent to "Make Preview" for Batch Animation Previews with Custom Output Path?
-
I would like to create a script or tool that can quickly generate a preview of an animation sequence—similar to the built-in "Make Preview..." (Play > Make Preview...) function in Cinema 4D—but with the ability to specify a custom output path and automate the process fully (without user interaction).
What I have tried:
I have used the c4d.documents.RenderDocument() function in Python, which allows me to render the current document to a bitmap.
However, this approach only supports rendering one frame at a time. If I want to render a sequence, I need to manually loop through each frame, set the time, refresh the scene, and save each image. While this works, it is relatively slow and less convenient compared to the built-in Make Preview workflow.
My Question:
Is there an official Python API or function that directly exposes the "Make Preview" functionality? Specifically, is there a way to:
Automatically render a frame sequence as a preview (with preview quality/settings)
Specify the output path and filename format
Complete the operation programmatically without manual intervention or dialog windows
Or is the only method currently available to manually loop through frames using RenderDocument, as I am doing now?
Any tips, undocumented features, or future roadmap plans in this area would also be greatly appreciated!
Thank you very much for your attention and support. -
Hey @Amazing_iKe,
Thank you for reaching out to us. That
RenderDocument
does not support animations is only partially true. Effectively it does not for users, but that is more a regression than the lack of an actual feature. When you look into its documentation, you will see that many symbols and arguments are animation related. And when you send it a document which holds an animation, you are paying the price for rendering the full animation. The regressed state is however that you effectively only have access to the bitmap of the last frame of that animation. There is also the issue that the OCIO workflow with RenderDocument is a bit clunky at the moment. We have these issues in our backlog by I unfortunately cannot make any guarantees as to when we will fix them.You have two options:
- Render the document frame by frame yourself with
RenderDocument
and then assemble the animation yourself. - Use the BatchRender, i.e., what is shown to the user as the render queue. You can use this in a fully programmatic manner, but you are restricted to rendering documents that have been saved to disk, and the output will also be put to disk. I.e., you do not have the 'memory only'-aspect of
RenderDocument
. There are many topics about this subject on this forum, for example here where I showed how you abstract some of the disc-only limitations aways. Maxime also recently added some features to the batch render like switching cameras and takes, which makes it less likely that you have to modify the file.
I cannot write examples for all possible routes here. You have to decide yourself which route you want to go, and when you are then stuck there, I will help you. What to pick depends on your goals. When you expect the renderings to be quick, doing it manually with
RenderDocument
could be a solution. For more complex animations, the batch renderer is probably the better route.Cheers,
Ferdinand - Render the document frame by frame yourself with