I have a script that that changes objects in my scene and then creates and renders an animation of the object. It does this on a large batch of objects and makes the same four animations for each object. I typically run this from the command prompt with Blender running in background mode.
The problem I have run into is that I need the extrapolation type for these animations to be linear but I think by default is constant. I need a way of changing the extrapolation type from python while Blender is running the background.
I have tried the changing the extrapolation using:
old_area_type = context.area.type
context.area.type = 'GRAPH_EDITOR'
bpy.ops.graph.extrapolation_type(type='LINEAR')
bpy.ops.graph.handle_type(type='VECTOR')
context.area.type = old_area_type
However, this gives me an attribute error for context.area.type saying that it is set to 'NoneType'.
I looked closer at the documentation and area.type refers to subdivided screens within the editor. However, since my script is running in the background there are no area types to change to/from, thereby causing a NoneType error.
But, if I remove the area.type lines it gives me an incorrect context error for the extrapolation changes.
How can I change the extrapolation type from the background if I can't change the area type?