Vectors behaving slightly oddly.

This code is supposed to take all objects in a scene and export them as obj, centered in their own little file. The problem is moving them back afterwards-when I assign object location to a variable, then change the location, the variable also changes. Any ideas on how to get around that? Reopening the file without saving is not an option, because there are way too many objects in many of the scenes that this script has to work for that to be plausible.

def write_obj(apple, orange):
  #selects everything in a scene and puts them into a list
  q = bpy.context.selected_objects
  #for every object in a scene, select->move to center->export obj
  #-> move back->deselect current object
  for i in q[:]:
    bpy.ops.object.select_name(name=q[l].name, extend=False)
    move = q[l].location
    bpy.ops.transform.translate(value = move*-1)
    bpy.ops.export_scene.obj(filepath="C:/Temp/"+q[l].name+".obj",  check_existing=True, filter_glob="*.obj;*.mtl",  use_selection=True,  use_apply_modifiers=True,  use_rotate_x90=True,  use_edges=True,  use_normals=False,  use_hq_normals=True,  use_uvs=True,  use_materials=True,  use_triangles=False,  use_vertex_groups=False,  use_nurbs=False,  use_blen_objects=True,  group_by_object=False,  group_by_material=False,  keep_vertex_order=False,  path_mode="AUTO")
    bpy.ops.transform.translate(value = move)

Maybe you have to copy your location vector?

    move = q[l].location.copy()

That worked perfectly, thank you very much.

Graag gedaan :wink: