WwiseUEAssetStatusColumn.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 "WwiseUEAssetStatusColumn.h"
  16. #include "AkAudioStyle.h"
  17. #include "WwiseBrowserForwards.h"
  18. #include "WwiseBrowserHelpers.h"
  19. #include "Widgets/SWidget.h"
  20. #include "Widgets/Images/SImage.h"
  21. #include "Widgets/Layout/SSpacer.h"
  22. #include "Widgets/Text/STextBlock.h"
  23. #define LOCTEXT_NAMESPACE "AkAudio"
  24. FText FWwiseUEAssetStatusColumn::GetDisplayedName(FWwiseTreeItemPtr TreeItem)
  25. {
  26. if(!TreeItem->UEAssetExists() || !TreeItem->ShouldDisplayInfo())
  27. {
  28. return LOCTEXT("WwiseBrowserEmpty", "");
  29. }
  30. if(TreeItem->HasUniqueUAsset())
  31. {
  32. return FText::FromName(TreeItem->UAssetName);
  33. }
  34. return FText::Format(LOCTEXT("UEAssetsColumnMultiple", "Multiple UAssets ({0})"), TreeItem->Assets.Num());
  35. }
  36. FName FWwiseUEAssetStatusColumn::GetColumnId()
  37. {
  38. return FName("UEStatus");
  39. }
  40. const TSharedRef<SWidget> FWwiseUEAssetStatusColumn::ConstructRowWidget(FWwiseTreeItemPtr TreeItem,
  41. const STableRow<FWwiseTreeItemPtr>& Row)
  42. {
  43. return SNew(SHorizontalBox)
  44. + SHorizontalBox::Slot()
  45. .AutoWidth()
  46. [
  47. SNew(SSpacer)
  48. .Size(8.f)
  49. ]
  50. + SHorizontalBox::Slot()
  51. .AutoWidth()
  52. .Padding(0, 1, 2, 1)
  53. .VAlign(VAlign_Center)
  54. [
  55. SNew(SImage)
  56. .Image(FAkAudioStyle::GetBrush(TreeItem->ItemType))
  57. .Visibility((!TreeItem->HasUniqueUAsset() || TreeItem->IsFolder()) ? EVisibility::Collapsed : EVisibility::Visible)
  58. ]
  59. + SHorizontalBox::Slot()
  60. .AutoWidth().
  61. VAlign(VAlign_Center)
  62. [
  63. SNew(STextBlock)
  64. .Text(GetDisplayedName(TreeItem))
  65. ];
  66. }
  67. SHeaderRow::FColumn::FArguments FWwiseUEAssetStatusColumn::ConstructHeaderRowColumn()
  68. {
  69. auto UEStatusColumnHeader = SHeaderRow::Column(GetColumnId());
  70. TAttribute<FText> UEStatusLabel;
  71. UEStatusLabel.Set(FText::FromString("Wwise UAssets Status"));
  72. UEStatusColumnHeader.DefaultLabel(UEStatusLabel);
  73. UEStatusColumnHeader.DefaultTooltip(LOCTEXT("UAssetColumn_Tooltip", "The number of UAssets that exist for this Item."));
  74. return UEStatusColumnHeader;
  75. }
  76. #undef LOCTEXT_NAMESPACE