WwiseBrowserTreeColumn.cpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #include "WwiseBrowserTreeColumn.h"
  16. #include "AkAudioStyle.h"
  17. #include "SWwiseBrowser.h"
  18. #include "WwiseBrowserHelpers.h"
  19. #include "Widgets/SWidget.h"
  20. #include "WaapiPicker/WwiseTreeItem.h"
  21. #define LOCTEXT_NAMESPACE "AkAudio"
  22. FWwiseBrowserTreeColumn::FWwiseBrowserTreeColumn(SWwiseBrowser& WwiseBrowser)
  23. : WwiseBrowserWeak( StaticCastSharedRef<SWwiseBrowser>(WwiseBrowser.AsShared()) )
  24. {
  25. }
  26. FName FWwiseBrowserTreeColumn::GetColumnId()
  27. {
  28. return FName("WwiseObjects");
  29. }
  30. const TSharedRef<SWidget> FWwiseBrowserTreeColumn::ConstructRowWidget(FWwiseTreeItemPtr TreeItem,
  31. const STableRow<FWwiseTreeItemPtr>& Row)
  32. {
  33. auto WwiseBrowser = WwiseBrowserWeak.Pin();
  34. bool bItemUpToDate = WwiseBrowser->IsWaapiAvailable() == EWwiseConnectionStatus::Connected ? TreeItem->IsItemUpToDate() : TreeItem->IsUAssetUpToDate();
  35. return SNew(SHorizontalBox)
  36. + SHorizontalBox::Slot()
  37. .AutoWidth()
  38. .Padding(0, 1, 2, 1)
  39. .VAlign(VAlign_Center)
  40. [
  41. SNew(SImage)
  42. .Image(FAkAudioStyle::GetBrush(TreeItem->ItemType))
  43. ]
  44. + SHorizontalBox::Slot()
  45. .AutoWidth()
  46. .VAlign(VAlign_Center)
  47. [
  48. SNew(STextBlock)
  49. .Text(FText::FromString(TreeItem->DisplayName))
  50. .ColorAndOpacity(WwiseBrowserHelpers::GetTextColor(bItemUpToDate || !TreeItem->ShouldDisplayInfo()))
  51. .HighlightText(WwiseBrowser->GetFilterHighlightText())
  52. ];
  53. }
  54. SHeaderRow::FColumn::FArguments FWwiseBrowserTreeColumn::ConstructHeaderRowColumn()
  55. {
  56. auto NameColumnHeader = SHeaderRow::Column(GetColumnId());
  57. NameColumnHeader.ColumnId(WwiseBrowserHelpers::WwiseBrowserColumnId);
  58. TAttribute<FText> Label;
  59. Label.Set(FText::FromString("Name"));
  60. NameColumnHeader.DefaultLabel(Label);
  61. NameColumnHeader.DefaultTooltip(LOCTEXT("WwiseBrowserColumn_Tooltip", "The names of the items in their hierarchy. The hierarchy uses the information from the Generated SoundBanks first."));
  62. return NameColumnHeader;
  63. }
  64. #undef LOCTEXT_NAMESPACE