Voxel Plugin PRO を UE5 Preview 1 で利用する

公式の Discord Channel で日々情報は更新されているので、そちらを見れば済むのですがメモとして。

Windows

OS: Windows 10

Quick Start - Voxel Plugin Documentation

上記の Using the Beta / Building from source が基本的な方法になります。

簡単には

  1. C++ プロジェクトで作成するか、C++ プロジェクトに変換
  2. プロジェクトの Plugins ディレクトリに、VoxelProProBetaLTS branch を checkout (デフォルト branch が ProBetaLTS なので、単に checkout するだけで OK です)
  3. ここで注意ですが、上記の wiki だと、VoxelPro.uplugin のように rename しているように見えますが、ここで rename はせず、checkout したままの、Voxel.uplugin にします
  4. uproject をダブルクリックしてビルドを行います

私は 3 のステップで VoxelPro.uplugin に rename してしまい、数時間を無駄にしました 😅

macOS

OS: macOS Monterey (チップは M1 です)

基本的には Windows の方と同じです。ただし、4 で uproject をダブルクリックし、ビルドを実行しても失敗します 🥲

コードの編集

以下の二つの issue を参考にコードを編集します。(ここも discord から拾ったのですが、どのスレッドからだったか見失ってしまいました。。)

私の場合の Plugins/VoxelPro 以下の diff は以下です。

diff --git a/Source/VoxelEditor/Private/Details/VoxelPaintMaterialCustomization.cpp b/Source/VoxelEditor/Private/Details/VoxelPaintMaterialCustomization.cpp
index 852950e05..fed87c116 100644
--- a/Source/VoxelEditor/Private/Details/VoxelPaintMaterialCustomization.cpp
+++ b/Source/VoxelEditor/Private/Details/VoxelPaintMaterialCustomization.cpp
@@ -360,7 +360,7 @@ void FVoxelPaintMaterial_MaterialCollectionChannelCustomization::CustomizeHeader
 
                                        Material->SetScalarParameterValue("EditorPreviewSingleIndex", Index);
 
-                                       const FVoxelMaterialCollectionMaterialInfo MaterialInfo{ Index, Material, *FString::Printf(TEXT("Index %03d"), Index) };
+                                       const FVoxelMaterialCollectionMaterialInfo MaterialInfo{ static_cast<uint8>(Index), Material, *FString::Printf(TEXT("Index %03d"), Index) };
                                        AssetsToMaterials->Add(Material, MaterialInfo);
                                        IndicesToMaterials->Add(Index, MaterialInfo);
                                }
diff --git a/Source/VoxelGraphEditor/Private/VoxelLandscapeGrassGraph.cpp b/Source/VoxelGraphEditor/Private/VoxelLandscapeGrassGraph.cpp
index 1c63607e8..64a0b3981 100644
--- a/Source/VoxelGraphEditor/Private/VoxelLandscapeGrassGraph.cpp
+++ b/Source/VoxelGraphEditor/Private/VoxelLandscapeGrassGraph.cpp
@@ -33,10 +33,10 @@
 
 void FVoxelLandscapeGrassGraph::Register()
 {
-       MakeInstance = [](TFunction<UObject* (UClass* Class)> CreateGraph)
+       MakeInstance = [](TFunction<UObject* (UClass* Class)> _CreateGraph)
        {
                auto Instance = MakeVoxelShared<FVoxelLandscapeGrassGraph>();
-               Instance->CreateGraph = CreateGraph;
+               Instance->CreateGraph = _CreateGraph;
                return Instance;
        };
 }

以下のように UE5 Preview 1 で Voxel Pro が動作します。

f:id:you1dan:20220304231040p:plain

余談

UE5 Preview 1 で XcodePlugins ディレクトリを認識させるために Finder で uproject ファイルに対して Generate Xcode Project を実行したのですが、うまくいかず結局 VSCode で編集しました。