123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- /*******************************************************************************
- The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
- Technology released in source code form as part of the game integration package.
- The content of this file may not be used without valid licenses to the
- AUDIOKINETIC Wwise Technology.
- Note that the use of the game engine is subject to the Unreal(R) Engine End User
- License Agreement at https://www.unrealengine.com/en-US/eula/unreal
-
- License Usage
-
- Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
- this file in accordance with the end user license agreement provided with the
- software or, alternatively, in accordance with the terms contained
- in a written agreement between you and Audiokinetic Inc.
- Copyright (c) 2023 Audiokinetic Inc.
- *******************************************************************************/
- #if WITH_EDITOR
- #include "AkWaapiBlueprints/AkWaapiUriCustomization.h"
- #include "AkAudioDevice.h"
- #include "Framework/Application/SlateApplication.h"
- #include "Widgets/Images/SImage.h"
- #include "Widgets/Input/SButton.h"
- #include "DetailWidgetRow.h"
- #include "AkWaapiBlueprints/AkWaapiUri.h"
- #include "AkAudioStyle.h"
- #if UE_5_0_OR_LATER
- #include "Framework/Docking/TabManager.h"
- #endif
- #define LOCTEXT_NAMESPACE "AkWaapiUriCustomization"
- TSharedRef<IPropertyTypeCustomization> FAkWaapiUriCustomization::MakeInstance()
- {
- return MakeShareable(new FAkWaapiUriCustomization());
- }
- void FAkWaapiUriCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
- {
- UriHandle = StructPropertyHandle->GetChildHandle("Uri");
- if (UriHandle.IsValid())
- {
- TSharedPtr<SWidget> PickerWidget = nullptr;
- PickerWidget = SAssignNew(PickerButton, SButton)
- .ButtonStyle(FAkAudioStyle::Get(), "AudiokineticTools.HoverHintOnly")
- .ToolTipText(LOCTEXT("WwiseUriToolTipText", "Choose A Uri"))
- .OnClicked(FOnClicked::CreateSP(this, &FAkWaapiUriCustomization::OnPickContent, UriHandle.ToSharedRef()))
- .ContentPadding(2.0f)
- .ForegroundColor(FSlateColor::UseForeground())
- .IsFocusable(false)
- [
- SNew(SImage)
- .Image(FAkAudioStyle::GetBrush("AudiokineticTools.Button_EllipsisIcon"))
- .ColorAndOpacity(FSlateColor::UseForeground())
- ];
- HeaderRow.ValueContent()
- .MinDesiredWidth(125.0f)
- .MaxDesiredWidth(600.0f)
- [
- SNew(SHorizontalBox)
- + SHorizontalBox::Slot()
- .FillWidth(1.0f)
- .VAlign(VAlign_Center)
- [
- UriHandle->CreatePropertyValueWidget()
- ]
- + SHorizontalBox::Slot()
- .AutoWidth()
- .Padding(FMargin(4.0f, 0.0f, 0.0f, 0.0f))
- .VAlign(VAlign_Center)
- [
- PickerWidget.ToSharedRef()
- ]
- ]
- .NameContent()
- [
- StructPropertyHandle->CreatePropertyNameWidget()
- ];
- }
- }
- void FAkWaapiUriCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
- {
- }
- FReply FAkWaapiUriCustomization::OnPickContent(TSharedRef<IPropertyHandle> PropertyHandle)
- {
- Window = SNew(SWindow)
- .Title(LOCTEXT("UriPickerWindowTitle", "Choose A Uri"))
- .SizingRule(ESizingRule::UserSized)
- .AutoCenter(EAutoCenter::PreferredWorkArea)
- .ClientSize(FVector2D(350, 400));
- Window->SetContent(
- SNew(SBorder)
- [
- SNew(SAkWaapiUri)
- .FocusSearchBoxWhenOpened(true)
- .SelectionMode(ESelectionMode::Single)
- .OnSelectionChanged(this, &FAkWaapiUriCustomization::UriSelectionChanged)
- ]
- );
- TSharedPtr<SWindow> RootWindow = FGlobalTabmanager::Get()->GetRootWindow();
- FSlateApplication::Get().AddWindowAsNativeChild(Window.ToSharedRef(), RootWindow.ToSharedRef());
- return FReply::Handled();
- }
- void FAkWaapiUriCustomization::UriSelectionChanged(TSharedPtr< FString > in_Uri, ESelectInfo::Type SelectInfo)
- {
- if (in_Uri.IsValid())
- {
- UriHandle->SetValue(*in_Uri.Get());
- Window->RequestDestroyWindow();
- }
- }
- #undef LOCTEXT_NAMESPACE
- #endif//WITH_EDITOR
|