SWwiseReconcile.cpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 "Widgets/SWwiseReconcile.h"
  16. #include "AkAudioStyle.h"
  17. #include "WwiseUEFeatures.h"
  18. #include "ProjectedResultColumn.h"
  19. #include "ReconcileOperationColumn.h"
  20. #include "ReconcileUEAssetStatusColumn.h"
  21. #include "WwiseReconcileObjectColumn.h"
  22. #include "SWwiseReconcileItemView.h"
  23. #include "Interfaces/IMainFrameModule.h"
  24. #include "Widgets/Images/SImage.h"
  25. #include "Widgets/Input/SButton.h"
  26. #include "Wwise/WwiseReconcile.h"
  27. #define LOCTEXT_NAMESPACE "AkAudio"
  28. void SWwiseReconcile::Construct(const FArguments& InArgs, const TArray< FWwiseReconcileItem >& InReconcileItems, TSharedRef<SWindow>& ReconcileWindow)
  29. {
  30. Window = ReconcileWindow;
  31. for(auto& Item : InReconcileItems)
  32. {
  33. ReconcileItems.Add(MakeShared<FWwiseReconcileItem>(Item));
  34. }
  35. HeaderRowWidget =
  36. SNew(SHeaderRow)
  37. .CanSelectGeneratedColumn(true);
  38. SetupColumns(*HeaderRowWidget);
  39. ChildSlot
  40. [
  41. SNew(SBorder)
  42. .Padding(4)
  43. .BorderImage(FAkAppStyle::Get().GetBrush("ToolPanel.GroupBorder"))
  44. [
  45. SNew(SOverlay)
  46. +SOverlay::Slot()
  47. [
  48. // Description
  49. SNew(SVerticalBox)
  50. + SVerticalBox::Slot()
  51. .AutoHeight()
  52. .Padding(0.f, 10.f, 0.f, 10.f)
  53. .HAlign(HAlign_Center)
  54. .VAlign(VAlign_Top)
  55. [
  56. SNew(SHorizontalBox)
  57. .Visibility(EVisibility::Visible)
  58. + SHorizontalBox::Slot()
  59. .AutoWidth()
  60. .HAlign(HAlign_Left)
  61. .VAlign(VAlign_Top)
  62. .Padding(0.f, 0.f, 2.f, 0.f)
  63. [
  64. SNew(SImage)
  65. .Image(FAkAppStyle::Get().GetBrush("Icons.Warning"))
  66. .ColorAndOpacity(FSlateColor(FColor::Yellow))
  67. ]
  68. + SHorizontalBox::Slot()
  69. .AutoWidth()
  70. .HAlign(HAlign_Left)
  71. .VAlign(VAlign_Top)
  72. [
  73. SNew(STextBlock)
  74. .Text(LOCTEXT("ReconcileWarning", "Make sure the SoundBanks are properly generated before doing the Reconciliation process."))
  75. .ColorAndOpacity(FSlateColor(FColor::Yellow))
  76. ]
  77. ]
  78. // List
  79. + SVerticalBox::Slot()
  80. .FillHeight(1.f)
  81. [
  82. SAssignNew(ReconcileList, SWwiseReconcileListView, StaticCastSharedRef<SWwiseReconcile>(AsShared()))
  83. .ListItemsSource(&ReconcileItems)
  84. .OnGenerateRow(this, &SWwiseReconcile::GenerateRow)
  85. .ItemHeight(18)
  86. .ClearSelectionOnClick(false)
  87. .SelectionMode(ESelectionMode::None)
  88. .HeaderRow(HeaderRowWidget)
  89. ]
  90. +SVerticalBox::Slot()
  91. .AutoHeight()
  92. .Padding(0.f, 4.f, 0.f, 4.f)
  93. .HAlign(HAlign_Right)
  94. .VAlign(VAlign_Center)
  95. [
  96. SNew(SHorizontalBox)
  97. +SHorizontalBox::Slot()
  98. .AutoWidth()
  99. [
  100. SNew(SButton)
  101. .Text(LOCTEXT("ReconcileButton", "Reconcile Unreal Assets"))
  102. .OnClicked(this, &SWwiseReconcile::ReconcileAssets)
  103. ]
  104. + SHorizontalBox::Slot()
  105. .AutoWidth()
  106. [
  107. SNew(SButton)
  108. .Text(LOCTEXT("CancelButton", "Cancel"))
  109. .OnClicked(this, &SWwiseReconcile::CloseWindow)
  110. ]
  111. ]
  112. ]
  113. ]
  114. ];
  115. }
  116. SWwiseReconcile::SWwiseReconcile()
  117. {
  118. }
  119. void SWwiseReconcile::SetupColumns(SHeaderRow& HeaderRow)
  120. {
  121. Columns.Empty();
  122. HeaderRow.ClearColumns();
  123. auto WwiseObjectsColumn = MakeShared<FWwiseReconcileObjectColumn>();
  124. auto OperationColumn = MakeShared<FReconcileOperationColumn>();
  125. auto UEAssetStatusColumn = MakeShared<FReconcileUEAssetStatusColumn>();
  126. auto ProjectedResultColumn = MakeShared<FProjectedResultColumn>();
  127. auto WwiseObjectArgs = WwiseObjectsColumn->ConstructHeaderRowColumn();
  128. auto OperationArgs = OperationColumn->ConstructHeaderRowColumn();
  129. auto UEAssetStatusArgs = UEAssetStatusColumn->ConstructHeaderRowColumn();
  130. auto ProjectedResultsArgs = ProjectedResultColumn->ConstructHeaderRowColumn();
  131. Columns.Add(WwiseObjectArgs._ColumnId, WwiseObjectsColumn);
  132. Columns.Add(OperationArgs._ColumnId, OperationColumn);
  133. Columns.Add(UEAssetStatusArgs._ColumnId, UEAssetStatusColumn);
  134. Columns.Add(ProjectedResultsArgs._ColumnId, ProjectedResultColumn);
  135. HeaderRowWidget->AddColumn(WwiseObjectArgs);
  136. HeaderRowWidget->AddColumn(OperationArgs);
  137. HeaderRowWidget->AddColumn(UEAssetStatusArgs);
  138. HeaderRowWidget->AddColumn(ProjectedResultsArgs);
  139. }
  140. TSharedRef<ITableRow> SWwiseReconcile::GenerateRow(TSharedPtr<FWwiseReconcileItem> Item,
  141. const TSharedRef<STableViewBase>& OwnerTable)
  142. {
  143. check(Item.IsValid());
  144. TSharedRef<SWwiseReconcileRow> NewRow = SNew(SWwiseReconcileRow, ReconcileList.ToSharedRef(), SharedThis(this)).
  145. Item(Item);
  146. return NewRow;
  147. }
  148. FReply SWwiseReconcile::CloseWindow()
  149. {
  150. Window.Pin()->RequestDestroyWindow();
  151. return FReply::Handled();
  152. }
  153. FReply SWwiseReconcile::ReconcileAssets()
  154. {
  155. CloseWindow();
  156. FWwiseReconcile::Get()->ReconcileAssets();
  157. return FReply::Handled();
  158. }