python unreal(5.2)开发记录

代码段记录

选择actor并移动
要获静态网格体的组件,才能移动

1
2
3
import unreal
a=unreal.EditorLevelLibrary.get_selected_level_actors()
print(a[0].static_mesh_component.set_world_location(unreal.Vector(0,0,0)))

导出fbx设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
output_file = 'C:\\Temp\\ue4_output.fbx'

selected_actors = unreal.EditorLevelLibrary.get_selected_level_actors()
if len(selected_actors) == 0:
print("No actor selected, nothing to export")
quit()

task = unreal.AssetExportTask()
task.object = selected_actors[0].get_world()
task.filename = output_file
task.selected = True
task.replace_identical = False
task.prompt = False
task.automated = True
task.options = unreal.FbxExportOption()
task.options.vertex_color = False
task.options.collision = False
task.options.level_of_detail = False
unreal.Exporter.run_asset_export_task(task)