Export Selected with Python or Blueprint?

I have a workflow where I click on a StaticMeshActor in the Outliner, and then go to File > Export Selected and export to an OBJ file.

How can I access this task from python or blueprints?

From python I’ve tried something like:

actors = list(editor.get_all_level_actors())

sm_objects = []
for actor in actors:
    if isinstance(actor, unreal.StaticMeshActor):
        sm_objects.append(actor)

exporter = unreal.StaticMeshExporterOBJ()

sm_object = sm_objects[0]

task = unreal.AssetExportTask()
task.automated = True
task.filename = 'blah.obj'
task.object = sm_object.static_mesh_component.static_mesh
task.options = exporter
task.prompt = True
task.replace_identical = True

exporter.run_asset_export_task(task)

but this does not appear to be calling the same task under the hood.

1 Like