void FSpriteDetailsCustomization::GenerateAdditionalTextureWidget(TSharedRef<IPropertyHandle> PropertyHandle, int32 ArrayIndex, IDetailChildrenBuilder& ChildrenBuilder)
{
	IDetailPropertyRow& TextureRow = ChildrenBuilder.AddChildProperty(PropertyHandle);

	FText ExtraText;
	if (FText* pExtraText = AdditionalTextureLabels.Find(ArrayIndex))
	{
		ExtraText = *pExtraText;
	}

	FNumberFormattingOptions NoCommas;
	NoCommas.UseGrouping = false;
	const FText SlotDesc = FText::Format(LOCTEXT("AdditionalTextureSlotIndex", "Slot #{0}"), FText::AsNumber(ArrayIndex, &NoCommas));

	TextureRow.DisplayName(SlotDesc);

	TextureRow.ShowPropertyButtons(false);

	TextureRow.CustomWidget(false)
		.NameContent()
		[
			CreateTextureNameWidget(PropertyHandle, ExtraText)
		]
		.ValueContent()
		.MaxDesiredWidth(TOptional<float>())
		[
			PropertyHandle->CreatePropertyValueWidget()
		];
}
void FReplaceVectorWithLinearColorBuilder::GenerateHeaderRowContent(FDetailWidgetRow& NodeRow)
{
	// Only generate a header row if the handle has a valid UProperty.
	// Note that it's possible for the Property to be NULL if the property node is an FObjectPropertyNode - however we still want to create children in this case.
	if (PropertyHandle->GetProperty() != nullptr)
	{
		NodeRow.NameContent()
			[
				PropertyHandle->CreatePropertyNameWidget()
			];

		if (bIsVectorProperty)
		{
			// Customization - make FVector look like an FLinearColor
			NodeRow.ValueContent()
				.MinDesiredWidth(250.0f)
				.MaxDesiredWidth(250.0f)
				[
					CreateColorWidget(PropertyHandle)
				];
		}
		else
		{
			// Otherwise, use the default property widget
			NodeRow.ValueContent()
				.MinDesiredWidth(1)
				.MaxDesiredWidth(4096)
				[
					PropertyHandle->CreatePropertyValueWidget()
				];
		}
	}
}
void FVehicleTransmissionDataCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	HeaderRow.
	NameContent()
	[
		StructPropertyHandle->CreatePropertyNameWidget()
	]
	.ValueContent()
		[
			StructPropertyHandle->CreatePropertyValueWidget()
		];
}
void FRawDistributionVectorStructCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	const bool bDisplayResetToDefault = false;
	const FText DisplayNameOverride = FText::GetEmpty();
	const FText DisplayToolTipOverride = FText::GetEmpty();

	HeaderRow
	.NameContent()
	[
		StructPropertyHandle->CreatePropertyNameWidget(DisplayNameOverride, DisplayToolTipOverride, bDisplayResetToDefault)
	]
	.ValueContent()
	.MinDesiredWidth(1)
	.MaxDesiredWidth(4096)
	[
		StructPropertyHandle->CreatePropertyValueWidget()
	];
}
//Helper function so we can make neutral and reverse look the same as forward gears
void FVehicleTransmissionDataCustomization::CreateGearUIHelper(FDetailWidgetRow & GearsSetup, FText Label, TSharedRef<IPropertyHandle> GearHandle, EGearType GearType)
{
	uint32 NumChildren = 0;
	GearHandle->GetNumChildren(NumChildren);	//we use num of children to determine if we are dealing with a full gear that has ratio, down, up - or just a single value

	TSharedRef<SWidget> RatioWidget = (NumChildren > 1 ? GearHandle->GetChildHandle("Ratio")->CreatePropertyValueWidget() : GearHandle->CreatePropertyValueWidget());
	TSharedRef<SWidget> DownRatioWidget = (NumChildren > 1 ? GearHandle->GetChildHandle("DownRatio")->CreatePropertyValueWidget() : GearHandle->CreatePropertyValueWidget());
	TSharedRef<SWidget> UpRatioWidget = (NumChildren > 1 ? GearHandle->GetChildHandle("UpRatio")->CreatePropertyValueWidget() : GearHandle->CreatePropertyValueWidget());
	
	RatioWidget->SetEnabled(GearType != NeutralGear);
	switch (GearType)
	{
	case ForwardGear:
		{
			DownRatioWidget->SetEnabled(TAttribute<bool>(this, &FVehicleTransmissionDataCustomization::IsAutomaticEnabled));
			UpRatioWidget->SetEnabled(TAttribute<bool>(this, &FVehicleTransmissionDataCustomization::IsAutomaticEnabled));
			break;
		}
	case ReverseGear:
		{
			DownRatioWidget->SetEnabled(false);
			UpRatioWidget->SetEnabled(false);
			break;
		}
	case NeutralGear:
		{
			DownRatioWidget->SetEnabled(false);
			UpRatioWidget->SetEnabled(TAttribute<bool>(this, &FVehicleTransmissionDataCustomization::IsAutomaticEnabled));
			break;
		}
	}

	TSharedRef<SWidget> RemoveWidget = PropertyCustomizationHelpers::MakeDeleteButton(FSimpleDelegate::CreateSP(this, &FVehicleTransmissionDataCustomization::RemoveGear, GearHandle), LOCTEXT("RemoveGearToolTip", "Removes gear"));
	RemoveWidget->SetEnabled(NumChildren > 1);
	
	GearsSetup
	.NameContent()
	[
		SNew(STextBlock)
		.Text(Label)
		.Font(IDetailLayoutBuilder::GetDetailFont())
	]
	.ValueContent()
		.MaxDesiredWidth(GearColumnsWidth)
		.MinDesiredWidth(GearColumnsWidth)
		[
			SNew(SHorizontalBox)
			+ SHorizontalBox::Slot()
			.FillWidth(0.3333f)
			[
				RatioWidget
			]
			+ SHorizontalBox::Slot()
			.FillWidth(0.3333f)
			.Padding(4.f)
			[
				DownRatioWidget
			]

			+ SHorizontalBox::Slot()
			.FillWidth(0.3333f)
			.Padding(4.f)
			[
				UpRatioWidget
			]

			+ SHorizontalBox::Slot()
			.Padding(4.f)
			.AutoWidth()
			[
				RemoveWidget
			]
		];
}