Last active
August 17, 2020 10:13
-
-
Save CGLion/5b6d3ea5b3835a9549f79ef7be21491c to your computer and use it in GitHub Desktop.
Python for UE4 - import assets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import listdir | |
from os.path import isfile, join | |
import unreal | |
dir = "D:\\" | |
files = [f for f in listdir(dir) if isfile(join(dir, f)) and f[-3:]=='jpg'] | |
AssetTools = unreal.AssetToolsHelpers.get_asset_tools() | |
import_tasks = [] | |
for f in files: | |
print join(dir, f) | |
AssetImportTask = unreal.AssetImportTask() | |
AssetImportTask.set_editor_property('filename', join(dir, f)) | |
AssetImportTask.set_editor_property('destination_path', '/Game/Textures') | |
AssetImportTask.set_editor_property('save', True) | |
import_tasks.append(AssetImportTask) | |
AssetTools.import_asset_tasks(import_tasks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment