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.context.scene.frame_set(x)
print(selected_object.rotation_euler)
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
time.sleep(.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?