Download

Automated sprite extraction/flipbook creation

Hey! I’m working on a project that uses a lot of Paper2D assets. I have a process for generating texture atlases in the format I need. Now I’m starting to check out the Python API for the first time to see if I can automate the Sprite and Flipbook creation.

So far, I’ve gotten texture import working:

task.unreal.AssetImportTask()
task.filename = ‘path_to_texture’
task.destination_path = ‘/Game/Textures’
task.automated = True
task.save = True
task.replace_existing = True

task.options = unreal.ReimportTextureFactory()
task.options.set_editor_property(‘lod_group’, unreal.TextureGroup.TEXTUREGROUP_UI)
task.options.set_editor_property(‘mip_gen_settings’, unreal.TextureMipGenSettings.NO_MIPMAPS)

tasks = [task, ]
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(tasks)
texture = tasks[0].imported_object_paths[0]

Next step would be getting this texture, doing the sprite extraction, and then creating the flipbooks.

I don’t see much info in the API on how to use the Paper2DEditor module. Am I even approaching this correctly?

Rob