2021-04-29 18:12:32 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "GeometryProcessingInterfacesModule.h"
|
|
|
|
|
#include "CoreGlobals.h"
|
|
|
|
|
#include "Features/IModularFeatures.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
|
|
|
|
|
|
#include "GeometryProcessingInterfaces/ApproximateActors.h"
|
2023-02-26 21:00:47 -05:00
|
|
|
#include "GeometryProcessingInterfaces/CombineMeshInstances.h"
|
2023-06-15 10:37:22 -04:00
|
|
|
#include "GeometryProcessingInterfaces/MeshAutoUV.h"
|
2021-04-29 18:12:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FGeometryProcessingInterfacesModule, GeometryProcessingInterfaces);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FGeometryProcessingInterfacesModule::StartupModule()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FGeometryProcessingInterfacesModule::ShutdownModule()
|
|
|
|
|
{
|
|
|
|
|
ApproximateActors = nullptr;
|
2023-02-26 21:00:47 -05:00
|
|
|
CombineMeshInstances = nullptr;
|
2023-06-15 10:37:22 -04:00
|
|
|
MeshAutoUV = nullptr;
|
2021-04-29 18:12:32 -04:00
|
|
|
}
|
|
|
|
|
|
2023-06-15 10:37:22 -04:00
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
template <typename TModularFeatureInterface>
|
|
|
|
|
TModularFeatureInterface* GetModularFeatureImplementation()
|
|
|
|
|
{
|
|
|
|
|
TArray<TModularFeatureInterface*> AvailableImplementations =
|
|
|
|
|
IModularFeatures::Get().GetModularFeatureImplementations<TModularFeatureInterface>(TModularFeatureInterface::GetModularFeatureName());
|
|
|
|
|
|
|
|
|
|
return (AvailableImplementations.Num() > 0) ? AvailableImplementations[0] : nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-29 18:12:32 -04:00
|
|
|
|
|
|
|
|
IGeometryProcessing_ApproximateActors* FGeometryProcessingInterfacesModule::GetApproximateActorsImplementation()
|
|
|
|
|
{
|
|
|
|
|
if (ApproximateActors == nullptr)
|
|
|
|
|
{
|
2023-06-15 10:37:22 -04:00
|
|
|
ApproximateActors = GetModularFeatureImplementation<IGeometryProcessing_ApproximateActors>();
|
2021-04-29 18:12:32 -04:00
|
|
|
}
|
|
|
|
|
return ApproximateActors;
|
|
|
|
|
}
|
2023-02-26 21:00:47 -05:00
|
|
|
IGeometryProcessing_CombineMeshInstances* FGeometryProcessingInterfacesModule::GetCombineMeshInstancesImplementation()
|
|
|
|
|
{
|
2023-03-07 15:37:16 -05:00
|
|
|
if (CombineMeshInstances == nullptr)
|
2023-02-26 21:00:47 -05:00
|
|
|
{
|
2023-06-15 10:37:22 -04:00
|
|
|
CombineMeshInstances = GetModularFeatureImplementation<IGeometryProcessing_CombineMeshInstances>();
|
2023-02-26 21:00:47 -05:00
|
|
|
}
|
|
|
|
|
return CombineMeshInstances;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-15 10:37:22 -04:00
|
|
|
IGeometryProcessing_MeshAutoUV* FGeometryProcessingInterfacesModule::GetMeshAutoUVImplementation()
|
|
|
|
|
{
|
|
|
|
|
if (MeshAutoUV == nullptr)
|
|
|
|
|
{
|
|
|
|
|
MeshAutoUV = GetModularFeatureImplementation<IGeometryProcessing_MeshAutoUV>();
|
|
|
|
|
}
|
|
|
|
|
return MeshAutoUV;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-26 21:00:47 -05:00
|
|
|
|