WwisePropertyDragDropOp.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #pragma once
  16. #include "CoreMinimal.h"
  17. #include "Input/DragAndDrop.h"
  18. #include "Widgets/DeclarativeSyntaxSupport.h"
  19. #include "Widgets/SBoxPanel.h"
  20. #include "Widgets/Layout/SBorder.h"
  21. #include "Widgets/Images/SImage.h"
  22. #include "Widgets/Text/STextBlock.h"
  23. #include "WaapiPicker/WwiseTreeItem.h"
  24. #include "AkAudioStyle.h"
  25. class AKAUDIO_API FWwisePropertyDragDropOp : public FDragDropOperation
  26. {
  27. public:
  28. DRAG_DROP_OPERATOR_TYPE(FWwisePropertyDragDropOp, FDragDropOperation)
  29. static TSharedRef<FWwisePropertyDragDropOp> New(const TArray<TSharedPtr<FString>>& in_Wwiseproperties)
  30. {
  31. TSharedRef<FWwisePropertyDragDropOp> Operation = MakeShareable(new FWwisePropertyDragDropOp);
  32. #if WITH_EDITOR
  33. Operation->MouseCursor = EMouseCursor::GrabHandClosed;
  34. #else
  35. Operation->MouseCursor = EMouseCursor::None;
  36. #endif
  37. Operation->Wwiseproperties = in_Wwiseproperties;
  38. Operation->Construct();
  39. return Operation;
  40. }
  41. const TArray< TSharedPtr<FString> >& GetWiseProperties() const
  42. {
  43. return Wwiseproperties;
  44. }
  45. public:
  46. FText GetDecoratorText() const
  47. {
  48. FString Text = Wwiseproperties.Num() == 1 ? *Wwiseproperties[0].Get() : TEXT("");
  49. if (Wwiseproperties.Num() > 1 )
  50. {
  51. Text = FString::Printf(TEXT("Can't handle more than one Property"));
  52. }
  53. return FText::FromString(Text);
  54. }
  55. virtual TSharedPtr<SWidget> GetDefaultDecorator() const override
  56. {
  57. #if WITH_EDITOR
  58. return
  59. SNew(SBorder)
  60. .BorderImage(FAkAudioStyle::GetBrush("AudiokineticTools.AssetDragDropTooltipBackground"))
  61. .Content()
  62. [
  63. SNew(SHorizontalBox)
  64. // slot for the item name.
  65. + SHorizontalBox::Slot()
  66. .AutoWidth()
  67. .VAlign(VAlign_Center)
  68. [
  69. SNew(SHorizontalBox)
  70. +SHorizontalBox::Slot()
  71. .AutoWidth()
  72. .Padding(3,0,3,0)
  73. .VAlign(VAlign_Center)
  74. [
  75. SNew(STextBlock)
  76. .Text(this, &FWwisePropertyDragDropOp::GetDecoratorText)
  77. ]
  78. ]
  79. ];
  80. #else
  81. return NULL;
  82. #endif
  83. }
  84. private:
  85. /** Data for the asset this item represents */
  86. TArray<TSharedPtr<FString>> Wwiseproperties;
  87. };