I would like to write a simple script which loops through a specified number of animation frames with some delay (so I can watch the animation in slow motion without manually skipping frames, and get some data printed into the console for debugging purposes, for example: the euler rotation values of a rotating cube) and it works fine for around 30-40 frames but stops after some time.

What I tried:

    import bpy

    selected_object = bpy.data.objects["Cube"]

    for x in range(60,120): 
        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)

If I increase the sleep delay, the problem gets worse (for example: if the delay is .5, it stops redrawing frames after the fifth or sixth one, however in the console I can see adding new lines every .5 seconds) and can't find any solution for this. Maybe it's a bug? Is there any other solution for debugging animation values while watching the animation itself?


1 Answer 1


I'm working in a script that receive signals from arduino and change objects in 3d viewport.

I had the same issue with this command and after try so many times and with different ways I found that in my case, the iteration parameter was the key. I was working with for loop with 100 interactions and the iteration paramenter of 1. The screen stopped updating after a few interactions.

I put the value in 0.1 and the issue was gone. I didn't use the time.sleep() functions.

So...my working version is this.

for i in range(100):
    #do some stuff
    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=0.1)

You should try this


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .