Skip to content

Instantly share code, notes, and snippets.

@harumaxy
Created August 3, 2024 10:38
Show Gist options
  • Select an option

  • Save harumaxy/da0efc598d66706e124e373da59e7adb to your computer and use it in GitHub Desktop.

Select an option

Save harumaxy/da0efc598d66706e124e373da59e7adb to your computer and use it in GitHub Desktop.
# export AnimSequence as .glb
import unreal
rootPath = '/Game/AdvancedLocomotionV4'
outputDir = '/Users/{user_name}/Downloads/ExportALS/' # This case is macOS
# remove preview mesh to reduce export size
exportOptions = unreal.GLTFExportOptions()
exportOptions.export_preview_mesh = False
selectedActors = set()
assetPaths = unreal.EditorAssetLibrary.list_assets(rootPath)
for assetPath in assetPaths:
anim = unreal.EditorAssetLibrary.load_asset(assetPath)
if unreal.MathLibrary.class_is_child_of(anim.get_class(), unreal.AnimSequence):
# export format is automaticaly determined by extension
exportPath = outputDir+anim.get_name()+'.glb'
unreal.GLTFExporter.export_to_gltf(
anim, exportPath, exportOptions, selectedActors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment