import bpy import os # 🔧 Set your export folder path export_path = r"D:\Unity\little_sophia_app\Assets\robots\LittleSophia\meshes" # Make sure the folder exists if not os.path.exists(export_path): os.makedirs(export_path) # Loop through all mesh objects in the scene for obj in bpy.data.objects: if obj.type == 'MESH': # Store original location original_location = obj.location.copy() # Deselect everything bpy.ops.object.select_all(action='DESELECT') # Select the current object obj.select_set(True) bpy.context.view_layer.objects.active = obj # Move object to origin temporarily obj.location = (0.0, 0.0, 0.0) # Export the selected object as OBJ bpy.ops.wm.obj_export( filepath=os.path.join(export_path, f"{obj.name}.obj"), export_selected_objects=True, export_uv=True, # keep UVs if present export_normals=True, # keep normals export_materials=True # export materials ) # Restore original location obj.location = original_location print("✅ Export complete! All mesh objects saved with origin at (0,0,0).")