Customize detail panel default

Hey,

So I am customizing my struct’s details panel but there is one variable that I want to appear as normal/default (as if I didn’t override CustomizeHeader).

The variable TWeakObjectPtr Doorway is the variable that should appear as default, with the object picker and everything.

How do I make it default?
I know that TWeakObjectPtr uses SDetailSingleItemRow widget and FDetailItemNode creates that widget.

Here is some code if you like to see:

USTRUCT()
struct FDoorwayTeleport
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere)
	TWeakObjectPtr<class ADoorway> Doorway; // <--------- This should appear as normal/default

	UPROPERTY(EditAnywhere)
	FString OtherLevelName; // I want to customize these

	UPROPERTY(EditAnywhere)
	FString OtherLevelDoorwayID; // I want to customize these

	FDoorwayTeleport();
};

void FDoorwayTeleportCustomization::CustomizeHeader(TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	uint32 NumChildren;
	StructPropertyHandle->GetNumChildren(NumChildren);

	for (uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex)
	{
		const TSharedRef< IPropertyHandle > ChildHandle = StructPropertyHandle->GetChildHandle(ChildIndex).ToSharedRef();

		if (ChildHandle->GetProperty()->GetName() == TEXT("Doorway"))
		{
			DoorwayHandle = ChildHandle;
		}
	}

    // How do I pass DoorwayHandle as default?
}

I haven’t had to do this with a UStruct, but with something that is UObject derived, you can override PostInitProperties() to set a default value if it wasn’t set by the user

Are you intending to display it inline in the header, rather than in the drop down child area? In the child area it’s very easy, just call IDetailChildrenBuilder::AddChildProperty(DoorwayHandle).

If you need it in the header, it’s not clear how exactly you want it to be positioned, but I guess something like this:

HeaderRow
  .NameContent()
  [
    StructPropertyHandle->CreatePropertyNameWidget()
  ]
  .ValueContent()
  [
    // You could use CreatePropertyNameWidget() here too and put them both into a box
    DoorwayHandle->CreatePropertyValueWidget()
  ];

If you need more control, look at SProperty. There’s some info here.

That worked! Thank you