import bpy # Set up a basic scene with a camera and light def setup_scene(): # Clear existing objects bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() # Add a camera bpy.ops.object.camera_add(location=(0, -5, 3)) camera = bpy.context.active_object camera.rotation_euler = (1.109, 0, 0) # Set the camera as active bpy.context.scene.camera = camera # Add a light source bpy.ops.object.light_add(type='POINT', location=(0, 0, 5)) # Add a cube to animate bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0)) cube = bpy.context.active_object cube.name = 'Cube' # Keyframe animation (for example, move the cube) cube.location = (0, 0, 0) cube.keyframe_insert(data_path="location", frame=1) cube.location = (5, 5, 0) cube.keyframe_insert(data_path="location", frame=50) # Set the frame range for the animation bpy.context.scene.frame_start = 1 bpy.context.scene.frame_end = 50 # Execute the setup function setup_scene()