diff --git a/Engine/Build/Commit.gitdeps.xml b/Engine/Build/Commit.gitdeps.xml
index 6b6ea3006224..56cd8c2f9fa1 100644
--- a/Engine/Build/Commit.gitdeps.xml
+++ b/Engine/Build/Commit.gitdeps.xml
@@ -70177,45 +70177,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -115556,7 +115517,6 @@
-
@@ -115979,7 +115939,6 @@
-
@@ -118872,7 +118831,6 @@
-
@@ -120079,7 +120037,6 @@
-
@@ -120398,7 +120355,6 @@
-
@@ -123132,7 +123088,6 @@
-
@@ -123272,7 +123227,6 @@
-
@@ -124970,7 +124924,6 @@
-
@@ -125586,7 +125539,6 @@
-
@@ -130766,7 +130718,6 @@
-
@@ -131229,7 +131180,6 @@
-
@@ -142194,7 +142144,6 @@
-
@@ -147664,7 +147613,6 @@
-
@@ -148217,7 +148165,6 @@
-
@@ -148914,7 +148861,6 @@
-
@@ -149246,7 +149192,6 @@
-
@@ -149977,7 +149922,6 @@
-
@@ -152659,7 +152603,6 @@
-
@@ -152945,7 +152888,6 @@
-
@@ -153418,7 +153360,6 @@
-
@@ -154833,7 +154774,6 @@
-
@@ -157509,7 +157449,6 @@
-
@@ -158769,7 +158708,6 @@
-
@@ -159384,7 +159322,6 @@
-
@@ -164355,7 +164292,6 @@
-
@@ -164923,7 +164859,6 @@
-
@@ -169760,7 +169695,6 @@
-
@@ -169991,7 +169925,6 @@
-
@@ -171108,7 +171041,6 @@
-
@@ -171703,7 +171635,6 @@
-
@@ -172391,7 +172322,6 @@
-
@@ -173145,7 +173075,6 @@
-
@@ -174199,7 +174128,6 @@
-
@@ -177993,7 +177921,6 @@
-
@@ -179220,7 +179147,6 @@
-
@@ -180897,7 +180823,6 @@
-
@@ -182717,7 +182642,6 @@
-
@@ -182988,7 +182912,6 @@
-
@@ -184473,7 +184396,6 @@
-
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/LegacyVertexDeltaModel.uplugin b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/LegacyVertexDeltaModel.uplugin
deleted file mode 100644
index a195ed254c65..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/LegacyVertexDeltaModel.uplugin
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "FileVersion": 3,
- "Version": 1,
- "VersionName": "0.2",
- "FriendlyName": "ML Deformer Legacy Vertex Delta Model",
- "Description": "Legacy Vertex Delta Model for the ML Deformer Framework",
- "Category": "Animation",
- "CreatedBy": "Epic Games, Inc.",
- "CreatedByURL": "http://epicgames.com",
- "DocsURL": "https://docs.unrealengine.com/5.0/en-US/using-the-machine-learning-deformer-in-unreal-engine/",
- "MarketplaceURL": "",
- "SupportURL": "https://forums.unrealengine.com/",
- "CanContainContent": true,
- "IsBetaVersion": false,
- "IsExperimentalVersion": true,
- "Installed": false,
- "Modules": [
- {
- "Name": "LegacyVertexDeltaModel",
- "Type": "Runtime",
- "LoadingPhase": "Default"
- },
- {
- "Name": "LegacyVertexDeltaModelEditor",
- "Type": "Editor",
- "LoadingPhase": "Default"
- }
- ],
- "Plugins": [
- {
- "Name": "GeometryCache",
- "Enabled": true
- },
- {
- "Name": "NeuralNetworkInference",
- "Enabled": true
- },
- {
- "Name": "Optimus",
- "Enabled": true
- },
- {
- "Name": "PythonFoundationPackages",
- "Enabled": true
- },
- {
- "Name": "MLDeformerFramework",
- "Enabled": true
- }
- ]
-}
\ No newline at end of file
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Shaders/Private/LegacyVertexDeltaModelDataInterface.ush b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Shaders/Private/LegacyVertexDeltaModelDataInterface.ush
deleted file mode 100644
index 9727a843af5e..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Shaders/Private/LegacyVertexDeltaModelDataInterface.ush
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "/Plugin/ComputeFramework/Private/ComputeKernelCommon.ush"
-
-uint DI_LOCAL(NumVertices);
-uint DI_LOCAL(InputStreamStart);
-float3 DI_LOCAL(VertexDeltaScale);
-float3 DI_LOCAL(VertexDeltaMean);
-float DI_LOCAL(Weight);
-
-Buffer DI_LOCAL(PositionDeltaBuffer);
-Buffer DI_LOCAL(VertexMapBuffer);
-
-DI_IMPL_READ(ReadNumVertices, uint, void)
-{
- return DI_LOCAL(NumVertices);
-}
-
-DI_IMPL_READ(ReadPositionDelta, float3, uint VertexIndex)
-{
- uint BufferIndex = DI_LOCAL(VertexMapBuffer)[VertexIndex + DI_LOCAL(InputStreamStart)] * 3;
- float3 Delta = float3(DI_LOCAL(PositionDeltaBuffer)[BufferIndex], DI_LOCAL(PositionDeltaBuffer)[BufferIndex + 1], DI_LOCAL(PositionDeltaBuffer)[BufferIndex + 2]);
- float3 FinalDelta = Delta * DI_LOCAL(VertexDeltaScale) + DI_LOCAL(VertexDeltaMean);
- return FinalDelta * DI_LOCAL(Weight);
-}
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/LegacyVertexDeltaModel.Build.cs b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/LegacyVertexDeltaModel.Build.cs
deleted file mode 100644
index 8651bd38cfba..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/LegacyVertexDeltaModel.Build.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-using UnrealBuildTool;
-
-public class LegacyVertexDeltaModel : ModuleRules
-{
- public LegacyVertexDeltaModel(ReadOnlyTargetRules Target) : base(Target)
- {
- PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
-
- PublicIncludePaths.AddRange(
- new string[] {
- // ... add public include paths required here ...
- }
- );
-
-
- PrivateIncludePaths.AddRange(
- new string[] {
- // ... add other private include paths required here ...
- }
- );
-
-
- PublicDependencyModuleNames.AddRange(
- new string[]
- {
- "Core"
- // ... add other public dependencies that you statically link with here ...
- }
- );
-
-
- PrivateDependencyModuleNames.AddRange(
- new string[]
- {
- "ComputeFramework",
- "CoreUObject",
- "Engine",
- "GeometryCache",
- "NeuralNetworkInference",
- "OptimusCore",
- "Projects",
- "RenderCore",
- "RHI",
- "MLDeformerFramework"
- }
- );
-
-
- DynamicallyLoadedModuleNames.AddRange(
- new string[]
- {
- // ... add any modules that your module loads dynamically here ...
- }
- );
- }
-}
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModel.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModel.cpp
deleted file mode 100644
index 021a87edceb3..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModel.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-#include "LegacyVertexDeltaModel.h"
-#include "LegacyVertexDeltaModelVizSettings.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "UObject/Object.h"
-
-#define LOCTEXT_NAMESPACE "ULegacyVertexDeltaModel"
-
-ULegacyVertexDeltaModel::ULegacyVertexDeltaModel(const FObjectInitializer& ObjectInitializer)
- : Super(ObjectInitializer)
-{
-#if WITH_EDITORONLY_DATA
- VizSettings = ObjectInitializer.CreateEditorOnlyDefaultSubobject(this, TEXT("VizSettings"));
-#endif
-}
-
-#if WITH_EDITOR
- void ULegacyVertexDeltaModel::UpdateNumTargetMeshVertices()
- {
- NumTargetMeshVerts = UE::MLDeformer::ExtractNumImportedGeomCacheVertices(GeometryCache);
- }
-#endif // WITH_EDITOR
-
-#if WITH_EDITORONLY_DATA
- void ULegacyVertexDeltaModel::SampleGroundTruthPositions(float SampleTime, TArray& OutPositions)
- {
- ULegacyVertexDeltaModelVizSettings* VertexVizSettings = Cast(VizSettings);
- check(VertexVizSettings);
-
- UGeometryCache* GeomCache = VertexVizSettings->GetTestGroundTruth();
- if (GeomCache == nullptr)
- {
- OutPositions.Reset();
- return;
- }
-
- if (MeshMappings.IsEmpty())
- {
- TArray FailedImportedMeshnames;
- TArray VertexMisMatchNames;
- GenerateGeomCacheMeshMappings(SkeletalMesh, GeomCache, MeshMappings, FailedImportedMeshnames, VertexMisMatchNames);
- }
-
- UE::MLDeformer::SampleGeomCachePositions(
- 0,
- SampleTime,
- MeshMappings,
- SkeletalMesh,
- GeomCache,
- AlignmentTransform,
- OutPositions);
- }
-#endif
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelDataInterface.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelDataInterface.cpp
deleted file mode 100644
index 40fc326cbe9f..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelDataInterface.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaModelDataInterface.h"
-#include "LegacyVertexDeltaModel.h"
-#include "MLDeformerModelInstance.h"
-#include "MLDeformerAsset.h"
-#include "MLDeformerComponent.h"
-#include "Components/SkeletalMeshComponent.h"
-#include "ComputeFramework/ComputeKernelPermutationSet.h"
-#include "ComputeFramework/ShaderParamTypeDefinition.h"
-#include "OptimusDataDomain.h"
-#include "RenderGraphBuilder.h"
-#include "RenderGraphUtils.h"
-#include "RenderGraphResources.h"
-#include "ShaderParameterMetadataBuilder.h"
-#include "SkeletalRenderPublic.h"
-
-BEGIN_SHADER_PARAMETER_STRUCT(FLegacyVertexDeltaModelDataInterfaceParameters,)
- MLDEFORMER_SHADER_PARAMETERS()
- SHADER_PARAMETER(FVector3f, VertexDeltaScale)
- SHADER_PARAMETER(FVector3f, VertexDeltaMean)
-END_SHADER_PARAMETER_STRUCT()
-
-MLDEFORMER_GRAPH_IMPLEMENT_BASICS(
- ULegacyVertexDeltaModelDataInterface,
- ULegacyVertexDeltaModelDataProvider,
- UE::LegacyVertexDeltaModel::FLegacyVertexDeltaModelDataProviderProxy,
- FLegacyVertexDeltaModelDataInterfaceParameters,
- TEXT("#include \"/Plugin/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelDataInterface.ush\"\n"),
- TEXT("Legacy Vertex Delta Model"))
-
-namespace UE::LegacyVertexDeltaModel
-{
- FLegacyVertexDeltaModelDataProviderProxy::FLegacyVertexDeltaModelDataProviderProxy(UMLDeformerComponent* DeformerComponent)
- : UE::MLDeformer::FMLDeformerGraphDataProviderProxy(DeformerComponent)
- {
- const UMLDeformerModel* Model = DeformerComponent->GetDeformerAsset()->GetModel();
- const ULegacyVertexDeltaModel* VertexDeltaModel = Cast(Model);
- if (ensure(VertexDeltaModel))
- {
- VertexDeltaScale = static_cast(VertexDeltaModel->GetVertexDeltaScale());
- VertexDeltaMean = static_cast(VertexDeltaModel->GetVertexDeltaMean());
- }
- }
-
- void FLegacyVertexDeltaModelDataProviderProxy::GatherDispatchData(FDispatchSetup const& InDispatchSetup, FCollectedDispatchData& InOutDispatchData)
- {
- MLDEFORMER_GRAPH_DISPATCH_START(FLegacyVertexDeltaModelDataInterfaceParameters, InDispatchSetup, InOutDispatchData)
- MLDEFORMER_GRAPH_DISPATCH_DEFAULT_PARAMETERS()
- Parameters->VertexDeltaScale = VertexDeltaScale;
- Parameters->VertexDeltaMean = VertexDeltaMean;
- MLDEFORMER_GRAPH_DISPATCH_END()
- }
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelModule.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelModule.cpp
deleted file mode 100644
index 4656c63418e8..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/LegacyVertexDeltaModelModule.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaModelModule.h"
-#include "Modules/ModuleManager.h"
-#include "Interfaces/IPluginManager.h"
-#include "Misc/Paths.h"
-#include "ShaderCore.h"
-
-LEGACYVERTEXDELTAMODEL_API DEFINE_LOG_CATEGORY(LogLegacyVertexDeltaModel)
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaModelModule"
-
-IMPLEMENT_MODULE(UE::LegacyVertexDeltaModel::FLegacyVertexDeltaModelModule, LegacyVertexDeltaModel)
-
-namespace UE::LegacyVertexDeltaModel
-{
- void FLegacyVertexDeltaModelModule::StartupModule()
- {
- // Register an additional shader path for our shaders used inside the deformer graph system.
- const FString PluginShaderDir = FPaths::Combine(IPluginManager::Get().FindPlugin(TEXT("LegacyVertexDeltaModel"))->GetBaseDir(), TEXT("Shaders"));
- AddShaderSourceDirectoryMapping(TEXT("/Plugin/LegacyVertexDeltaModel"), PluginShaderDir);
- }
-} // namespace UE::LegacyVertexDeltaModel
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/Tests/LegacyVertexDeltaModelTest.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/Tests/LegacyVertexDeltaModelTest.cpp
deleted file mode 100644
index 039c441ecd91..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Private/Tests/LegacyVertexDeltaModelTest.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "CoreMinimal.h"
-#include "Misc/AutomationTest.h"
-
-#if WITH_DEV_AUTOMATION_TESTS
-
-#include "LegacyVertexDeltaModelModule.h"
-#include "LegacyVertexDeltaModel.h"
-#include "LegacyVertexDeltaModelVizSettings.h"
-#include "MLDeformerAsset.h"
-#include "MLDeformerComponent.h"
-#include "MLDeformerModelInstance.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "UObject/GCObjectScopeGuard.h"
-#include "PreviewScene.h"
-#include "Components/SkeletalMeshComponent.h"
-#include "NeuralNetwork.h"
-#include "GeometryCache.h"
-#include "Engine/SkeletalMesh.h"
-#include "Rendering/SkeletalMeshModel.h"
-#include "Rendering/SkeletalMeshLODModel.h"
-
-namespace UE::LegacyVertexDeltaModelTests
-{
- IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLegacyVertexDeltaModelMainTest, "MLDeformer.LegacyVertexDeltaModel.MainTest", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter);
- bool FLegacyVertexDeltaModelMainTest::RunTest(const FString& Parameters)
- {
- using namespace UE::MLDeformer;
- using namespace UE::LegacyVertexDeltaModel;
-
- UMLDeformerAsset* DeformerAsset = LoadObject(nullptr, TEXT("MLDeformerAsset'/LegacyVertexDeltaModel/Tests/Biceps/biceps_mld.biceps_mld'"));
- UTEST_NOT_NULL(TEXT("MLDeformerAsset load"), DeformerAsset);
- FGCObjectScopeGuard Guard(DeformerAsset);
-
- ULegacyVertexDeltaModel* VertexDeltaModel = Cast(DeformerAsset->GetModel());
- UTEST_NOT_NULL(TEXT("LegacyVertexDeltaModel load check"), VertexDeltaModel);
-
- UNeuralNetwork* NeuralNet = VertexDeltaModel->GetNeuralNetwork();
- UTEST_NOT_NULL(TEXT("Neuralnet check"), NeuralNet);
-
- UMLDeformerInputInfo* InputInfo = VertexDeltaModel->GetInputInfo();
- UTEST_NOT_NULL(TEXT("InputInfo check"), InputInfo);
- const int64 NumInputInfoInputs = InputInfo->CalcNumNeuralNetInputs();
- const int64 NumNetworkInputs = NeuralNet->GetInputTensor().Num();
- UTEST_EQUAL(TEXT("InputInfo input count check"), NumInputInfoInputs, NumNetworkInputs);
-
- const int32 NumInputBones = InputInfo->GetNumBones();
- UTEST_EQUAL(TEXT("InputInfo bone count check"), NumInputBones, 1);
- UTEST_EQUAL(TEXT("InputInfo bone name string check"), InputInfo->GetBoneNameStrings().Num(), 1);
- UTEST_EQUAL(TEXT("InputInfo bone name string content check"), InputInfo->GetBoneNameString(0), FString("lowerarm_l"));
- UTEST_EQUAL(TEXT("InputInfo bone names check"), InputInfo->GetBoneNames().Num(), 1);
- UTEST_EQUAL(TEXT("InputInfo bone names content check"), InputInfo->GetBoneName(0), FName("lowerarm_l"));
- UTEST_EQUAL(TEXT("InputInfo vertex count check"), InputInfo->GetNumBaseMeshVertices(), InputInfo->GetNumTargetMeshVertices());
-
- const FVertexMapBuffer& VertexMapBuffer = VertexDeltaModel->GetVertexMapBuffer();
- UTEST_TRUE(TEXT("VertexMapBuffer check"), VertexMapBuffer.IsInitialized());
-
-#if WITH_EDITORONLY_DATA
- USkeletalMesh* SkeletalMesh = VertexDeltaModel->GetSkeletalMesh();
- UTEST_NOT_NULL(TEXT("SkeletalMesh check"), SkeletalMesh);
-
- UTEST_TRUE(TEXT("Model vs Network compatible check"), VertexDeltaModel->GetInputInfo()->IsCompatible(SkeletalMesh));
-
- UGeometryCache* GeomCache = VertexDeltaModel->GetGeometryCache();
- UTEST_NOT_NULL(TEXT("GeomCache check"), GeomCache);
-
- const FSkeletalMeshModel* ImportedModel = SkeletalMesh->GetImportedModel();
- UTEST_NOT_NULL(TEXT("ImportedModel check"), ImportedModel);
-
- const TArray& VertexMap = VertexDeltaModel->GetVertexMap();
- UTEST_EQUAL(TEXT("VertexMap size check"), VertexMap.Num(), ImportedModel->LODModels[0].NumVertices);
-
- const int32 NumBaseMeshVerts = UMLDeformerModel::ExtractNumImportedSkinnedVertices(SkeletalMesh);
- const int32 NumGeomCacheVerts = ExtractNumImportedGeomCacheVertices(GeomCache);
- UTEST_EQUAL(TEXT("VertexCount check"), NumBaseMeshVerts, NumGeomCacheVerts);
- UTEST_EQUAL(TEXT("Model SkelMesh VertexCount check"), VertexDeltaModel->GetNumBaseMeshVerts(), NumBaseMeshVerts);
- UTEST_EQUAL(TEXT("Model TargetMesh VertexCount check"), VertexDeltaModel->GetNumTargetMeshVerts(), NumGeomCacheVerts);
-
- const int64 NumNetworkOutputs = NeuralNet->GetOutputTensor().Num();
- const int64 ExpectedNetworkOutput = NumGeomCacheVerts * 3; // 3 floats per vertex.
- UTEST_EQUAL(TEXT("NeuralNet output size check"), NumNetworkOutputs, ExpectedNetworkOutput);
-
- UTEST_EQUAL(TEXT("Loss function check"), VertexDeltaModel->GetLossFunction(), ELegacyVertexDeltaModelLossFunction::L1);
- UTEST_EQUAL(TEXT("Activation function check"), VertexDeltaModel->GetActivationFunction(), ELegacyVertexDeltaModelActivationFunction::LRelu);
- UTEST_EQUAL(TEXT("Hidden Layers check"), VertexDeltaModel->GetNumHiddenLayers(), 2);
-
- ULegacyVertexDeltaModelVizSettings* VizSettings = Cast(VertexDeltaModel->GetVizSettings());
- UTEST_NOT_NULL(TEXT("VizSettings check"), VizSettings);
-
- // Create a preview scene and spawn an actor.
- TUniquePtr PreviewScene = MakeUnique(FPreviewScene::ConstructionValues());
- UWorld* World = PreviewScene->GetWorld();
- UTEST_NOT_NULL(TEXT("World check"), World);
- FActorSpawnParameters SpawnParams;
- SpawnParams.Name = MakeUniqueObjectName(World, AActor::StaticClass(), FName(TEXT("ML Deformer Test Actor")));
- AActor* Actor = World->SpawnActor(SpawnParams);
- Actor->SetFlags(RF_Transient);
- UTEST_NOT_NULL(TEXT("Actor check"), Actor);
-
- // Add a skeletal mesh component.
- USkeletalMeshComponent* SkelMeshComponent = NewObject(Actor);
- SkelMeshComponent->SetSkeletalMesh(SkeletalMesh);
- Actor->SetRootComponent(SkelMeshComponent);
- SkelMeshComponent->RegisterComponent();
-
- // Add an ML Deformer component and activate it.
- UMLDeformerComponent* MLDeformerComponent = NewObject(Actor);
- MLDeformerComponent->SetDeformerAsset(DeformerAsset);
- MLDeformerComponent->RegisterComponent();
- MLDeformerComponent->Activate();
- UTEST_EQUAL(TEXT("MLDeformerComponent weight check"), MLDeformerComponent->GetWeight(), 1.0f);
- UTEST_TRUE(TEXT("MLDeformerComponent SkelMeshComponent check"), MLDeformerComponent->GetSkeletalMeshComponent() == SkelMeshComponent);
-
- // Create and init the model instance.
- UMLDeformerModelInstance* ModelInstance = MLDeformerComponent->GetModelInstance();
- UTEST_NOT_NULL(TEXT("CreateModelInstance check"), ModelInstance);
- UTEST_TRUE(TEXT("ModelInstance GetModel check"), ModelInstance->GetModel() == VertexDeltaModel);
- UTEST_TRUE(TEXT("ModelInstance compatible check"), ModelInstance->IsCompatible());
-#endif // WITH_EDITORONLY_DATA
-
- return true;
- }
-} // namespace UE::LegacyVertexDeltaModelTests
-
-#endif // #if WITH_DEV_AUTOMATION_TESTS
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModel.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModel.h
deleted file mode 100644
index 9b4048b469f8..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModel.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerModel.h"
-#include "MLDeformerVizSettings.h"
-#include "MLDeformerInputInfo.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "UObject/Object.h"
-#include "LegacyVertexDeltaModel.generated.h"
-
-class USkeletalMesh;
-class UGeometryCache;
-class UAnimSequence;
-class UNeuralNetwork;
-class UMLDeformerAsset;
-class USkeleton;
-class IPropertyHandle;
-
-/** The activation function to use during the ML Deformer training process. */
-UENUM()
-enum class ELegacyVertexDeltaModelActivationFunction : uint8
-{
- Relu,
- LRelu,
- Tanh
-};
-
-/** The loss function to use during the ML Deformer training process. */
-UENUM()
-enum class ELegacyVertexDeltaModelLossFunction : uint8
-{
- L1,
- MSE,
- Shrinkage
-};
-
-UCLASS()
-class LEGACYVERTEXDELTAMODEL_API ULegacyVertexDeltaModel
- : public UMLDeformerModel
-{
- GENERATED_BODY()
-
-public:
- ULegacyVertexDeltaModel(const FObjectInitializer& ObjectInitializer);
-
- // UMLDeformerModel overrides.
- virtual FString GetDisplayName() const override { return "Legacy Vertex Delta Model"; }
-#if WITH_EDITORONLY_DATA
- virtual bool HasTrainingGroundTruth() const override { return (GeometryCache.Get() != nullptr); }
- virtual void SampleGroundTruthPositions(float SampleTime, TArray& OutPositions) override;
-#endif
-#if WITH_EDITOR
- virtual void UpdateNumTargetMeshVertices();
-#endif
- // ~END UMLDeformerModel overrides.
-
- const FVector& GetVertexDeltaMean() const { return VertexDeltaMean; }
- const FVector& GetVertexDeltaScale() const { return VertexDeltaScale; }
-
-#if WITH_EDITORONLY_DATA
- const UGeometryCache* GetGeometryCache() const { return GeometryCache; }
- UGeometryCache* GetGeometryCache() { return GeometryCache; }
- ELegacyVertexDeltaModelLossFunction GetLossFunction() const { return LossFunction; }
- ELegacyVertexDeltaModelActivationFunction GetActivationFunction() const { return ActivationFunction; }
- int32 GetNumHiddenLayers() const { return NumHiddenLayers; }
- int32 GetNumNeuronsPerLayer() const { return NumNeuronsPerLayer; }
- int32 GetNumEpochs() const { return Epochs; }
- int32 GetBatchSize() const { return BatchSize; }
- float GetLearningRate() const { return LearningRate; }
- float GetShrinkageSpeed() const { return ShrinkageSpeed; }
- float GetShrinkageThrehsold() const { return ShrinkageThreshold; }
- int32 GetMaxCacheSizeGB() const { return MaxCacheSizeGB; }
- TArray& GetGeomCacheMeshMappings() { return MeshMappings; }
- const TArray& GetGeomCacheMeshMappings() const { return MeshMappings; }
-#endif
-
-public:
- /** The vertex delta mean. This is passed to the deformer shader to reconstruct the correct output deltas. */
- UPROPERTY()
- FVector VertexDeltaMean = FVector::ZeroVector;
-
- /** The vertex delta scale. This is passed to the deformer shader to rescale the output deltas. */
- UPROPERTY()
- FVector VertexDeltaScale = FVector::OneVector;
-
-#if WITH_EDITORONLY_DATA
- TArray MeshMappings;
-
- /** The geometry cache that represents the complex mesh deformations. */
- UPROPERTY(EditAnywhere, Category = "Target Mesh")
- TObjectPtr GeometryCache = nullptr;
-
- /** The number of hidden layers that the neural network model will have.\nHigher numbers will slow down performance but can deal with more complex deformations. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Training Settings", meta = (ClampMin = "1", ClampMax = "10"))
- int32 NumHiddenLayers = 2;
-
- /** The number of units/neurons per hidden layer. Higher numbers will slow down performance but allow for more complex mesh deformations. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Training Settings", meta = (ClampMin = "1"))
- int32 NumNeuronsPerLayer = 256;
-
- /** The number of epochs to process without any decay. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Training Settings", meta = (ClampMin = "1"))
- int32 Epochs = 20;
-
- /** The number of frames per batch when training the model. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings", meta = (ClampMin = "1"))
- int32 BatchSize = 128;
-
- /** The learning rate used during the model training. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings", meta = (ClampMin = "0.000001", ClampMax = "1.0"))
- float LearningRate = 0.00175f;
-
- /** The activation function to use in the neural network. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings")
- ELegacyVertexDeltaModelActivationFunction ActivationFunction = ELegacyVertexDeltaModelActivationFunction::LRelu;
-
- /** The loss function to use during model training. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings")
- ELegacyVertexDeltaModelLossFunction LossFunction = ELegacyVertexDeltaModelLossFunction::L1;
-
- /** Shrinkage speed. Only if the shrinkage loss is used. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings", meta = (ClampMin = "1.0", ClampMax = "1000.0"))
- float ShrinkageSpeed = 10.0f;
-
- /** Shrinkage threshold. Only if the shrinkage loss is used. */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings", meta = (ClampMin = "0.0"))
- float ShrinkageThreshold = 0.1f;
-
- /**
- * The maximum allowed size of the training cache in memory, in gigabytes.
- * So a value of 4 would use a maximum of four gigabyte of system memory.
- * The larger the cache size the faster the training.
- */
- UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category = "Training Settings", DisplayName = "Max Cache Size", meta = (ClampMin = "0", ForceUnits = "Gigabytes"))
- int32 MaxCacheSizeGB = 4; // 4 Gigabyte
-
-#endif // WITH_EDITORONLY_DATA
-};
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelDataInterface.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelDataInterface.h
deleted file mode 100644
index f1a9de93d11b..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelDataInterface.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerGraphDataInterface.h"
-#include "OptimusComputeDataInterface.h"
-#include "ComputeFramework/ComputeDataProvider.h"
-#include "LegacyVertexDeltaModelDataInterface.generated.h"
-
-class FRDGBuffer;
-class FRDGBufferSRV;
-class FRHIShaderResourceView;
-class FSkeletalMeshObject;
-class UMLDeformerComponent;
-class UNeuralNetwork;
-class USkeletalMeshComponent;
-class UMLDeformerModel;
-
-/** Compute Framework Data Interface for MLDefomer data. */
-UCLASS(Category = ComputeFramework)
-class LEGACYVERTEXDELTAMODEL_API ULegacyVertexDeltaModelDataInterface
- : public UMLDeformerGraphDataInterface
-{
- GENERATED_BODY()
-
-public:
- // UOptimusComputeDataInterface overrides.
- virtual FString GetDisplayName() const override;
- // ~END UOptimusComputeDataInterface overrides.
-
- // UComputeDataInterface overrides.
- virtual void GetShaderParameters(TCHAR const* UID, FShaderParametersMetadataBuilder& InOutBuilder, FShaderParametersMetadataAllocations& InOutAllocations) const override;
- virtual void GetHLSL(FString& OutHLSL) const override;
- virtual UComputeDataProvider* CreateDataProvider(TObjectPtr InBinding, uint64 InInputMask, uint64 InOutputMask) const override;
- // ~END UComputeDataInterface overrides.
-};
-
-/** Compute Framework Data Provider for MLDeformer data. */
-UCLASS(BlueprintType, EditInlineNew, Category = ComputeFramework)
-class LEGACYVERTEXDELTAMODEL_API ULegacyVertexDeltaModelDataProvider
- : public UMLDeformerGraphDataProvider
-{
- GENERATED_BODY()
-
-public:
- // UComputeDataProvider overrides.
- virtual FComputeDataProviderRenderProxy* GetRenderProxy() override;
- // ~END UComputeDataProvider overrides.
-};
-
-namespace UE::LegacyVertexDeltaModel
-{
- /** Compute Framework Data Provider Proxy for MLDeformer data. */
- class LEGACYVERTEXDELTAMODEL_API FLegacyVertexDeltaModelDataProviderProxy
- : public UE::MLDeformer::FMLDeformerGraphDataProviderProxy
- {
- public:
- FLegacyVertexDeltaModelDataProviderProxy(UMLDeformerComponent* DeformerComponent);
-
- // FComputeDataProviderRenderProxy overrides.
- virtual void GatherDispatchData(FDispatchSetup const& InDispatchSetup, FCollectedDispatchData& InOutDispatchData) override;
- // ~END FComputeDataProviderRenderProxy overrides.
-
- private:
- FVector3f VertexDeltaScale = FVector3f(1.0f, 1.0f, 1.0f);
- FVector3f VertexDeltaMean = FVector3f(0.0f, 0.0f, 0.0f);
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelModule.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelModule.h
deleted file mode 100644
index 9071f5799224..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelModule.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "Modules/ModuleManager.h"
-
-LEGACYVERTEXDELTAMODEL_API DECLARE_LOG_CATEGORY_EXTERN(LogLegacyVertexDeltaModel, Log, All);
-
-namespace UE::LegacyVertexDeltaModel
-{
- class LEGACYVERTEXDELTAMODEL_API FLegacyVertexDeltaModelModule
- : public IModuleInterface
- {
- public:
- // IModuleInterface overrides.
- virtual void StartupModule() override;
- // ~END IModuleInterface overrides.
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelVizSettings.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelVizSettings.h
deleted file mode 100644
index 689398ea3f0b..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModel/Public/LegacyVertexDeltaModelVizSettings.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "UObject/Object.h"
-#include "MLDeformerVizSettings.h"
-#include "LegacyVertexDeltaModelVizSettings.generated.h"
-
-class UGeometryCache;
-
-/**
- * The vizualization settings specific to the the vertex delta model.
- */
-UCLASS()
-class LEGACYVERTEXDELTAMODEL_API ULegacyVertexDeltaModelVizSettings
- : public UMLDeformerVizSettings
-{
- GENERATED_BODY()
-
-public:
-#if WITH_EDITORONLY_DATA
- virtual bool HasTestGroundTruth() const override { return (GroundTruth.Get() != nullptr); }
- UGeometryCache* GetTestGroundTruth() const { return GroundTruth; }
-
-public:
- /** The geometry cache that represents the ground truth of the test anim sequence. */
- UPROPERTY(EditAnywhere, Category = "Test Assets")
- TObjectPtr GroundTruth = nullptr;
-#endif // WITH_EDITORONLY_DATA
-};
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/LegacyVertexDeltaModelEditor.Build.cs b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/LegacyVertexDeltaModelEditor.Build.cs
deleted file mode 100644
index 0b3f0ba110aa..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/LegacyVertexDeltaModelEditor.Build.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-using System.IO;
-
-namespace UnrealBuildTool.Rules
-{
- public class LegacyVertexDeltaModelEditor : ModuleRules
- {
- public LegacyVertexDeltaModelEditor(ReadOnlyTargetRules Target) : base(Target)
- {
- PublicDependencyModuleNames.AddRange(
- new string[]
- {
- "Core"
- }
- );
-
- PrivateDependencyModuleNames.AddRange(
- new string[]
- {
- "EditorFramework",
- "UnrealEd",
- "CoreUObject",
- "Engine",
- "Slate",
- "SlateCore",
- "EditorWidgets",
- "EditorStyle",
- "GeometryCache",
- "MLDeformerFramework",
- "MLDeformerFrameworkEditor",
- "LegacyVertexDeltaModel",
- "PropertyEditor",
- "NeuralNetworkInference",
- "ToolWidgets",
- "ComputeFramework"
- }
- );
-
- PrivateIncludePathModuleNames.AddRange(
- new string[]
- {
- }
- );
- }
- }
-}
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModel.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModel.cpp
deleted file mode 100644
index f002f0e217b9..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModel.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaEditorModel.h"
-#include "LegacyVertexDeltaModel.h"
-#include "LegacyVertexDeltaModelVizSettings.h"
-#include "LegacyVertexDeltaTrainingModel.h"
-#include "LegacyVertexDeltaEditorModelActor.h"
-#include "MLDeformerEditorToolkit.h"
-#include "MLDeformerEditorStyle.h"
-#include "MLDeformerInputInfo.h"
-#include "MLDeformerGeomCacheSampler.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "GeometryCache.h"
-#include "GeometryCacheComponent.h"
-#include "Animation/DebugSkelMeshComponent.h"
-#include "Rendering/SkeletalMeshModel.h"
-#include "Rendering/SkeletalMeshLODModel.h"
-#include "Engine/SkeletalMesh.h"
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaEditorModel"
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- FMLDeformerEditorModel* FLegacyVertexDeltaEditorModel::MakeInstance()
- {
- return new FLegacyVertexDeltaEditorModel();
- }
-
- void FLegacyVertexDeltaEditorModel::AddReferencedObjects(FReferenceCollector& Collector)
- {
- Collector.AddReferencedObject(EditorInputInfo);
- }
-
- FMLDeformerSampler* FLegacyVertexDeltaEditorModel::CreateSampler() const
- {
- FMLDeformerGeomCacheSampler* NewSampler = new FMLDeformerGeomCacheSampler();
- NewSampler->OnGetGeometryCache().BindLambda([this] { return GetVertexDeltaModel()->GetGeometryCache(); });
- return NewSampler;
- }
-
- void FLegacyVertexDeltaEditorModel::OnPostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
- {
- const FProperty* Property = PropertyChangedEvent.Property;
- if (Property == nullptr)
- {
- return;
- }
-
- HandleDefaultPropertyChanges(PropertyChangedEvent);
-
- // When we change one of these properties below, restart animations etc.
- if (Property->GetFName() == GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, GeometryCache) ||
- Property->GetFName() == GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModelVizSettings, GroundTruth))
- {
- TriggerInputAssetChanged(true);
- }
- else
- if (Property->GetFName() == GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, DeltaCutoffLength) ||
- Property->GetFName() == GET_MEMBER_NAME_CHECKED(UMLDeformerModel, AlignmentTransform))
- {
- if (PropertyChangedEvent.ChangeType == EPropertyChangeType::ValueSet)
- {
- SetResamplingInputOutputsNeeded(true);
- SampleDeltas();
- }
- }
- }
-
- void FLegacyVertexDeltaEditorModel::OnInputAssetsChanged()
- {
- // Update the skeletal mesh components of the training, test base, and ml deformed actor.
- FMLDeformerEditorModel::OnInputAssetsChanged();
-
- ULegacyVertexDeltaModelVizSettings* VizSettings = GetVertexDeltaModelVizSettings();
- check(VizSettings);
- const float TestAnimSpeed = VizSettings->GetAnimPlaySpeed();
- UAnimSequence* TestAnimSequence = VizSettings->GetTestAnimSequence();
-
- // Update the training geometry cache.
- UGeometryCacheComponent* GeometryCacheComponent = FindVertexDeltaModelEditorActor(ActorID_Train_GroundTruth)->GetGeometryCacheComponent();
- check(GeometryCacheComponent);
- GeometryCacheComponent->SetGeometryCache(GetVertexDeltaModel()->GetGeometryCache());
- GeometryCacheComponent->ResetAnimationTime();
- GeometryCacheComponent->SetLooping(false);
- GeometryCacheComponent->SetManualTick(true);
- GeometryCacheComponent->SetPlaybackSpeed(TestAnimSpeed);
- GeometryCacheComponent->Play();
-
- // Update the test geometry cache (ground truth) component.
- GeometryCacheComponent = FindVertexDeltaModelEditorActor(ActorID_Test_GroundTruth)->GetGeometryCacheComponent();
- GeometryCacheComponent->SetGeometryCache(VizSettings->GetTestGroundTruth());
- GeometryCacheComponent->ResetAnimationTime();
- GeometryCacheComponent->SetLooping(true);
- GeometryCacheComponent->SetManualTick(true);
- GeometryCacheComponent->SetPlaybackSpeed(TestAnimSpeed);
- GeometryCacheComponent->Play();
-
- ULegacyVertexDeltaModel* VertexDeltaModel = GetVertexDeltaModel();
- VertexDeltaModel->MeshMappings.Reset();
- }
-
- void FLegacyVertexDeltaEditorModel::CreateTrainingGroundTruthActor(UWorld* World)
- {
- UGeometryCache* GeomCache = GetVertexDeltaModel()->GetGeometryCache();
- const FLinearColor LabelColor = FMLDeformerEditorStyle::Get().GetColor("MLDeformer.TargetMesh.LabelColor");
- const FLinearColor WireframeColor = FMLDeformerEditorStyle::Get().GetColor("MLDeformer.TargetMesh.WireframeColor");
- CreateGeomCacheActor(
- World,
- ActorID_Train_GroundTruth,
- "Train GroundTruth",
- GeomCache,
- LabelColor,
- WireframeColor,
- LOCTEXT("TrainGroundTruthActorLabelText", "Target Mesh"),
- true);
- }
-
- void FLegacyVertexDeltaEditorModel::CreateTestGroundTruthActor(UWorld* World)
- {
- UGeometryCache* GeomCache = GetVertexDeltaModelVizSettings()->GetTestGroundTruth();
- const FLinearColor LabelColor = FMLDeformerEditorStyle::Get().GetColor("MLDeformer.GroundTruth.LabelColor");
- const FLinearColor WireframeColor = FMLDeformerEditorStyle::Get().GetColor("MLDeformer.GroundTruth.WireframeColor");
- CreateGeomCacheActor(
- World,
- ActorID_Test_GroundTruth,
- "Test GroundTruth",
- GeomCache,
- LabelColor,
- WireframeColor,
- LOCTEXT("TestGroundTruthActorLabelText", "Ground Truth"),
- false);
- }
-
- void FLegacyVertexDeltaEditorModel::CreateGeomCacheActor(UWorld* World, int32 ActorID, const FName& Name, UGeometryCache* GeomCache, FLinearColor LabelColor, FLinearColor WireframeColor, const FText& LabelText, bool bIsTrainingActor)
- {
- FActorSpawnParameters SpawnParams;
- SpawnParams.Name = MakeUniqueObjectName(World, AActor::StaticClass(), Name);
- AActor* Actor = World->SpawnActor(SpawnParams);
- Actor->SetFlags(RF_Transient);
-
- // Create the Geometry Cache Component.
- UGeometryCacheComponent* GeomCacheComponent = NewObject(Actor);
- GeomCacheComponent->SetGeometryCache(GeomCache);
- GeomCacheComponent->RegisterComponent();
- GeomCacheComponent->SetOverrideWireframeColor(true);
- GeomCacheComponent->SetWireframeOverrideColor(WireframeColor);
- GeomCacheComponent->MarkRenderStateDirty();
- GeomCacheComponent->SetVisibility(false);
- Actor->SetRootComponent(GeomCacheComponent);
-
- // Create the editor actor.
- FMLDeformerEditorActor::FConstructSettings Settings;
- Settings.Actor = Actor;
- Settings.TypeID = ActorID;
- Settings.LabelColor = LabelColor;
- Settings.LabelText = LabelText;
- Settings.bIsTrainingActor = bIsTrainingActor;
- FLegacyVertexDeltaEditorModelActor* EditorActor = static_cast(CreateEditorActor(Settings));
- EditorActor->SetGeometryCacheComponent(GeomCacheComponent);
- EditorActors.Add(EditorActor);
- }
-
- FMLDeformerEditorActor* FLegacyVertexDeltaEditorModel::CreateEditorActor(const FMLDeformerEditorActor::FConstructSettings& Settings) const
- {
- return new FLegacyVertexDeltaEditorModelActor(Settings);
- }
-
- FLegacyVertexDeltaEditorModelActor* FLegacyVertexDeltaEditorModel::FindVertexDeltaModelEditorActor(int32 TypeID) const
- {
- return static_cast(FindEditorActor(TypeID));
- }
-
- ULegacyVertexDeltaModelVizSettings* FLegacyVertexDeltaEditorModel::GetVertexDeltaModelVizSettings() const
- {
- return Cast(GetVertexDeltaModel()->GetVizSettings());
- }
-
- double FLegacyVertexDeltaEditorModel::GetTrainingTimeAtFrame(int32 FrameNumber) const
- {
- const FLegacyVertexDeltaEditorModelActor* EditorActor = static_cast(GetTimelineEditorActor());
- if (EditorActor && EditorActor->GetGeometryCacheComponent())
- {
- return EditorActor->GetGeometryCacheComponent()->GetTimeAtFrame(FrameNumber);
- }
- return 0.0;
- }
-
- int32 FLegacyVertexDeltaEditorModel::GetTrainingFrameAtTime(double TimeInSeconds) const
- {
- const FLegacyVertexDeltaEditorModelActor* EditorActor = static_cast(GetTimelineEditorActor());
- if (EditorActor && EditorActor->GetGeometryCacheComponent())
- {
- return EditorActor->GetGeometryCacheComponent()->GetFrameAtTime(TimeInSeconds);
- }
- return 0;
- }
-
- int32 FLegacyVertexDeltaEditorModel::GetNumTrainingFrames() const
- {
- const UGeometryCache* GeometryCache = GetVertexDeltaModel()->GetGeometryCache();
- if (GeometryCache == nullptr)
- {
- return 0;
- }
- const int32 StartFrame = GeometryCache->GetStartFrame();
- const int32 EndFrame = GeometryCache->GetEndFrame();
- return (EndFrame - StartFrame) + 1;
- }
-
- void FLegacyVertexDeltaEditorModel::UpdateIsReadyForTrainingState()
- {
- bIsReadyForTraining = false;
-
- // Do some basic checks first, like if there is a skeletal mesh, ground truth, anim sequence, and if there are frames.
- if (!IsEditorReadyForTrainingBasicChecks())
- {
- return;
- }
-
- // Now make sure the assets are compatible.
- ULegacyVertexDeltaModel* VertexDeltaModel = GetVertexDeltaModel();
- UGeometryCache* GeomCache = VertexDeltaModel->GetGeometryCache();
- USkeletalMesh* SkeletalMesh = VertexDeltaModel->GetSkeletalMesh();
- if (!GetGeomCacheErrorText(SkeletalMesh, GeomCache).IsEmpty())
- {
- return;
- }
-
- // Make sure every skeletal imported mesh has some geometry track.
- const int32 NumGeomCacheTracks = GeomCache ? GeomCache->Tracks.Num() : 0;
- int32 NumSkelMeshes = 0;
- if (SkeletalMesh)
- {
- FSkeletalMeshModel* ImportedModel = SkeletalMesh->GetImportedModel();
- if (ImportedModel)
- {
- NumSkelMeshes = ImportedModel->LODModels[0].ImportedMeshInfos.Num();
- }
- }
-
- // Allow the special case where there is just one mesh and track.
- if (NumGeomCacheTracks != 1 || NumSkelMeshes != 1)
- {
- if (!GetGeomCacheSampler()->GetFailedImportedMeshNames().IsEmpty())
- {
- return;
- }
- }
-
- bIsReadyForTraining = true;
- }
-
- ETrainingResult FLegacyVertexDeltaEditorModel::Train()
- {
- return TrainModel(this);
- }
-
- void FLegacyVertexDeltaEditorModel::OnPreTraining()
- {
- // Make a backup of the normalization values, as they get overwritten when training.
- // However, when we abort, we want to restore to the original values again.
- // See OnTrainingAborted for when we restore the backup again.
- VertexDeltaMeanBackup = GetVertexDeltaModel()->GetVertexDeltaMean();
- VertexDeltaScaleBackup = GetVertexDeltaModel()->GetVertexDeltaScale();
- }
-
- void FLegacyVertexDeltaEditorModel::OnPostTraining(ETrainingResult TrainingResult, bool bUsePartiallyTrainedWhenAborted)
- {
- // Restore the vertex delta mean and scale, as we aborted, and they could have changed when training
- // on a smaller subset of frames/samples. If we don't do this, the mesh will deform incorrectly.
- if (TrainingResult == ETrainingResult::Aborted && !bUsePartiallyTrainedWhenAborted)
- {
- GetVertexDeltaModel()->VertexDeltaMean = VertexDeltaMeanBackup;
- GetVertexDeltaModel()->VertexDeltaScale = VertexDeltaScaleBackup;
- }
- }
-
- FString FLegacyVertexDeltaEditorModel::GetTrainedNetworkOnnxFile() const
- {
- return FString(FPaths::ProjectIntermediateDir() + TEXT("LegacyVertexDeltaModel/latest_net_G.onnx"));
- }
-
- FString FLegacyVertexDeltaEditorModel::GetDefaultDeformerGraphAssetPath() const
- {
- return FString(TEXT("/LegacyVertexDeltaModel/Deformers/DG_LegacyVertexDeltaModel.DG_LegacyVertexDeltaModel"));
- }
-
- FString FLegacyVertexDeltaEditorModel::GetHeatMapDeformerGraphPath() const
- {
- return FString(TEXT("/LegacyVertexDeltaModel/Deformers/DG_LegacyVertexDeltaModel_HeatMap.DG_LegacyVertexDeltaModel_HeatMap"));
- }
-} // namespace UE::LegacyVertexDeltaModel
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModelActor.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModelActor.cpp
deleted file mode 100644
index 36feb3efa055..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaEditorModelActor.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaEditorModelActor.h"
-#include "GeometryCacheComponent.h"
-#include "Animation/DebugSkelMeshComponent.h"
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- FLegacyVertexDeltaEditorModelActor::FLegacyVertexDeltaEditorModelActor(const FConstructSettings& Settings)
- : FMLDeformerEditorActor(Settings)
- {
- }
-
- FLegacyVertexDeltaEditorModelActor::~FLegacyVertexDeltaEditorModelActor()
- {
- if (GeomCacheComponent)
- {
- Actor->RemoveOwnedComponent(GeomCacheComponent);
- }
- }
-
- void FLegacyVertexDeltaEditorModelActor::SetVisibility(bool bIsVisible)
- {
- FMLDeformerEditorActor::SetVisibility(bIsVisible);
-
- if (GeomCacheComponent && bIsVisible != GeomCacheComponent->IsVisible())
- {
- GeomCacheComponent->SetVisibility(bIsVisible, true);
- }
- }
-
- bool FLegacyVertexDeltaEditorModelActor::IsVisible() const
- {
- if (SkeletalMeshComponent)
- {
- return SkeletalMeshComponent->IsVisible();
- }
-
- if (GeomCacheComponent)
- {
- return GeomCacheComponent->IsVisible();
- }
-
- return true;
- }
-
- void FLegacyVertexDeltaEditorModelActor::SetPlayPosition(float TimeInSeconds, bool bAutoPause)
- {
- if (SkeletalMeshComponent)
- {
- SkeletalMeshComponent->SetPosition(TimeInSeconds);
- if (bAutoPause)
- {
- SkeletalMeshComponent->bPauseAnims = true;
- }
- }
-
- if (GeomCacheComponent)
- {
- GeomCacheComponent->SetManualTick(true);
- GeomCacheComponent->TickAtThisTime(TimeInSeconds, false, false, false);
- }
- }
-
- float FLegacyVertexDeltaEditorModelActor::GetPlayPosition() const
- {
- if (SkeletalMeshComponent)
- {
- return SkeletalMeshComponent->GetPosition();
- }
-
- if (GeomCacheComponent)
- {
- return GeomCacheComponent->GetAnimationTime();
- }
-
- return 0.0f;
- }
-
- void FLegacyVertexDeltaEditorModelActor::SetPlaySpeed(float PlaySpeed)
- {
- if (SkeletalMeshComponent)
- {
- SkeletalMeshComponent->SetPlayRate(PlaySpeed);
- }
-
- if (GeomCacheComponent)
- {
- GeomCacheComponent->SetPlaybackSpeed(PlaySpeed);
- }
- }
-
- void FLegacyVertexDeltaEditorModelActor::Pause(bool bPaused)
- {
- if (SkeletalMeshComponent)
- {
- SkeletalMeshComponent->bPauseAnims = bPaused;
- }
-
- if (GeomCacheComponent)
- {
- GeomCacheComponent->SetManualTick(bPaused);
- }
- }
-
- FBox FLegacyVertexDeltaEditorModelActor::GetBoundingBox() const
- {
- if (SkeletalMeshComponent)
- {
- return SkeletalMeshComponent->Bounds.GetBox();
- }
-
- if (GeomCacheComponent)
- {
- return GeomCacheComponent->Bounds.GetBox();
- }
-
- FBox Box;
- Box.Init();
- return Box;
- }
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelDetails.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelDetails.cpp
deleted file mode 100644
index 2f9456730961..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelDetails.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaModelDetails.h"
-#include "LegacyVertexDeltaEditorModel.h"
-#include "LegacyVertexDeltaModel.h"
-#include "MLDeformerModule.h"
-#include "MLDeformerAsset.h"
-#include "MLDeformerModel.h"
-#include "MLDeformerEditorModel.h"
-#include "MLDeformerEditorModule.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "NeuralNetwork.h"
-#include "GeometryCache.h"
-#include "GeometryCacheTrack.h"
-#include "Animation/AnimSequence.h"
-#include "Engine/SkeletalMesh.h"
-#include "PropertyCustomizationHelpers.h"
-#include "AssetRegistry/AssetData.h"
-#include "Modules/ModuleManager.h"
-#include "DetailLayoutBuilder.h"
-#include "DetailCategoryBuilder.h"
-#include "DetailWidgetRow.h"
-#include "IDetailsView.h"
-#include "IDetailGroup.h"
-#include "Widgets/DeclarativeSyntaxSupport.h"
-#include "Widgets/Layout/SBox.h"
-#include "Widgets/Input/SButton.h"
-#include "DetailLayoutBuilder.h"
-#include "SWarningOrErrorBox.h"
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaModelDetails"
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- TSharedRef FLegacyVertexDeltaModelDetails::MakeInstance()
- {
- return MakeShareable(new FLegacyVertexDeltaModelDetails());
- }
-
- bool FLegacyVertexDeltaModelDetails::UpdateMemberPointers(const TArray>& Objects)
- {
- if (!FMLDeformerModelDetails::UpdateMemberPointers(Objects))
- {
- return false;
- }
-
- VertexModel = Cast(Model);
- check(VertexModel);
- VertexEditorModel = static_cast(EditorModel);
-
- return (VertexModel != nullptr && VertexEditorModel != nullptr);
- }
-
- void FLegacyVertexDeltaModelDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
- {
- // Create all the detail categories and add the properties of the base class.
- FMLDeformerModelDetails::CustomizeDetails(DetailBuilder);
-
- // Training settings.
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, NumHiddenLayers));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, NumNeuronsPerLayer));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, Epochs));
-
- // Check whether shrinkage settings should be visible or not.
- auto IsShrinkageVisible = [this]()
- {
- return (VertexModel->GetLossFunction() == ELegacyVertexDeltaModelLossFunction::Shrinkage) ? EVisibility::Visible : EVisibility::Collapsed;
- };
-
- // Advanced settings.
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, BatchSize));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, LearningRate));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, ActivationFunction));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, LossFunction));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, ShrinkageSpeed))
- .Visibility(TAttribute::CreateLambda(IsShrinkageVisible));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, ShrinkageThreshold))
- .Visibility(TAttribute::CreateLambda(IsShrinkageVisible));
- SettingsCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, MaxCacheSizeGB));
- }
-
- void FLegacyVertexDeltaModelDetails::AddAnimSequenceErrors()
- {
- const FText WarningText = GetGeomCacheAnimSequenceErrorText(VertexModel->GetGeometryCache(), Model->GetAnimSequence());
- BaseMeshCategoryBuilder->AddCustomRow(FText::FromString("AnimSeqWarning"))
- .Visibility(!WarningText.IsEmpty() ? EVisibility::Visible : EVisibility::Collapsed)
- .WholeRowContent()
- [
- SNew(SBox)
- .Padding(FMargin(0.0f, 4.0f))
- [
- SNew(SWarningOrErrorBox)
- .MessageStyle(EMessageStyle::Warning)
- .Message(WarningText)
- ]
- ];
- }
-
- void FLegacyVertexDeltaModelDetails::AddTargetMesh()
- {
- TargetMeshCategoryBuilder->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModel, GeometryCache));
-
- const FText TargetMeshErrorText = GetGeomCacheErrorText(VertexModel->GetSkeletalMesh(), VertexModel->GetGeometryCache());
- TargetMeshCategoryBuilder->AddCustomRow(FText::FromString("TargetMeshError"))
- .Visibility(!TargetMeshErrorText.IsEmpty() ? EVisibility::Visible : EVisibility::Collapsed)
- .WholeRowContent()
- [
- SNew(SBox)
- .Padding(FMargin(0.0f, 4.0f))
- [
- SNew(SWarningOrErrorBox)
- .MessageStyle(EMessageStyle::Error)
- .Message(TargetMeshErrorText)
- ]
- ];
-
- const FText ChangedErrorText = EditorModel->GetTargetAssetChangedErrorText();
- TargetMeshCategoryBuilder->AddCustomRow(FText::FromString("TargetMeshChangedError"))
- .Visibility(!ChangedErrorText.IsEmpty() ? EVisibility::Visible : EVisibility::Collapsed)
- .WholeRowContent()
- [
- SNew(SBox)
- .Padding(FMargin(0.0f, 4.0f))
- [
- SNew(SWarningOrErrorBox)
- .MessageStyle(EMessageStyle::Error)
- .Message(ChangedErrorText)
- ]
- ];
-
- AddGeomCacheMeshMappingWarnings(TargetMeshCategoryBuilder, Model->GetSkeletalMesh(), VertexModel->GetGeometryCache());
- }
-} // namespace UE::LegacyVertexDeltaModel
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelEditorModule.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelEditorModule.cpp
deleted file mode 100644
index c09cb5b571bf..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelEditorModule.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaModelEditorModule.h"
-#include "MLDeformerEditorModule.h"
-#include "LegacyVertexDeltaModelVizSettingsDetails.h"
-#include "LegacyVertexDeltaModelDetails.h"
-#include "LegacyVertexDeltaEditorModel.h"
-#include "LegacyVertexDeltaModel.h"
-#include "Modules/ModuleManager.h"
-#include "EditorModeRegistry.h"
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaModelEditorModule"
-
-IMPLEMENT_MODULE(UE::LegacyVertexDeltaModel::FLegacyVertexDeltaModelEditorModule, LegacyVertexDeltaModelEditor)
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- void FLegacyVertexDeltaModelEditorModule::StartupModule()
- {
- // Register object detail customizations.
- FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor");
- PropertyModule.RegisterCustomClassLayout("LegacyVertexDeltaModelVizSettings", FOnGetDetailCustomizationInstance::CreateStatic(&FLegacyVertexDeltaModelVizSettingsDetails::MakeInstance));
- PropertyModule.RegisterCustomClassLayout("LegacyVertexDeltaModel", FOnGetDetailCustomizationInstance::CreateStatic(&FLegacyVertexDeltaModelDetails::MakeInstance));
- PropertyModule.NotifyCustomizationModuleChanged();
-
- // Register our custom ML deformer model to the model registry in the ML Deformer Framework.
- FMLDeformerEditorModule& EditorModule = FModuleManager::LoadModuleChecked("MLDeformerFrameworkEditor");
- FMLDeformerEditorModelRegistry& ModelRegistry = EditorModule.GetModelRegistry();
- ModelRegistry.RegisterEditorModel(ULegacyVertexDeltaModel::StaticClass(), FOnGetEditorModelInstance::CreateStatic(&FLegacyVertexDeltaEditorModel::MakeInstance), /*ModelPriority*/0);
- }
-
- void FLegacyVertexDeltaModelEditorModule::ShutdownModule()
- {
- // Unregister our ML Deformer model.
- if (FModuleManager::Get().IsModuleLoaded(TEXT("MLDeformerFrameworkEditor")))
- {
- FMLDeformerEditorModule& EditorModule = FModuleManager::GetModuleChecked("MLDeformerFrameworkEditor");
- FMLDeformerEditorModelRegistry& ModelRegistry = EditorModule.GetModelRegistry();
- ModelRegistry.UnregisterEditorModel(ULegacyVertexDeltaModel::StaticClass());
- }
-
- // Unregister object detail customizations for this model.
- if (FModuleManager::Get().IsModuleLoaded(TEXT("PropertyEditor")))
- {
- FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked(TEXT("PropertyEditor"));
- PropertyModule.UnregisterCustomClassLayout(TEXT("LegacyVertexDeltaModelVizSettings"));
- PropertyModule.UnregisterCustomClassLayout(TEXT("LegacyVertexDeltaModel"));
- PropertyModule.NotifyCustomizationModuleChanged();
- }
- }
-
-} // namespace UE::LegacyVertexDeltaModel
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelVizSettingsDetails.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelVizSettingsDetails.cpp
deleted file mode 100644
index b9171a9ff949..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaModelVizSettingsDetails.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaModelVizSettingsDetails.h"
-#include "MLDeformerModule.h"
-#include "MLDeformerModel.h"
-#include "MLDeformerEditorModule.h"
-#include "MLDeformerGeomCacheHelpers.h"
-#include "LegacyVertexDeltaModel.h"
-#include "LegacyVertexDeltaEditorModel.h"
-#include "LegacyVertexDeltaModelVizSettings.h"
-#include "DetailLayoutBuilder.h"
-#include "DetailCategoryBuilder.h"
-#include "DetailWidgetRow.h"
-#include "IDetailsView.h"
-#include "IDetailChildrenBuilder.h"
-#include "IDetailGroup.h"
-#include "Modules/ModuleManager.h"
-#include "Layout/Margin.h"
-#include "Widgets/Layout/SBorder.h"
-#include "Widgets/Text/STextBlock.h"
-#include "Widgets/Layout/SBox.h"
-#include "PropertyCustomizationHelpers.h"
-#include "AssetRegistry/AssetData.h"
-#include "PropertyHandle.h"
-#include "DetailLayoutBuilder.h"
-#include "SWarningOrErrorBox.h"
-#include "GeometryCache.h"
-#include "Animation/AnimSequence.h"
-#include "Animation/MeshDeformer.h"
-#include "Engine/SkeletalMesh.h"
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaModelVizSettingsDetails"
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- TSharedRef FLegacyVertexDeltaModelVizSettingsDetails::MakeInstance()
- {
- return MakeShareable(new FLegacyVertexDeltaModelVizSettingsDetails());
- }
-
- bool FLegacyVertexDeltaModelVizSettingsDetails::UpdateMemberPointers(const TArray>& Objects)
- {
- if (!FMLDeformerVizSettingsDetails::UpdateMemberPointers(Objects))
- {
- return false;
- }
-
- VertexDeltaModel = Cast(Model);
- VertexDeltaVizSettings = Cast(VizSettings);
- return (VertexDeltaModel != nullptr && VertexDeltaVizSettings != nullptr);
- }
-
- void FLegacyVertexDeltaModelVizSettingsDetails::AddGroundTruth()
- {
- TestAssetsCategory->AddProperty(GET_MEMBER_NAME_CHECKED(ULegacyVertexDeltaModelVizSettings, GroundTruth));
-
- // Show an error when the test anim sequence duration doesn't match the one of the ground truth.
- const FText AnimErrorText = GetGeomCacheAnimSequenceErrorText(VertexDeltaVizSettings->GetTestGroundTruth(), VizSettings->GetTestAnimSequence());
- FDetailWidgetRow& GroundTruthAnimErrorRow = TestAssetsCategory->AddCustomRow(FText::FromString("GroundTruthAnimMismatchError"))
- .Visibility(!AnimErrorText.IsEmpty() ? EVisibility::Visible : EVisibility::Collapsed)
- .WholeRowContent()
- [
- SNew(SBox)
- .Padding(FMargin(0.0f, 4.0f))
- [
- SNew(SWarningOrErrorBox)
- .MessageStyle(EMessageStyle::Warning)
- .Message(AnimErrorText)
- ]
- ];
-
- const FText GeomErrorText = GetGeomCacheErrorText(Model->GetSkeletalMesh(), VertexDeltaVizSettings->GetTestGroundTruth());
- FDetailWidgetRow& GroundTruthGeomErrorRow = TestAssetsCategory->AddCustomRow(FText::FromString("GroundTruthGeomMismatchError"))
- .Visibility(!GeomErrorText.IsEmpty() ? EVisibility::Visible : EVisibility::Collapsed)
- .WholeRowContent()
- [
- SNew(SBox)
- .Padding(FMargin(0.0f, 4.0f))
- [
- SNew(SWarningOrErrorBox)
- .MessageStyle(EMessageStyle::Warning)
- .Message(GeomErrorText)
- ]
- ];
- }
-} //namespace UE::LegacyVertexDeltaModel
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaTrainingModel.cpp b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaTrainingModel.cpp
deleted file mode 100644
index 30cdd13a7b0b..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Private/LegacyVertexDeltaTrainingModel.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#include "LegacyVertexDeltaTrainingModel.h"
-#include "LegacyVertexDeltaModel.h"
-#include "LegacyVertexDeltaEditorModel.h"
-#include "MLDeformerEditorModel.h"
-#include "Misc/ScopedSlowTask.h"
-#include "Math/NumericLimits.h"
-
-#define LOCTEXT_NAMESPACE "LegacyVertexDeltaTrainingModel"
-
-ULegacyVertexDeltaModel* ULegacyVertexDeltaTrainingModel::GetVertexDeltaModel() const
-{
- return Cast(GetModel());
-}
-
-UE::LegacyVertexDeltaModel::FLegacyVertexDeltaEditorModel* ULegacyVertexDeltaTrainingModel::GetVertexDeltaEditorModel() const
-{
- return static_cast(EditorModel);
-}
-
-void ULegacyVertexDeltaTrainingModel::UpdateVertexDeltaMeanAndScale(const TArray& VertexDeltas, FVector& InOutMeanVertexDelta, FVector& InOutVertexDeltaScale, float& InOutCount)
-{
- // Calculate this frame's mean.
- FVector MeanDelta = FVector::ZeroVector;
- FVector MinDelta(TNumericLimits::Max());
- FVector MaxDelta(-TNumericLimits::Max());
- const int32 NumVertices = VertexDeltas.Num() / 3;
- for (int32 VertexIndex = 0; VertexIndex < NumVertices; ++VertexIndex)
- {
- const int Offset = VertexIndex * 3;
- const FVector Delta(VertexDeltas[Offset], VertexDeltas[Offset+1], VertexDeltas[Offset+2]);
- MeanDelta += Delta;
- MinDelta = MinDelta.ComponentMin(Delta);
- MaxDelta = MaxDelta.ComponentMax(Delta);
- }
- const float ValidVertexCount = (float)NumVertices;
- if (NumVertices > 0)
- {
- MeanDelta /= (float)NumVertices;
- }
-
- // Update global mean.
- InOutCount += 1.0f;
- FVector TempDiff = MeanDelta - (FVector)InOutMeanVertexDelta;
- InOutMeanVertexDelta = InOutMeanVertexDelta + FVector(TempDiff / InOutCount);
-
- // Update global scale.
- TempDiff = MaxDelta - MinDelta;
- InOutVertexDeltaScale = InOutVertexDeltaScale.ComponentMax(TempDiff.GetAbs());
-}
-
-bool ULegacyVertexDeltaTrainingModel::ComputeVertexDeltaStatistics(uint32 LODIndex)
-{
- using namespace UE::LegacyVertexDeltaModel;
-
- FLegacyVertexDeltaEditorModel* VertexDeltaEditorModel = GetVertexDeltaEditorModel();
- ULegacyVertexDeltaModel* VertexDeltaModel = VertexDeltaEditorModel->GetVertexDeltaModel();
- if (!VertexDeltaEditorModel->GetResamplingInputOutputsNeeded())
- {
- return true;
- }
-
- FMLDeformerSampler* Sampler = VertexDeltaEditorModel->GetSampler();
- Sampler->SetVertexDeltaSpace(EVertexDeltaSpace::PreSkinning);
-
- // Show some dialog with progress.
- const FText Title(LOCTEXT("PreprocessTrainingDataMessage", "Calculating data statistics"));
- const uint32 AnimNumFrames = EditorModel->GetNumFramesForTraining();
- FScopedSlowTask Task((float)AnimNumFrames, Title);
- Task.MakeDialog(true);
-
- // Get the base actor data.
- FVector Mean = FVector::ZeroVector;
- FVector Scale = FVector::OneVector;
- float Count = 0.0f;
- const int32 FrameCount = VertexDeltaEditorModel->GetNumFramesForTraining();
- for (int32 FrameIndex = 0; FrameIndex < FrameCount; FrameIndex++)
- {
- // Calculate the deltas and update the mean and scale.
- Sampler->Sample(FrameIndex);
- UpdateVertexDeltaMeanAndScale(Sampler->GetVertexDeltas(), Mean, Scale, Count);
-
- // Forward the progress bar and check if we want to cancel.
- Task.EnterProgressFrame();
- if (Task.ShouldCancel())
- {
- return false;
- }
- }
-
- // Update the asset with calculated statistics.
- VertexDeltaModel->VertexDeltaMean = Mean;
- if (Count > 0.0f)
- {
- VertexDeltaModel->VertexDeltaScale = FVector::OneVector * Scale.GetMax();
- VertexDeltaEditorModel->SetResamplingInputOutputsNeeded(true);
- }
-
- return true;
-}
-
-bool ULegacyVertexDeltaTrainingModel::ComputeDeltasStatistics()
-{
- const ULegacyVertexDeltaModel* VertexDeltaModel = GetVertexDeltaModel();
- const float DeltaCutoffLength = VertexDeltaModel->GetDeltaCutoffLength();
- if (ComputeVertexDeltaStatistics(0))
- {
- VertexDeltaMean = VertexDeltaModel->VertexDeltaMean;
- VertexDeltaScale = VertexDeltaModel->VertexDeltaScale;
- return true;
- }
-
- return false;
-}
-
-#undef LOCTEXT_NAMESPACE
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModel.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModel.h
deleted file mode 100644
index 46cb23e29770..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModel.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerEditorModel.h"
-#include "MLDeformerGeomCacheSampler.h"
-#include "LegacyVertexDeltaModel.h"
-#include "MLDeformerEditorActor.h"
-#include "UObject/GCObject.h"
-
-class UMLDeformerAsset;
-class USkeletalMesh;
-class UGeometryCache;
-class ULegacyVertexDeltaModel;
-class ULegacyVertexDeltaModelVizSettings;
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- class FLegacyVertexDeltaEditorModelActor;
- class FLegacyVertexDeltaModelSampler;
-
- class LEGACYVERTEXDELTAMODELEDITOR_API FLegacyVertexDeltaEditorModel
- : public UE::MLDeformer::FMLDeformerEditorModel
- {
- public:
- // We need to implement this static MakeInstance method.
- static FMLDeformerEditorModel* MakeInstance();
-
- // FGCObject overrides.
- virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
- virtual FString GetReferencerName() const override { return TEXT("FLegacyVertexDeltaEditorModel"); }
- // ~END FGCObject overrides.
-
- // FMLDeformerEditorModel overrides.
- virtual FMLDeformerEditorActor* CreateEditorActor(const FMLDeformerEditorActor::FConstructSettings& Settings) const override;
- virtual FMLDeformerSampler* CreateSampler() const;
- virtual void CreateTrainingGroundTruthActor(UWorld* World) override;
- virtual void CreateTestGroundTruthActor(UWorld* World) override;
- virtual void OnPreTraining() override;
- virtual void OnPostTraining(ETrainingResult TrainingResult, bool bUsePartiallyTrainedWhenAborted) override;
- virtual void OnInputAssetsChanged() override;
- virtual int32 GetNumTrainingFrames() const override;
- virtual double GetTrainingTimeAtFrame(int32 FrameNumber) const override;
- virtual int32 GetTrainingFrameAtTime(double TimeInSeconds) const override;
- virtual void UpdateIsReadyForTrainingState() override;
- virtual ETrainingResult Train() override;
- virtual FString GetDefaultDeformerGraphAssetPath() const override;
- virtual FString GetHeatMapDeformerGraphPath() const override;
- virtual FString GetTrainedNetworkOnnxFile() const override;
- virtual void OnPostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
- // ~END FMLDeformerEditorModel overrides.
-
- // Some helpers that cast to this model's variants of some classes.
- ULegacyVertexDeltaModel* GetVertexDeltaModel() const { return Cast(Model); }
- ULegacyVertexDeltaModelVizSettings* GetVertexDeltaModelVizSettings() const;
- FLegacyVertexDeltaEditorModelActor* FindVertexDeltaModelEditorActor(int32 TypeID) const;
- FMLDeformerGeomCacheSampler* GetGeomCacheSampler() const { return static_cast(Sampler); }
-
- protected:
- void CreateGeomCacheActor(UWorld* World, int32 ActorID, const FName& Name, UGeometryCache* GeomCache, FLinearColor LabelColor, FLinearColor WireframeColor, const FText& LabelText, bool bIsTrainingActor);
-
- protected:
- FVector VertexDeltaMeanBackup = FVector::ZeroVector;
- FVector VertexDeltaScaleBackup = FVector::OneVector;
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModelActor.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModelActor.h
deleted file mode 100644
index 4e4c0bd114f9..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaEditorModelActor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "MLDeformerEditorActor.h"
-
-class UMLDeformerComponent;
-class UGeometryCacheComponent;
-
-namespace UE::LegacyVertexDeltaModel
-{
- using namespace UE::MLDeformer;
-
- class LEGACYVERTEXDELTAMODELEDITOR_API FLegacyVertexDeltaEditorModelActor
- : public FMLDeformerEditorActor
- {
- public:
- FLegacyVertexDeltaEditorModelActor(const FConstructSettings& Settings);
- virtual ~FLegacyVertexDeltaEditorModelActor() override;
-
- void SetGeometryCacheComponent(UGeometryCacheComponent* Component) { GeomCacheComponent = Component; }
- UGeometryCacheComponent* GetGeometryCacheComponent() const { return GeomCacheComponent; }
-
- // FMLDeformerEditorActor overrides.
- virtual void SetVisibility(bool bIsVisible) override;
- virtual bool IsVisible() const override;
- virtual void SetPlayPosition(float TimeInSeconds, bool bAutoPause=true) override;
- virtual float GetPlayPosition() const override;
- virtual void SetPlaySpeed(float PlaySpeed) override;
- virtual void Pause(bool bPaused) override;
- virtual FBox GetBoundingBox() const override;
- // ~END FMLDeformerEditorActor overrides.
-
- protected:
- /** The geometry cache component (can be nullptr). */
- TObjectPtr GeomCacheComponent = nullptr;
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelDetails.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelDetails.h
deleted file mode 100644
index ca1214e6da90..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelDetails.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerModelDetails.h"
-#include "IDetailCustomization.h"
-#include "AssetRegistry/AssetData.h"
-#include "Input/Reply.h"
-
-class IDetailLayoutBuilder;
-class ULegacyVertexDeltaModel;
-
-namespace UE::MLDeformer
-{
- class FMLDeformerEditorModel;
-}
-
-namespace UE::LegacyVertexDeltaModel
-{
- class FLegacyVertexDeltaEditorModel;
-
- class LEGACYVERTEXDELTAMODELEDITOR_API FLegacyVertexDeltaModelDetails final
- : public UE::MLDeformer::FMLDeformerModelDetails
- {
- public:
- /** Makes a new instance of this detail layout class for a specific detail view requesting it. */
- static TSharedRef MakeInstance();
-
- // ILayoutDetails overrides.
- void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
- // ~END ILayoutDetails overrides.
-
- // FMLDeformerModelDetails overrides.
- bool UpdateMemberPointers(const TArray>& Objects) override;
- void AddTargetMesh() override;
- void AddAnimSequenceErrors() override;
- // ~END FMLDeformerModelDetails overrides.
-
- protected:
- TObjectPtr VertexModel = nullptr;
- FLegacyVertexDeltaEditorModel* VertexEditorModel = nullptr;
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelEditorModule.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelEditorModule.h
deleted file mode 100644
index 8e13c4b47082..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelEditorModule.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "Modules/ModuleInterface.h"
-
-namespace UE::LegacyVertexDeltaModel
-{
- class LEGACYVERTEXDELTAMODELEDITOR_API FLegacyVertexDeltaModelEditorModule
- : public IModuleInterface
- {
- public:
- // IModuleInterface overrides.
- void StartupModule() override;
- void ShutdownModule() override;
- // ~END IModuleInterface overrides.
- };
-} // namespace UE::LegacyVertexDeltaModel
\ No newline at end of file
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelVizSettingsDetails.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelVizSettingsDetails.h
deleted file mode 100644
index e0277ffd43eb..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaModelVizSettingsDetails.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerVizSettingsDetails.h"
-#include "IDetailCustomization.h"
-#include "AssetRegistry/AssetData.h"
-#include "PropertyHandle.h"
-
-class IDetailLayoutBuilder;
-class USkeleton;
-class ULegacyVertexDeltaModel;
-class ULegacyVertexDeltaModelVizSettings;
-
-namespace UE::LegacyVertexDeltaModel
-{
- class LEGACYVERTEXDELTAMODELEDITOR_API FLegacyVertexDeltaModelVizSettingsDetails final
- : public UE::MLDeformer::FMLDeformerVizSettingsDetails
- {
- public:
- /** Makes a new instance of this detail layout class for a specific detail view requesting it. */
- static TSharedRef MakeInstance();
-
- // FMLDeformerVizSettingsDetails overrides.
- bool UpdateMemberPointers(const TArray>& Objects) override;
- void AddGroundTruth() override;
- // ~END FMLDeformerVizSettingsDetails overrides.
-
- protected:
- TObjectPtr VertexDeltaModel = nullptr;
- TObjectPtr VertexDeltaVizSettings = nullptr;
- };
-} // namespace UE::LegacyVertexDeltaModel
diff --git a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaTrainingModel.h b/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaTrainingModel.h
deleted file mode 100644
index 93f67f2a7dba..000000000000
--- a/Engine/Plugins/Experimental/MLDeformer/LegacyVertexDeltaModel/Source/LegacyVertexDeltaModelEditor/Public/LegacyVertexDeltaTrainingModel.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include "CoreMinimal.h"
-#include "MLDeformerTrainingModel.h"
-#include "LegacyVertexDeltaTrainingModel.generated.h"
-
-namespace UE::LegacyVertexDeltaModel
-{
- class FLegacyVertexDeltaEditorModel;
-}
-
-class ULegacyVertexDeltaModel;
-
-UCLASS(Blueprintable)
-class LEGACYVERTEXDELTAMODELEDITOR_API ULegacyVertexDeltaTrainingModel
- : public UMLDeformerTrainingModel
-{
- GENERATED_BODY()
-
-public:
- /** Main training function, with implementation in python. */
- UFUNCTION(BlueprintImplementableEvent, Category = "Python")
- int32 Train() const;
-
- /** Compute delta statistics for the whole dataset. */
- UFUNCTION(BlueprintCallable, Category = "Training Data")
- bool ComputeDeltasStatistics();
-
- ULegacyVertexDeltaModel* GetVertexDeltaModel() const;
- UE::LegacyVertexDeltaModel::FLegacyVertexDeltaEditorModel* GetVertexDeltaEditorModel() const;
-
-protected:
- bool ComputeVertexDeltaStatistics(uint32 LODIndex);
- void UpdateVertexDeltaMeanAndScale(const TArray& VertexDeltas, FVector& InOutMeanVertexDelta, FVector& InOutVertexDeltaScale, float& InOutCount);
-
-public:
- // Mean delta computed over the entire dataset.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Training Data")
- FVector VertexDeltaMean = FVector::ZeroVector;
-
- // Vertex delta scale computed over the entire dataset.
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Training Data")
- FVector VertexDeltaScale = FVector::OneVector;
-};