x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.8
Tags:
more ▼

asked Oct 01 '15 at 11:10 PM in C++ Programming

avatar image

Willtheoct
33 13 14 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Oct 01 '15 at 11:14 PM

avatar image Willtheoct Oct 02 '15 at 04:45 AM

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.

avatar image Willtheoct Oct 02 '15 at 06:30 PM

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.

avatar image gmpreussner STAFF Oct 02 '15 at 06:47 PM

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.

avatar image gmpreussner STAFF Oct 02 '15 at 06:51 PM

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.

avatar image gmpreussner STAFF Oct 02 '15 at 06:54 PM

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.

avatar image Willtheoct Oct 03 '15 at 03:37 AM

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.

avatar image Striblezz Oct 07 '16 at 12:47 AM

I realize this post is about a year old now, but it might be worthwhile updating the documentation here: https://docs.unrealengine.com/latest/INT/Programming/Slate/DetailsCustomization/

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: https://wiki.unrealengine.com/Customizing_detail_panels

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... LightingCategory.BeginLine example

Thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question