Skip to main content
7 of 15
added 288 characters in body
iKlsR
  • 43.7k
  • 12
  • 157
  • 190

There doesn't exist a way to do this in the options of the obj importer it seems so what you could do is run a script that loops over the items in your scene, check if it is as mesh and export the current selection to its own file relative to the path your blend file is saved.

import bpy

# get the path where the blend file is located
path = bpy.path.abspath('//')

# deselect all objects
bpy.ops.object.select_all(action='DESELECT')    

# loop through all the objects in the scene
scene = bpy.context.scene
for ob in scene.objects:
    # make the current object active and select it
    scene.objects.active = ob
    ob.select = True
    
    # make sure that we only export meshes
    if ob.type == 'MESH':
        # export the currently selected object to its own file based on its name
        bpy.ops.export_scene.obj(filepath=str(path + ob.name + '.obj'), use_selection=True)
    # deselect the object and move on to another if any more are left
    ob.select = False

To further tweak your export options, see the parameters that bpy.ops.export_scene_obj() accepts. For example, you can include normals with use_normals=True, change forward axis with axis_forward etc.

There are more stringent checks that could be made but for simple use cases and if used properly, this should suffice.

Also see How to batch import Wavefront OBJ files?.

To have it export only selected objects, remove line 7 and change line 11.

# remove
bpy.ops.object.select_all(action='DESELECT')
# change to this where instead of the entire scene, we only look through selected objects
for ob in bpy.context.selected_objects:

or keep line 11 and add an extra line that you can comment as needed

for ob in scene.objects:
    # add the check to selected objects here
    if ob in bpy.context.selected_objects:
        # adjust indentation
        ...
        ...
iKlsR
  • 43.7k
  • 12
  • 157
  • 190