WwiseStatusColumn.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 "WwiseStatusColumn.h"
  16. #include "WwiseBrowserForwards.h"
  17. #include "WwiseBrowserHelpers.h"
  18. #include "DataSource/WaapiDataSource.h"
  19. #include "Widgets/SWidget.h"
  20. #include "Widgets/Layout/SSpacer.h"
  21. #define LOCTEXT_NAMESPACE "AkAudio"
  22. FWwiseStatusColumn::FWwiseStatusColumn(SWwiseBrowser& WwiseBrowser)
  23. : WwiseBrowserWeak(StaticCastSharedRef<SWwiseBrowser>(WwiseBrowser.AsShared()))
  24. {
  25. }
  26. FText FWwiseStatusColumn::GetDisplayedName(FWwiseTreeItemPtr TreeItem)
  27. {
  28. if(!TreeItem->ShouldDisplayInfo() || WwiseBrowserWeak.Pin()->IsWaapiAvailable() != EWwiseConnectionStatus::Connected)
  29. {
  30. return LOCTEXT("WwiseBrowserEmpty", "");
  31. }
  32. if(TreeItem->IsSoundBankUpToDate())
  33. {
  34. return LOCTEXT("WwiseStatusColumnUpToDate", "SoundBank Up to Date");
  35. }
  36. else if (TreeItem->IsRenamedInWwise())
  37. {
  38. return LOCTEXT("WwiseStatusColumnRenamed", "Renamed in Wwise");
  39. }
  40. else if(TreeItem->IsNewInWwise())
  41. {
  42. return LOCTEXT("WwiseStatusColumnNewInWwise", "New In Wwise");
  43. }
  44. else if(TreeItem->IsDeletedInWwise())
  45. {
  46. return LOCTEXT("WwiseStatusColumnNewInWwise", "Deleted In Wwise");
  47. }
  48. else if (TreeItem->IsMovedInWwise())
  49. {
  50. return LOCTEXT("WwiseStatusColumnMovedInWwise", "Moved In Wwise");
  51. }
  52. return LOCTEXT("WwiseStatusColumnNotInWwise", "Not in Wwise or SoundBank");
  53. }
  54. FName FWwiseStatusColumn::GetColumnId()
  55. {
  56. return FName("WwiseStatus");
  57. }
  58. const TSharedRef<SWidget> FWwiseStatusColumn::ConstructRowWidget(FWwiseTreeItemPtr TreeItem,
  59. const STableRow<FWwiseTreeItemPtr>& Row)
  60. {
  61. return SNew(SHorizontalBox)
  62. + SHorizontalBox::Slot()
  63. .AutoWidth().
  64. VAlign(VAlign_Center)
  65. [
  66. SNew(SHorizontalBox)
  67. + SHorizontalBox::Slot()
  68. .AutoWidth()
  69. [
  70. SNew(SSpacer)
  71. .Size(8.f)
  72. ]
  73. + SHorizontalBox::Slot()
  74. .AutoWidth()
  75. [
  76. SNew(STextBlock)
  77. .Text(GetDisplayedName(TreeItem))
  78. .ColorAndOpacity((WwiseBrowserWeak.Pin()->IsWaapiAvailable() != EWwiseConnectionStatus::Connected) ? FLinearColor::Gray : WwiseBrowserHelpers::GetTextColor(TreeItem->IsSoundBankUpToDate()))
  79. ]
  80. ];
  81. }
  82. SHeaderRow::FColumn::FArguments FWwiseStatusColumn::ConstructHeaderRowColumn()
  83. {
  84. SHeaderRow::FColumn::FArguments WwiseStatusColumnHeader = SHeaderRow::Column(GetColumnId());
  85. TAttribute<FText> StatusLabel;
  86. StatusLabel.Set(FText::FromString("Wwise Project vs SoundBanks"));
  87. WwiseStatusColumnHeader.DefaultLabel(StatusLabel);
  88. WwiseStatusColumnHeader.DefaultTooltip(LOCTEXT("WwiseColumn_Tooltip", "The status of the name and ID in the Generated SoundBanks compared to the name and ID in the Wwise Project. The Wwise Project must be open for this column to display information."));
  89. return WwiseStatusColumnHeader;
  90. }
  91. #undef LOCTEXT_NAMESPACE