How can I customize the details panel for a class?

According to this guide, the first thing I need to do is create a class that inherits from ILayoutDetails. Which does not exist anywhere in the code. There is no information on this class in the wiki, forums, or google search. It also says: “(more examples are located in DetailCustomizations.cpp)”. This file exists nowhere in the entire solution.

Rama’s Slate, Hello guide does explain how to get slate in-game, but setting slate widgets via BeginPlay() won’t work for the editor, and setting slate widgets in a constructor crashes the engine.

My end goal here is to have a 2d matrix of boolean values that I can tick, with a scalable number of tickboxes in each dimension, and then set a property based on the selected tickboxes.

It’s a makeshift bitmask, which I’ve implemented in C++ but it can currently only be set via a series of blueprint functions. I want to have some bitmask-setting functionality in the editor.

It’s called a Details Customization. You can find many examples in the code base by searching for *Customization.h

IDetailCustomization is the interface you need to implement. It has a single method CustomizeDetails that will pass you an IDetailLayoutBuilder. The latter has lots of helper methods for various kinds of things.

Thank you for the quick response.

I’ve been at this all day and still can’t figure out how to access the IDetailLayoutBuilder’s functions. I’ve included the “Editor/PropertyEditor/Public/IDetailCustomization.h” file to access the builder, but it has no members nor functions available to it.

Maybe there’s a part of the UE4 C++ API that I don’t know about. I’m pretty lost as to what to do here. The furthest I have gotten while compiling:

.h:

#pragma once
#include "Combat/Team.h"

#include "Editor/PropertyEditor/Public/IDetailCustomization.h"
DECLARE_DELEGATE(FShowTeamProperties);

class TeamClassProperties : public IDetailCustomization
{

public:
	virtual void CustomizeDetails(IDetailLayoutBuilder& layout) override;

};

.cpp:

#include "Traveler.h"
#include "TeamClassProperties.h"
void TeamClassProperties::CustomizeDetails(IDetailLayoutBuilder& layout)
{

}

the “layout” parameter has nothing usable.

So for example, including the file: “Editor/PropertyEditor/Public/DetailLayoutBuilder.h”, which gives access to IDetailLayoutBuilder’s functions, causes a compiler error C2653: ‘FEditorStyle’ is not a class or namespace name.

I’ve included the modules mentioned in the documentation for both FEditorStyle s and IDetailLayoutBuilder s, but the error persists, and I don’t think modifying the engine code to include the files it references is what I need to do.

Yeah, the includes are a bit of a mess. You will have to include a bunch of header files by head as the required dependencies are not being pulled in automatically. We will clean that up, eventually.

You also need to add some modules to your PrivateDependencyModuleNames array in the Build.cs of your project, such as PropertyEditor and EditorStyle.

I think it would be best if you take a look at the existing implementations - preferably not the ones in the DetailCustomizations module, but those in plug-ins. They are pretty self-contained and show you what you need to include.

Also, the general process is this:

  1. Make a class that implements IDetailCustomization or IPropertyTypeCustomization
  2. Register your class in your module’s StartupModule() method
  3. Unregister your class in your module’s ShutdownModule() method

Once your class is registered for a certain UClass or UStruct type, the details panel will call the corresponding methods on your class whenever such a type needs to be visualized. For example, it may call CustomizeDetails() on your class customization, and it passes in a DetailBuilder, which you can use to create custom widgets, etc.

Here are some examples:

  • MediaPlayerEditor plug-in: look at FMediaPlayerEditorModule::RegisterCustomizations() and FMediaPlayerEditorModule::UnregisterCustomizations() for un-/registration, and FMediaPlayerCustomization for the actual customization of a UClass (UMediaPlayer in this case)

  • for a UStruct customization example check out FLevelSequencePlaybackSettingsCustomization in the LevelSequenceEditor plug-in. Notice that it implements the IPropertyTypeCustomization instead, but the process is very similar. The struct being customized is FLevelSequencePlaybackSettings.

I figured out a few problems:
-DetailCustomizations.cpp actually DOES exist, contrary to what i posted in my question. Looking at it in combination with your answers is making this all much clearer.
-I wasn’t aware of how Modules worked, but after making my own(which was useful since this editor is specific only to my game), registering things in startup and shutdown for the modules makes sense, as well as the RegisterCustomization()s you were referring to.

Anyway, I made my own module, and then set up the correct registrations with it, and now it draws a thing in the detail panel! Thank you for your help.

I realize this post is about a year old now, but it might be worthwhile updating the documentation here:
[Details Panel Customization in Unreal Engine | Unreal Engine 5.2 Documentation][1]

It describes customizing the details panel similar to the OP, using ILayoutDetails, and has an (Unreal Engine 4.9) tag on it.

It looks like someone started a more current guide here:
[A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums][2]

But I would like to know how to do the things described in the pictures of the original documentation using IDetailCustomization rather than ILayoutDetails.
For example, is there an equivalent for Category.BeginLine() which allows you to stack properties horizontally on a single line? as shown here…

https://docs.unrealengine.com/latest/images/Programming/Slate/DetailsCustomization/multibox_layout_horizontal.jpg

Thanks!