该问题可以通过以下步骤解决:
import bpy
# 获取当前选中的物体
obj = bpy.context.object
# 获取材质索引对应的动画曲线对象
fcurve = obj.animation_data.action.fcurves.find('material_index', index=0)
# 修改动画曲线对象的插值模式
fcurve.interpolation = 'LINEAR'
# 将修改后的动画曲线对象重新写入到动画数据中
obj.animation_data.action.fcurves[0] = fcurve
以上代码将物体的材质索引对应的动画曲线对象插值模式修改为线性插值模式。