SExtAssetDiscoveryIndicator.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "Layout/Visibility.h"
  5. #include "Layout/Margin.h"
  6. #include "Animation/CurveHandle.h"
  7. #include "Animation/CurveSequence.h"
  8. #include "Styling/SlateColor.h"
  9. #include "Widgets/DeclarativeSyntaxSupport.h"
  10. #include "Widgets/SCompoundWidget.h"
  11. #include "AssetDiscoveryIndicator.h"
  12. #include "ExtAssetData.h"
  13. /** An indicator for the progress of the asset registry background search */
  14. class SExtAssetDiscoveryIndicator : public SCompoundWidget
  15. {
  16. public:
  17. SLATE_BEGIN_ARGS( SExtAssetDiscoveryIndicator )
  18. : _ScaleMode(EAssetDiscoveryIndicatorScaleMode::Scale_None)
  19. , _FadeIn(true)
  20. {}
  21. /** The way the indicator will scale out when done displaying progress */
  22. SLATE_ARGUMENT( EAssetDiscoveryIndicatorScaleMode::Type, ScaleMode )
  23. /** The padding to apply to the background of the indicator */
  24. SLATE_ARGUMENT( FMargin, Padding )
  25. /** If true, this widget will fade in after a short delay */
  26. SLATE_ARGUMENT( bool, FadeIn )
  27. SLATE_END_ARGS()
  28. /** Destructor */
  29. virtual ~SExtAssetDiscoveryIndicator();
  30. /** Constructs this widget with InArgs */
  31. void Construct( const FArguments& InArgs );
  32. // SCompoundWidget interface
  33. virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override;
  34. /** Handles updating the progress from the asset registry */
  35. void OnAssetRegistryFileLoadProgress(const FExtAssetRegistry::FAssetGatherProgressUpdateData& ProgressUpdateData);
  36. /** Handles updating the progress from the asset registry */
  37. void OnAssetRegistryFilesLoaded();
  38. /** Gets the main status text */
  39. FText GetMainStatusText() const;
  40. /** Gets the sub status text */
  41. FText GetSubStatusText() const;
  42. /** Gets the progress bar fraction */
  43. TOptional<float> GetProgress() const;
  44. /** Gets the sub status text visbility */
  45. EVisibility GetSubStatusTextVisibility() const;
  46. /** Get the current wrap point for the status text */
  47. float GetStatusTextWrapWidth() const;
  48. /** Gets the background's opacity */
  49. FSlateColor GetBorderBackgroundColor() const;
  50. /** Gets the whole widget's opacity */
  51. FLinearColor GetIndicatorColorAndOpacity() const;
  52. /** Gets the whole widget's opacity */
  53. FVector2D GetIndicatorDesiredSizeScale() const;
  54. /** Gets the whole widget's visibility */
  55. EVisibility GetIndicatorVisibility() const;
  56. private:
  57. /** The main status text */
  58. FText MainStatusText;
  59. /** The sub status text (if any) */
  60. FText SubStatusText;
  61. /** The asset registry's asset discovery progress as a percentage */
  62. TOptional<float> Progress;
  63. /** The current wrap point for the status text */
  64. float StatusTextWrapWidth;
  65. /** The way the indicator will scale in/out before/after displaying progress */
  66. EAssetDiscoveryIndicatorScaleMode::Type ScaleMode;
  67. /** The fade in/out animation */
  68. FCurveSequence FadeAnimation;
  69. FCurveHandle FadeCurve;
  70. FCurveHandle ScaleCurve;
  71. };