0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UE5.6でe57、las、lazの点群ファイルをロードする

Last updated at Posted at 2025-10-21

UE5.6.1のLidarPointCloudRuntimeでe57、las、lazの点群ファイルが読み込めなかったので読み込めるようにしてみました。
この記事を書いている時点ではissueやフォーラムでは有効な情報を見つけらていないので内容をメモしておきます。
UE5.7.0Preview1ではこの問題は発生していないようです。

環境

UE5.6.1
VisualStudio2022 Professional
Windows11

対応方法

Build.csのPrivateDependencyModuleNamesにLidarPointCloudRuntimeを追加して任意のタイミングで以下のコードを実行します。

#include "IO/LidarPointCloudFileIO_E57.h"
#include "IO/LidarPointCloudFileIO_LAS.h"

...

	UClass* E57Class = ULidarPointCloudFileIO_E57::StaticClass();
	ULidarPointCloudFileIO_E57* ExistingE57Handler = Cast<ULidarPointCloudFileIO_E57>(E57Class->GetDefaultObject());
	ULidarPointCloudFileIO::RegisterHandler(ExistingE57Handler, { "E57" });

	UClass* LASClass = ULidarPointCloudFileIO_LAS::StaticClass();
	ULidarPointCloudFileIO_LAS* ExistingLASHandler = Cast<ULidarPointCloudFileIO_LAS>(LASClass->GetDefaultObject());
	ULidarPointCloudFileIO::RegisterHandler(ExistingLASHandler, { "LAS" });
	ULidarPointCloudFileIO::RegisterHandler(ExistingLASHandler, { "LAZ" });

以下のサンプルプロジェクトではプラグイン化してみました。

原因

e57などのファイル読み込み用のインスタンスの登録がうまくいっていないみたいです。

以下のようにクラス デフォルト オブジェクト (CDO) 作成時のコンストラクタで読み込みハンドラが登録されるようです。

Engine\Plugins\Enterprise\LidarPointCloud\Source\LidarPointCloudRuntime\Public\IO\LidarPointCloudFileIO_E57.h
UCLASS()
class LIDARPOINTCLOUDRUNTIME_API ULidarPointCloudFileIO_E57 : public UObject, public FLidarPointCloudFileIOHandler
{
...
	ULidarPointCloudFileIO_E57()
	{
#if LIBE57SUPPORTED
		ULidarPointCloudFileIO::RegisterHandler(this, { "E57" });
#endif
	}
};

RegisterHandlerでは以下のようにInstance変数が設定されている必要があります。
今回の問題ではこれが設定されていません。

Engine\Plugins\Enterprise\LidarPointCloud\Source\LidarPointCloudRuntime\Private\IO\LidarPointCloudFileIO.cpp
void ULidarPointCloudFileIO::RegisterHandler(FLidarPointCloudFileIOHandler* Handler, const TArray<FString>& Extensions)
{
	if (Instance)
	{
		for (const FString& Extension : Extensions)
		{
			Instance->RegisteredHandlers.Emplace(Extension, Handler);
		}
	}
}

Instance変数の設定は以下のようにCDO作成時のコンストラクタで実行されるようです。

Engine\Plugins\Enterprise\LidarPointCloud\Source\LidarPointCloudRuntime\Private\IO\LidarPointCloudFileIO.cpp
ULidarPointCloudFileIO::ULidarPointCloudFileIO(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
...
	// This will assign an Instance pointer
	if (!Instance)
	{
		Instance = this;
	}

ULidarPointCloudFileIO → ULidarPointCloudFileIO_E57の順番でCDOが作成されると問題ないのですが反対になってしまっていて登録がされていないようなので対応方法のようにCDOを再取得して再登録してあげればいいみたいです。
なぜこの順番になっているかやどのようにUE5.7.0Preview1で解消されているのは追えていません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?