I’m trying to write a script to output the value of an objects Euler rotation per frame. I tried a for loop, first changing the frame and then writing the rotation to the file. The output I get is just the same angle repeated. It is whatever keyframe is selected when the script is ran. If I start the script with another frame selected, I get that value repeated. The frames are being changed, but the value of the Euler rotation is not being iterated.
for fr_num in range(0, 60):
bpy.ops.anim.change_frame(frame=fr_num)
file.write(str(bpy.data.objects["Assy"].rotation_euler.y) + '
')
That is what I have been trying. Am I missing something?
Edit: I get the same result with a while loop.
import bpy
num=0
end=60
while num<end:
bpy.ops.anim.change_frame(frame=num)
print(bpy.data.objects["Cube"].rotation_euler)
num = num +1