2019-12-27 09:26:59 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
#include "ModelingComponentsModule.h"
|
2022-06-15 16:49:13 -04:00
|
|
|
#include "Components/BaseDynamicMeshComponent.h"
|
2022-06-16 00:49:39 -04:00
|
|
|
#include "Materials/Material.h"
|
2022-12-16 16:24:02 -05:00
|
|
|
#include "Misc/CoreDelegates.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "FModelingComponentsModule"
|
|
|
|
|
|
|
|
|
|
void FModelingComponentsModule::StartupModule()
|
|
|
|
|
{
|
2022-06-15 16:49:13 -04:00
|
|
|
FCoreDelegates::OnPostEngineInit.AddRaw(this, &FModelingComponentsModule::OnPostEngineInit);
|
|
|
|
|
|
|
|
|
|
// Ensure that the GeometryFramework module is loaded so that UBaseDynamicMeshComponent materials are configured
|
|
|
|
|
FModuleManager::Get().LoadModule(TEXT("GeometryFramework"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FModelingComponentsModule::OnPostEngineInit()
|
|
|
|
|
{
|
|
|
|
|
// Replace the standard UBaseDynamicMeshComponent vertex color material with something higher quality.
|
|
|
|
|
// This is done in ModelingComponents module (ie part of MeshModelingToolset plugin) to avoid having to
|
|
|
|
|
// make this Material a special "engine material", which has various undesirable implication
|
|
|
|
|
UMaterial* VertexColorMaterial = LoadObject<UMaterial>(nullptr, TEXT("/MeshModelingToolset/Materials/M_DynamicMeshComponentVtxColor"));
|
|
|
|
|
if (ensure(VertexColorMaterial))
|
|
|
|
|
{
|
|
|
|
|
UBaseDynamicMeshComponent::SetDefaultVertexColorMaterial(VertexColorMaterial);
|
|
|
|
|
}
|
2019-10-01 20:41:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FModelingComponentsModule::ShutdownModule()
|
|
|
|
|
{
|
2022-06-15 16:49:13 -04:00
|
|
|
FCoreDelegates::OnPostEngineInit.RemoveAll(this);
|
2019-10-01 20:41:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FModelingComponentsModule, ModelingComponents)
|