Download

Import point cloud from Python without import dialogue

If importing a lidar point cloud via Python, how can we automatically set the color range, and columns without having to manually fill out the import dialogue each time?


import unreal
AssetTools = unreal.AssetToolsHelpers.get_asset_tools()
AssetImportTask = unreal.AssetImportTask()
AssetImportTask.set_editor_property('filename', "d:	est.xyz")
...
AssetTools.import_asset_tasks([AssetImportTask])

Also if we set AssetImportTask.automated = True, then Unreal returns a Python call stack dump. How can we get around that?


 

  1. LogFactory: FactoryCreateFile: LidarPointCloud with LidarPointCloudFactory (0 0 D:	est.xyz)
  1. LogSlate: Warning: A modal window tried to take control while running in unattended script mode. The window was canceled.
  1. LogStats: FPlatformStackWalk::StackWalkAndDump - 3.189 s
  1. LogOutputDevice: Error: === FDebug::DumpStackTrace(): ===
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997cfb586 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a5f1657 UE4Editor-LidarPointCloudEditor.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a5f0a35 UE4Editor-LidarPointCloudEditor.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a5e015b UE4Editor-LidarPointCloudEditor.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff97b20951c UE4Editor-UnrealEd.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a5e6bbd UE4Editor-LidarPointCloudEditor.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff9584d73fe UE4Editor-AssetTools.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff9584d42f7 UE4Editor-AssetTools.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff95852feaa UE4Editor-AssetTools.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff998340b34 UE4Editor-CoreUObject.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff9985b4753 UE4Editor-CoreUObject.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee84013 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94eebbe8f UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94eebc97b UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee6a2bf UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006fef4dd3 python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006ffa1fbb python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006ffa1a55 python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006ff9eeab python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006ffa0421 python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x000000006ff9b459 python27.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee703c2 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94eea3113 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee70970 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee7081a UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee70736 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff99ce92780 UE4Editor-Core.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff998505377 UE4Editor-CoreUObject.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff999e0089a UE4Editor-Engine.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff97b10ed5a UE4Editor-UnrealEd.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff97b94a077 UE4Editor-UnrealEd.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee88a9a UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff94ee71521 UE4Editor-PythonScriptPlugin.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997dfab85 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997e01320 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997dda937 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997e7207e UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997e8b27e UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997e02a95 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997cd2dc8 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997d569cf UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997d3f4b2 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff997d32392 UE4Editor-Slate.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a2d7f88 UE4Editor-ApplicationCore.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a2c5c87 UE4Editor-ApplicationCore.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a2da619 UE4Editor-ApplicationCore.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a2c17d0 UE4Editor-ApplicationCore.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffaf521e6d8 USER32.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffaf521e119 USER32.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffa5a2dbb34 UE4Editor-ApplicationCore.dll!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff796d268c4 UE4Editor.exe!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff796d3ba7c UE4Editor.exe!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff796d3bb5a UE4Editor.exe!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff796d4e31d UE4Editor.exe!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ff796d5145a UE4Editor.exe!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffaf4377034 KERNEL32.DLL!UnknownFunction ]
  1. LogOutputDevice: Error: [Callstack] 0x00007ffaf633cec1 ntdll.dll!UnknownFunction ]

 

In your AssetImportTask, you need set ‘automated’ to True and the ‘options’ property to the appropriate options object.
For example, if it was for an .fbx file, you’d use FbxImportUI(). I’m not familiar with the lidar point cloud file type but it might be LidarPointCloudImportSettings_ASCII_Columns.



AssetImportTask.set_editor_property('automated', True)  # don't show dialog

importUI = unreal.FbxImportUI()  # import options
importUI.set_editor_property('mesh_type_to_import', unreal.FBXImportType.FBXIT_STATIC_MESH)
AssetImportTask.set_editor_property('options', importUI)
...
AssetTools.import_asset_tasks([AssetImportTask])