Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def import_assets():
- files = glob.glob(fbx_base_path+"*fbx")
- mesh_import_tasks = []
- for file in files:
- mesh_import_tasks.append(build_mesh_import_task(file, '/Game/Meshes'))
- unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(mesh_import_tasks)
- def build_mesh_import_task(filename, destination_path, destination_name=''):
- # the task, and the additional fbx options, since it is a mesh
- task = unreal.AssetImportTask()
- fbx_options = unreal.FbxImportUI()
- # basic task properties
- task.set_editor_property('automated', True)
- task.set_editor_property('filename', filename)
- task.set_editor_property('destination_path', destination_path)
- # if destination_name is '' it will use the on-disk filename
- task.set_editor_property('destination_name', destination_name)
- task.set_editor_property('replace_existing', True)
- task.set_editor_property('save', True)
- task.set_editor_property('options', fbx_options)
- # additional options specifically for meshes
- fbx_options.set_editor_property('import_mesh', True)
- fbx_options.set_editor_property('import_textures', True)
- fbx_options.set_editor_property('import_as_skeletal', False)
- fbx_options.set_editor_property('import_materials', True)
- # settings specifically for static meshes
- fbx_options.static_mesh_import_data.set_editor_property('combine_meshes', False)
- fbx_options.static_mesh_import_data.set_editor_property('generate_lightmap_u_vs', False)
- return task
Advertisement
Add Comment
Please, Sign In to add comment