2
2

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.3でStaicMeshEditorSubsystemを使ってみた

Posted at

EditorScriptingUtilitiesプラグインを利用しているとStaicMeshEditorSubsystemを使えという警告が出て対応してみた内容をメモしておきます。

環境

UE5.3.2

EditorScriptingUtilitiesプラグインの警告

Editor Scripting UtilitiesのMergeStaticMeshActorsノードをBPで使っていたら以下のような警告が出ていました。
Editor Scripting UtilitiesプラグインはdeprecatedなのでStaicMeshEditorSubsystemを使えということらしいです。

Merge Static Mesh Actors : Usage of 'Merge Static Mesh Actors' has been deprecated. The Editor Scripting Utilities Plugin is deprecated - Use the function in Static Mesh Editor Subsystem

BPでStaicMeshEditorSubsystemを取得できない

上記のような記事を参照してBPでStaticMeshEidotrSubsystemを使おうとしましたがうまくいきませんでした。
確かにContent Sensitiveのチェックを外すとMergeStaticMeshActorsノード(Target is Static Mesh Ediotr Subsystemになっている)は出てくるのですが、StaticMeshEditorSubsystemをgetするノードが出てきません。

以下のForumでも同じ状況のようです。

in unreal 5.3.2 on the “DataPrep Editing Operator” BP,
i have the same issue I used an old “Merge Static Mesh Actors” deprecated
unreal tell me to use the new one, but if I try to get the “Static Mesh Editor SubSystem” I doesn’t exist

対応してみた

以下のようにしてUStaticMeshEditorSubsystemを得るノードを作ってMergeStaticMeshActorsノードに接続したらうまくいきました。

[project].build.cs
PrivateDependencyModuleNames.AddRange(new string[] { ... , "StaticMeshEditor", "UnrealEd"});
#include "StaticMeshEditorSubsystem.h"
...
UFUNCTION(BlueprintPure)
static UStaticMeshEditorSubsystem* GetStaticMeshEditorSubsystem()
{
    return GEditor->GetEditorSubsystem<UStaticMeshEditorSubsystem>();
}

補足

ソースコードを参照するとEditorScriptingUtilitiesプラグインのMergeStaticMeshActors関数の中身はそのままStaticMeshEditorSubsystemを使ってるだけなので処理内容は変わらないようです。
https://github.com/EpicGames/UnrealEngine/blob/5.3/Engine/Plugins/Editor/EditorScriptingUtilities/Source/EditorScriptingUtilities/Private/EditorLevelLibrary.cpp#L420-L426

Engine\Plugins\Editor\EditorScriptingUtilities\Source\EditorScriptingUtilities\Private\EditorLevelLibrary.cpp
bool UEditorLevelLibrary::MergeStaticMeshActors(const TArray<AStaticMeshActor*>& ActorsToMerge, const FEditorScriptingMergeStaticMeshActorsOptions_Deprecated& MergeOptions, AStaticMeshActor*& OutMergedActor)
{
	UStaticMeshEditorSubsystem* StaticMeshEditorSubsystem = GEditor->GetEditorSubsystem<UStaticMeshEditorSubsystem>();

	return StaticMeshEditorSubsystem ? StaticMeshEditorSubsystem->MergeStaticMeshActors(ActorsToMerge, InternalEditorLevelLibrary::ConvertMergeStaticMeshActorsOptions(MergeOptions), OutMergedActor) : false;

}
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?