I am currently working on customizing the details panel for the Static Mesh editor with the aim to trigger some functionality (currently only logging) when pressing a button in Unreal Engine 4.27. But editing this particular details panel is proving to be more difficult than expected.
I was able to successfully add the button to the StaticMeshActor details panel using either category “Materials” or “StaticMesh” as can be seen in the image and code below.
void FMeshHoleFixerModule::StartupModule()
{
// Register details customization
{
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomClassLayout("StaticMeshActor", FOnGetDetailCustomizationInstance::CreateStatic(&FStaticMeshDetailsCustomization::MakeInstance));
PropertyModule.NotifyCustomizationModuleChanged();
}
}
TSharedRef<IDetailCustomization> FStaticMeshDetailsCustomization::MakeInstance()
{
return MakeShareable(new FStaticMeshDetailsCustomization);
}
void FStaticMeshDetailsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
IDetailCategoryBuilder& CategoryBuilder = DetailBuilder.EditCategory("Materials");
CategoryBuilder.AddCustomRow(FText::FromString("My Button"))
.ValueContent()
[
SNew(SButton)
.Text(FText::FromString("Click Me"))
.OnClicked(this, &FStaticMeshDetailsCustomization::OnMyButtonClick)
];
}
FReply FStaticMeshDetailsCustomization::OnMyButtonClick()
{
UE_LOG(LogTemp, Warning, TEXT("Button Clicked!"));
return FReply::Handled();
}
I have however been unable to add this button to any of the categories of the Static Mesh editor details panel. I can’t find any documentation suggesting which ClassName to pass into RegisterCustomClassLayout or which CategoryName to pass into EditCategory.
Has anyone done this before and know how this can be achieved?
Preferably, I want the button to be added to the various LOD categories (i.e. LOD 0, LOD 1 etc.) just below Reduction Settings.