Download

[Plugin] Can I customize detail panel for UStaticMesh assets?

Hi,
I’m trying to customize detail panel by implementing IDetailCustomization assets, like this:



auto& propertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
propertyModule.RegisterCustomClassLayout(
   UStaticMesh::StaticClass()->GetFName(),
     FOnGetDetailCustomizationInstance::CreateStatic(&FStaticMeshCustomizations::MakeInstance)
);
propertyModule.NotifyCustomizationModuleChanged();


but it’s not working at all, MakeInstance is never even called. Any pointers why that is the case || how to fix it?

It isn’t called because you never told it to be called:



FLevelEditorModule &LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
{

    FPropertyEditorModule &PropertyEditorModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
    PropertyEditorModule.RegisterCustomPropertyTypeLayout("myCustomStructClass",FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FmyCustomDetails::MakeInstance));

}


Thank you for your answer! Can you tell me what is key significant difference between two code samples? Other than customization type difference ie: class layout to property layout that is.

I’m totally missing something here, I have trouble translating your Property Layout Customization to Detail Panel Customization (for UStaticMesh asset)

I assume you want your customization to show up within the Static Mesh editor, since that’s really the only place that the properties of a UStaticMesh itself get displayed?
Well if so, it won’t work. The mesh editor registers its own customization for its details panel, which you can’t override.

Seems a bit of a strange thing to want to customize, what are you trying to achieve?

Oh no. I was suspecting this from reading engine source code, “StaticMeshDetailsView-RegisterInstancedCustomPropertyLayout” specifically, that this static mesh editor seems to deliberately evade customization for some undocumented reason.

Well, I’m creating a plugin to edit FStaticMeshSourceModel data (enabling lod section/draw call optimizations). It works in separate tab now but 3d artists seems to strongly expect to find this tool inside default Static Mesh Editor itself. I can’t blame them, it makes sense to look there first.

I aim just to add at least one button under every LOD# category (or LOD#|Sections|Section #) to start my optimization functions from there ( “Merge Similar Sections”, “Percent Sections” etc.). So far I added toolbar extension to spawn new tab but nesting some of these functions inside default LOD UI would make it more accessible i think. Pity its inaccessible for plugins apparently

Yep, the asset editors are the least extensible parts of the editor. You can sometimes find some menu/toolbar hooks to add extensions at, but that’s about it. Realistically for something like this, you’ll have to make do with a separate, dedicated editor.