I am having trouble figuring out the correct context for bpy.ops.transform.translate. I am currently running a script that calls a create_bounding_box addon, which I figured out how to override the context for, but after it runs I can't perform a simple object translation.
Here is the relevant parts of the code:
bpy.ops.wm.open_mainfile(filename) for window in bpy.context.window_manager.windows: screen = window.screen for area in screen.areas: if area.type == 'VIEW_3D': override = bpy.context.copy() break bpy.ops.object.select_all(action='SELECT') bpy.ops.mesh.boundbox_add(override) bpy.ops.object.select_all(action='SELECT') bpy.ops.transform.translate(value=bpy.data.objects["BoundingBox"].location*-1)
boundbox_add is an addon, and the code is here https://github.com/sambler/addonsByMe/blob/master/create_bound_box.py
boundbox_add breaks if I don't either do the above (which I thought was overriding the context) or set bpy.context.scene.objects.active = bpy.context.scene.objects.
After running boundbox_add, I get poll() error for transform stating that the context is wrong.