I've been trying to generate a simple rotation animation entirely using a python script from command-line. The animation file gets generated with the configured frames and all, but the rotation applied to the cube object doesn't reflect in the animation. Could you please point out to me what I'm doing wrong?
My code involves sample.blend, which is a blender file with the default scene with cube, and renderAnim.py (code given below). I invoke this from the command-line as: blender -b sample.blend -P renderAnim.py
import bpy
scene = bpy.data.scenes["Scene"]
mycube = bpy.data.objects['Cube']
mycube.rotation_mode = 'XYZ'
scene.frame_start = 1
scene.frame_end = 100
scene.frame_current = 1
mycube.keyframe_insert('rotation_euler', index=0 ,frame=1)
scene.frame_current = 100
mycube.rotation_euler = (0,0,180)
mycube.keyframe_insert('rotation_euler', index=0 ,frame=100)
scene.render.use_stamp = 1
scene.render.stamp_background = (0,0,0,1)
scene.render.filepath = "render/anim"
scene.render.image_settings.file_format = "AVI_JPEG"
bpy.ops.render.render(animation=True)