Render event order

To execute some actions at different stages of rendering, the developers have provided a set of handlers in the Blender Python API – special functions for handling events.

We can get all available handlers by executing the following command:

The handlers that are directly related to the rendering process:

Each of these handlers is called at a certain moment, for example, the “on_render_init” handler is called when the render starts.

For the actions we need to be performed during the call to this handler, let’s define a function:

In our example, it just prints a text to the console, but we can fill our function with actions whatever we need.

Bind our function to the handler call:

Now, every time at the beginning of the render, the text will be printed to the system console.

Let’s define similar functions for each render event:

And link them with the corresponding handlers:

Now, when rendering, we will get the following output to the system console, for a two-frame animation:

As we can see, rendering events are handled in the following order:

  1. render_init – before rendering starts
  2. render_pre – before rendering of each frame
  3. render_post – after each frame has finished rendering
  4. render_write – after saving each frame
  5. render_complete – after all frames are rendered

The render_cancel event is fired when a render is canceled, for example, if the user presses the ESC button during a render.

0 0 votes
Article Rating
Notify of

1 Comment
Oldest Most Voted
Inline Feedbacks
View all comments
6 months ago

Excellent explanation and exactly what I needed right now!