How to add buttons to details panel and have them communicate with blueprint

How to add buttons in details panel for actor and have them fire off events in blueprint?


Basically i want to add selectable buttons exactly the same as there is when you pick if actor is static or moving/dynamic

Im making modular construction blueprint, so I want to add 3 of those buttons so i can either choose small, medium or large mesh, and then i want some blueprint functionality based on which option is selected, so how do i add these buttons to details panel for actor blueprint?

i figured it out by using enums… but i dont know how to change from dropdown to this type of selector

44339-e1.jpg

44340-e2.jpg

im curious about this as well!

Try look into

Path_To_UE4\4.10\Engine\Source\Editor\DetailCustomizations\Private\MobilityCustomization.cpp
From line 74 to line 144.

There is a slot using “Property.ToggleButton”, I’ll post code snippet below ↓↓↓

// Stationary Mobility
	if ( bShowStationary )
	{
		ButtonOptionsPanel->AddSlot(ColumnIndex, 0)
		[
			SNew(SCheckBox)
			.IsChecked(this, &FMobilityCustomization::IsMobilityActive, EComponentMobility::Stationary)
			.Style(FEditorStyle::Get(), ( ColumnIndex == 0 ) ? "Property.ToggleButton.Start" : "Property.ToggleButton.Middle")
			.OnCheckStateChanged(this, &FMobilityCustomization::OnMobilityChanged, EComponentMobility::Stationary)
			.ToolTipText(LOCTEXT("Mobility_Stationary_Tooltip", "A stationary light will only have its shadowing and bounced lighting from static geometry baked by Lightmass, all other lighting will be dynamic.  It can change color and intensity in game.\n● Can't Move\n● Allows Partial Baked Lighting\n● Dynamic Shadows"))
			[
				SNew(SHorizontalBox)

				+ SHorizontalBox::Slot()
				.AutoWidth()
				.VAlign(VAlign_Center)
				.Padding(3, 2)
				[
					SNew(SImage)
					.Image(FEditorStyle::GetBrush("Mobility.Stationary"))
				]

				+ SHorizontalBox::Slot()
				.FillWidth(1.0f)
				.VAlign(VAlign_Center)
				.HAlign(HAlign_Center)
				.Padding(6, 2)
				[
					SNew(STextBlock)
					.Text(LOCTEXT("Stationary", "Stationary"))
					.Font(IDetailLayoutBuilder::GetDetailFont())
					.ColorAndOpacity(this, &FMobilityCustomization::GetMobilityTextColor, EComponentMobility::Stationary)
				]
			]
		];

		ColumnIndex++;
	}

	// Movable Mobility
	ButtonOptionsPanel->AddSlot(ColumnIndex, 0)
	[
		SNew(SCheckBox)
		.IsChecked(this, &FMobilityCustomization::IsMobilityActive, EComponentMobility::Movable)
		.Style(FEditorStyle::Get(), ( ColumnIndex == 0 ) ? "Property.ToggleButton" : "Property.ToggleButton.End")
		.OnCheckStateChanged(this, &FMobilityCustomization::OnMobilityChanged, EComponentMobility::Movable)
		.ToolTipText(LOCTEXT("Mobility_Movable_Tooltip", "Movable objects can be moved and changed in game.\n● Totally Dynamic\n● Allows Dynamic Shadows\n● Slowest Rendering"))
		[
			SNew(SHorizontalBox)

			+ SHorizontalBox::Slot()
			.AutoWidth()
			.VAlign(VAlign_Center)
			.Padding(3, 2)
			[
				SNew(SImage)
				.Image(FEditorStyle::GetBrush("Mobility.Movable"))
			]

			+ SHorizontalBox::Slot()
			.FillWidth(1.0f)
			.VAlign(VAlign_Center)
			.HAlign(HAlign_Center)
			.Padding(6, 2)
			[
				SNew(STextBlock)
				.Text(LOCTEXT("Movable", "Movable"))
				.Font(IDetailLayoutBuilder::GetDetailFont())
				.ColorAndOpacity(this, &FMobilityCustomization::GetMobilityTextColor, EComponentMobility::Movable)
			]
		]
	];

And a hint for next problem you may encounter:
Since UE4 is now open source, just use a proper keyword search entire project.
In this case, I use “Movable” ← with quotation marks. This is what I get:(Same goes to XCODE)

And in case you don’t know what is that “slot” means, here is a link for you: