I’m trying to figure out how to edit the “section” a custom property category falls within the details panel in editor. At the moment, custom categories only fall under the “all” section. I’d like to add a new section so I can quickly jump to custom properties.
Change UPROPERTY’s Category:
UPROPERTY(Category="Section Name")
Thank you for the reply, but I’m referring to the sections listed above the property list (All, General, Actor, Animation, LOD, etc). The circled “Config” is an example of one of my custom categories. I’m looking to create a section that only includes my custom categories so I can quickly find my editable/visible variables at runtime.
I think what I’m referring to is called sections… when I click the gear icon and uncheck “show sections” those buttons go away.
Great question!
What I found is:
Creating Section
File: Engine\Source\Editor\DetailCustomizations\Private\DetailCustomizations.cpp
FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>(PropertyEditor);
// Actor
{
{
TSharedRef<FPropertySection> Section = PropertyModule.FindOrCreateSection("Actor", "Actor", LOCTEXT("Actor", "Actor"));
Section->AddCategory("Actor");
}
{
TSharedRef<FPropertySection> Section = PropertyModule.FindOrCreateSection("Actor", "Misc", LOCTEXT("Misc", "Misc"));
Section->AddCategory("Cooking");
Section->AddCategory("Input");
Section->AddCategory("Replication");
}
{
TSharedRef<FPropertySection> Section = PropertyModule.FindOrCreateSection("Actor", "Streaming", LOCTEXT("Streaming", "Streaming"));
Section->AddCategory("World Partition");
Section->AddCategory("HLOD");
}
}
Using:
FPropertyEditorModule
https://docs.unrealengine.com/4.26/en-US/API/Editor/PropertyEditor/FPropertyEditorModule/
I’ve never used this module, but I hope it helps you in some way
YES!!! That did the trick. Thanks for the help!
For reference, here’s the relevant code and result (I dumped it in my game mode constructor to test it out… probably should go somewhere more appropriate, but it works for now).
static const FName PropertyEditor("PropertyEditor");
FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>(PropertyEditor);
#define LOCTEXT_NAMESPACE "PropertySection"
TSharedRef<FPropertySection> Section = PropertyModule.FindOrCreateSection("Object", "GM", LOCTEXT("GM", "GM"));
Section->AddCategory("Config");
Section->AddCategory("GM");
#undef LOCTEXT_NAMESPACE
Thank you so much, this is exactly what I was looking for.
Just one question tho, about those properties you’re passing in the function:
PropertyModule.FindOrCreateSection("Object", "GM", LOCTEXT("GM", "GM"));
“Object” → ClassName = The class you want this section to show up in the details panel (UObject in this case)
“GM” → Section Name = Unique name for the new section
LOCTEXT(“GM”, “GM”) = DisplayName → DisplayName on the details panel
So, if I want the new section to show up in Pawn derived classes only, I should use:
PropertyModule.FindOrCreateSection("Pawn", "GM", LOCTEXT("GM", "GM"));
The question is, if I want to select more than one class, which is the best solution?
Just adding a new “FindOrCreateSection” function for each class?
PropertyModule.FindOrCreateSection(“Pawn”, “GM”, LOCTEXT(“GM”, “GM”));
PropertyModule.FindOrCreateSection(“MyClass1”, “GM”, LOCTEXT(“GM”, “GM”));
PropertyModule.FindOrCreateSection(“MyClass2”, “GM”, LOCTEXT(“GM”, “GM”));
Thanks!